<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Max Zander</title>
    <description>The latest articles on DEV Community by Max Zander (@maxjacobzander).</description>
    <link>https://dev.to/maxjacobzander</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F605444%2F82008de3-6f25-44fb-bb52-327b0fa78386.jpeg</url>
      <title>DEV Community: Max Zander</title>
      <link>https://dev.to/maxjacobzander</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maxjacobzander"/>
    <language>en</language>
    <item>
      <title>Favicons: Perhaps My Favorite Detail</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Mon, 16 Aug 2021 02:45:23 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/favicons-perhaps-my-favorite-detail-2740</link>
      <guid>https://dev.to/maxjacobzander/favicons-perhaps-my-favorite-detail-2740</guid>
      <description>&lt;p&gt;Are you familiar with favicons? Are you about to open google to search for what a favicon is? Well here — let me save you a trip!&lt;/p&gt;

&lt;p&gt;Favicons are the little icons that represent websites. You've probably noticed them on the tabs in your browser, next to the site's title. There's even a favicon on this very page!&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7qOSn4NR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4lqo8t03x1o0i9denvd2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7qOSn4NR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4lqo8t03x1o0i9denvd2.png" alt="A Favicon!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But anyway, in my opinion, the favicon is one of my absolute favorite details to add to a project, so I wanted to bring it to your attention.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;center&gt; Creating a Favicon &lt;/center&gt;
&lt;/h3&gt;

&lt;p&gt;So at its most basic, a favicon is an image. If you have a logo that you're using, you can go to a website like &lt;a href="https://favicon.io/"&gt;https://favicon.io/&lt;/a&gt; and convert your logo (or other image) to a favicon and download the converted images.&lt;/p&gt;

&lt;p&gt;If you have generated an application, using a favicon is extra simple! You may find a placeholder favicon in your app's &lt;code&gt;public&lt;/code&gt; folder and you can actually just replace the placeholder image!&lt;/p&gt;

&lt;p&gt;If you haven't before, make sure to really take a look into favicons — I think they're a wonderful tiny detail that makes all the difference!&lt;/p&gt;

</description>
      <category>favicons</category>
      <category>design</category>
    </item>
    <item>
      <title>Devise-ing A Backend...</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Sun, 08 Aug 2021 17:34:31 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/devise-ing-a-backend-1p76</link>
      <guid>https://dev.to/maxjacobzander/devise-ing-a-backend-1p76</guid>
      <description>&lt;p&gt;So if you know me or have been following my work and/or blog, you probably know that I have been building a few sites for some small businesses. In order to create a way for the site owner of one of these sites to update upcoming events, etc. without having to go through me, I have decided to build an accessible backend for a site which is currently operating as a frontend-only site (feat. a good deal of hardcoding).&lt;/p&gt;

&lt;p&gt;I am building that backend with Ruby on Rails using a Postgres database. I decided to add authentication so that the site can be login-able (meaning, something that can only be accessed via password by a user that is meant to have access) and, to accomplish this, I decided to use Devise.&lt;/p&gt;

&lt;p&gt;So what &lt;em&gt;is&lt;/em&gt; Devise? Devise is a gem (or package) that makes authentication super easy. There's a lot that makes Devise cool, but one of the best things about Devise is that it has bcrypt built in! This means that it will salt and hash passwords for you!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For those of you who don't know what that means: when a password is "salted" a unique and random string of additional characters is added to the given password. When the password is "hashed", all of those characters (both given and added during salting) are scrambled and converted into an indecipherable new string that cannot be converted back. NB: The addition of the "salt" is what would differentiate the passwords of two users who both chose "password" as their password, for example. When a user logs in, the site is able to compare the value of the entered password to the saved salted and hashed password to validate the password.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But while that's all awesome, my favorite thing about Devise is how much it does for you while being so simple to use! You generally want to add Devise immediately upon generating the application and, by simply by adding &lt;code&gt;gem 'devise'&lt;/code&gt; to your Gemfile, running &lt;code&gt;bundle install&lt;/code&gt; (or &lt;code&gt;bundle update&lt;/code&gt; if you already have Devise on your machine), and then running &lt;code&gt;rails g devise:install&lt;/code&gt;, you can add Devise to your application. You'll note that there is now a &lt;code&gt;devise.rb&lt;/code&gt; file in your &lt;code&gt;config/initializers&lt;/code&gt; folder and in your &lt;code&gt;config/locales&lt;/code&gt; folder, there is a &lt;code&gt;devise.en.yml&lt;/code&gt; file, which holds all of the notifications that Devise will use. (More things have been generated, but at this time, these are the two changes that you can actually see.)&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;config/routes.rb&lt;/code&gt;, add a root route, such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root to: "home#index"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and in &lt;code&gt;app/views/layouts/application.html.erb&lt;/code&gt;, add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      &amp;lt;p class="notice"&amp;gt;&amp;lt;%= notice %&amp;gt;&amp;lt;/p&amp;gt;
      &amp;lt;p class="alert"&amp;gt;&amp;lt;%= alert %&amp;gt;&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to add flash messages.&lt;/p&gt;

&lt;p&gt;You can then generate your users by running &lt;code&gt;rails g devise user&lt;/code&gt;. This will generate a migration for you, as well as a model, and routes (in &lt;code&gt;config/routes.rb&lt;/code&gt;, you'll now notice &lt;code&gt;devise_for :users&lt;/code&gt;)! Run &lt;code&gt;rails db:migrate&lt;/code&gt; to migrate the database.&lt;/p&gt;

&lt;p&gt;Now, if you recall, I was mentioning how much Devise does for you. If you start up your server and check out your routes, you'll see a &lt;strong&gt;bunch&lt;/strong&gt; there! Follow one of those and you'll even see a view that already exists for you! And believe it or not, we already have working signup, flash messages, etc. Crazy, right?!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fnrkJhdz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media1.giphy.com/media/eeowUvYEP1IfQ0S1rr/giphy.gif%3Fcid%3Decf05e47sfazsqjnn8y5r8rfs3u5e4hkcsxbu43bx1iacm42%26rid%3Dgiphy.gif%26ct%3Dg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fnrkJhdz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media1.giphy.com/media/eeowUvYEP1IfQ0S1rr/giphy.gif%3Fcid%3Decf05e47sfazsqjnn8y5r8rfs3u5e4hkcsxbu43bx1iacm42%26rid%3Dgiphy.gif%26ct%3Dg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But in order to give us access to all of those things we saw in our routes, we're going to want to generate our views as well. So popping back over to our terminal, we can run &lt;code&gt;rails g devise:views&lt;/code&gt; and that will add an &lt;code&gt;app/views/devise&lt;/code&gt; folder! Now we can access and edit those views.&lt;/p&gt;

&lt;p&gt;And like I said before, Devise does a lot for you and that includes giving you access to built-in helper methods, like &lt;code&gt;current_user&lt;/code&gt; (which returns the Current user object) and &lt;code&gt;user_signed_in?&lt;/code&gt; (which returns either &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt; depending on if user has been signed in and a session exists for them).&lt;/p&gt;

&lt;p&gt;This is just an intro to Devise and what it can do for you, and I wanted to share it with you since I think it's so great and handy! I'm very happy to be using it again for this project and, should you find yourself using Devise on a project at some point in the future, I hope that you enjoy it too! &lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>authentication</category>
      <category>devise</category>
    </item>
    <item>
      <title>An open letter to my future self</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Sun, 01 Aug 2021 19:51:15 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/an-open-letter-to-my-future-self-1jad</link>
      <guid>https://dev.to/maxjacobzander/an-open-letter-to-my-future-self-1jad</guid>
      <description>&lt;p&gt;Hey Max,&lt;/p&gt;

&lt;p&gt;How's it going? I've been thinking about you a lot lately. Whenever I start learning a new skill or reinforce an old one, I think of you. Each time I get word that a company has decided to go in a different direction, you pop into my head. I know it isn't wise to get attached to a job you don't have, but I guess that logic hasn't stopped me from doing so. But when I think about you and how happy to you are at your job, I know that both of us are exactly where we are supposed to be.&lt;/p&gt;

&lt;p&gt;I also wanted to write to tell you how proud I am of you. You kept going even when the going got tough. You took a thing that you thought was cool and you learned it and turned it into a career. You've surpassed anything that you thought was possible and continue to learn. You're getting that experience that I'm currently lacking and want so badly to have. That's amazing. I'm thrilled and again, I'm so crazy proud of you. You've (hopefully) found a great group of people to work with and to grow with and I hope that you are using your experience to help encourage others who are just starting out and feeling the way you felt. It is definitely hard to spend so much time with what at times seems like no payoff, but you realized that there is a payoff and it's worth the wait. I admire that.&lt;/p&gt;

&lt;p&gt;There's a lot I can learn from you and at the end of the day, I guess that's kinda why I think about you so much. Eventually, I will just be a memory and I guess you'll be grateful for the journey I'm on. I need to remember that more. Hell, I have a lot to be grateful for now and as I sit here thinking about you, I'm becoming extra aware of that. I guess I owe you that too, so thanks for that too.&lt;/p&gt;

&lt;p&gt;Anyway, thanks for sticking with it. I can't wait to catch up to you — I know you're doing amazing things!&lt;/p&gt;

&lt;p&gt;Looking forward and working hard,&lt;/p&gt;

&lt;p&gt;Max&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>leadership</category>
      <category>inspiration</category>
      <category>encouragement</category>
    </item>
    <item>
      <title>Returning to Liquor Cabinet: Fixing A Bug</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Sun, 25 Jul 2021 20:33:33 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/returning-to-liquor-cabinet-fixing-a-bug-1gam</link>
      <guid>https://dev.to/maxjacobzander/returning-to-liquor-cabinet-fixing-a-bug-1gam</guid>
      <description>&lt;p&gt;So this last week I decided to deploy another old app of mine. If you read my post &lt;a href="https://dev.to/maxjacobzander/searching-for-ways-to-search-two-methods-of-performing-a-search-with-a-rails-back-end-and-a-react-redux-front-end-45f0"&gt;Searching for Ways to Search: Two Methods Of Performing A Search With A Rails Back-End And A React-Redux Front-End&lt;/a&gt;, you may recall my app "Liquor Cabinet". "Liquor Cabinet" is an app I built at the end of my time at Flatiron School with a React with Redux front-end and a Ruby on Rails back-end. I actually haven't altered all that much of it since then because I liked the idea of having something on my Github profile that can show the growth I've experienced since graduating. ("Liquor Cabinet" is built with a lot of class components, very few hooks, etc.)&lt;/p&gt;

&lt;p&gt;Anyway, I decided to revisit the app this week to deploy it, so converted the database to Postgres and popped that up onto Heroku, updated the fetches on the front-end to reflect the new URL endpoint, and put that up onto Netlify (if you want to learn more about that process, you can read &lt;a href="https://dev.to/maxjacobzander/deploying-a-full-stack-app-for-the-first-time-vanilla-javascript-rails-api-2ocg"&gt;this post here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Fast-forward a couple of days and I'm talking to a couple of folks at a super cool company and one of them mentions to me that he is trying to use "Liquor Cabinet" but it isn't working. My first instinct was that it was actually a Heroku issue. "Liquor Cabinet" uses "free dynos" and, as I mentioned in my post about &lt;a href="https://dev.to/maxjacobzander/deploying-a-full-stack-app-for-the-first-time-vanilla-javascript-rails-api-2ocg"&gt;deploying a full-stack app&lt;/a&gt;, if the app uses "free dynos" and no server requests happen for 30 minutes, the server will stop running. If someone tries to make a request to the server, it will wake itself back up and start running again, but it does take a second. So I told him that he should wait a second and try again. Still no dice. I asked what he was searching for and tried it on my end and it seemed to work fine. But then I realized something. I was capitalizing my search. Could it be a case-sensitivity thing? How could I have missed that? I asked if he was searching with a capitalized first letter or not. He said that he wasn't and I asked him to try it capitalized. Bingo — it worked. I thanked him for exposing the bug and as soon as I got off the call, I hopped on VSCode to fix it.&lt;/p&gt;

&lt;p&gt;My first thought was to go into the &lt;code&gt;drinks_controller.rb&lt;/code&gt; file and look at the search method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  def search
    @drinks = Drink.where("main_liquor LIKE ?", "%" + params[:q] + "%")
    render json: @drinks
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I thought that maybe if I tacked some methods on to &lt;code&gt;params[:q]&lt;/code&gt; I may be on to something. I booted up my rails server...Not quite.&lt;/p&gt;

&lt;p&gt;I took another moment to think about how the data was going back and forth between the front-end and the back-end. I looked at my &lt;code&gt;Search.js&lt;/code&gt; and how I was handling the submission of the form. Turning to my &lt;code&gt;actions.js&lt;/code&gt;, I looked at how my search fetch was happening:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const searchDrinks = liquor =&amp;gt; {

    return(dispatch) =&amp;gt; {
        return fetch(`http://localhost:3001/api/v1/search?q=${liquor}`, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({liquor})
        })
        .then(resp =&amp;gt; resp.json())
        .then(liquor =&amp;gt; {
            console.log("liquor", liquor)
            dispatch({ type: "FIND_DRINK", payload: liquor })
        })
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Essentially, what we have going on here is that we are taking the input from the search bar and calling that &lt;code&gt;liquor&lt;/code&gt;. We're then sending a POST request (used to send data, rather than say a GET request which is used to request data) to the back-end database, interpolating in the searched liquor to the end of the URL endpoint. Since data can only travel as a string, we're taking the JSON at the endpoint and turning it into a string and then, once it makes it back to the front-end, we're turning that string back into JSON and applying the reducer to update state. Cool.&lt;/p&gt;

&lt;p&gt;Anyway, as I looked back on that, suddenly, the solution was obvious! Here's an example of what URL of a successful search on the back-end looks like: &lt;code&gt;http://localhost:3001/api/v1/search?q=Whiskey&lt;/code&gt;. Can you spot what we're about to do?&lt;/p&gt;

&lt;p&gt;The solution laid in altering what's being interpolated into the fetch request. Since what we're interpolating is exactly what the user is searching for, we just have to alter it to fit the format of the database (in this case, capitalizing the first letter). So how do we do that?&lt;/p&gt;

&lt;p&gt;So let's say our searched &lt;code&gt;liquor&lt;/code&gt; is whiskey. Since our searched term is a string, we need to use string methods. If we were to call &lt;code&gt;.toUpperCase()&lt;/code&gt; on &lt;code&gt;liquor&lt;/code&gt;, we would get &lt;code&gt;WHISKEY&lt;/code&gt;. Since we only need the first letter capitalized, we need to separate out that letter. We can use &lt;code&gt;.charAt()&lt;/code&gt; to return out just the character we need and chain on &lt;code&gt;toUpperCase()&lt;/code&gt; to that character. If we then call the string method &lt;code&gt;.slice()&lt;/code&gt; on &lt;code&gt;liquor&lt;/code&gt; and only provide a starting index, we can return the rest of the letters as a new string. Concatenating those two returned values, we can get the whole word with just the first letter capitalized:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;liquor.charAt(0).toUpperCase() + liquor.slice(1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Popping that into the fetch looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; return fetch(`http://localhost:3001/api/v1/search?q=${liquor.charAt(0).toUpperCase() + liquor.slice(1)}`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that worked! Cool. But then I was thinking about other ways that this solution could be broken and realized that, while I was successfully capitalizing the first letter on the entered search term, I wasn't accounting for someone searching with caps lock on or someone else searching with rAndOMizeD cApITal LetTeRS. Testing that out in the app, my suspicions were confirmed.&lt;/p&gt;

&lt;p&gt;Having just fixed the first issue, this was a &lt;em&gt;super&lt;/em&gt; simple fix. I went back into &lt;code&gt;actions.js&lt;/code&gt; and called &lt;code&gt;.toLowerCase()&lt;/code&gt; on the sliced out characters. This will take whatever the user inputs and make it lowercased, also fitting the necessary search format.&lt;/p&gt;

&lt;p&gt;All together, the fetch now looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; return fetch(`http://localhost:3001/api/v1/search?q=${liquor.charAt(0).toUpperCase() + liquor.slice(1).toLowerCase()}`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and &lt;em&gt;that&lt;/em&gt; both worked &lt;em&gt;and&lt;/em&gt; accounted for any weird capitalization. Testing it out in the app, we were looking good and successful!&lt;/p&gt;

&lt;p&gt;I'm super glad I had this experience and it just goes to show how important it is to have other eyes on your work! If you would like to check out this app, you can do so &lt;a href="https://liquor-cabinet.netlify.app/"&gt;here&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>react</category>
      <category>fetching</category>
      <category>bugs</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>Let's Talk About Sets Baby...</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Mon, 19 Jul 2021 02:35:49 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/let-s-talk-about-sets-baby-1ah9</link>
      <guid>https://dev.to/maxjacobzander/let-s-talk-about-sets-baby-1ah9</guid>
      <description>&lt;h2&gt;
  
  
  &lt;center&gt; 🎶 &lt;em&gt;Let's talk about sets...&lt;/em&gt; 🎶 &lt;/center&gt;
&lt;/h2&gt;

&lt;p&gt;So if you read my blog post &lt;a href="https://dev.to/maxjacobzander/data-types-vs-structures-1knf"&gt;Data: Types vs. Structures&lt;/a&gt;, you might recall me talking about a data structure known as a &lt;strong&gt;Set&lt;/strong&gt;. I was doing a code challenge this last week and found sets to be incredibly helpful in finding an efficient solution, so I decided to take a minute this week to 🎵&lt;em&gt;talk about sets (baby)&lt;/em&gt;🎵.&lt;/p&gt;




&lt;p&gt;Sets (or set objects) are a collection of values and, as I mentioned in my aforementioned previous post, the values in a set are unique (meaning they can only occur once). This can prove super helpful for finding out if something belongs to a set of values or if you need to figure out how many unique values exist in a a given set of data.&lt;/p&gt;

&lt;p&gt;So now that we've established &lt;em&gt;what&lt;/em&gt; sets are, let's talk a little bit about how to use them:&lt;/p&gt;

&lt;p&gt;First of all, how do we create a set? Well, to create a new set we say:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;new Set()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and if we want to add an argument, we can either add data directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let triadSet = new Set([1, 3, 5])
// the Set now looks like this: [1, 3, 5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or we can convert existing data to a set:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let array = [1, 3, 5, 3, 1]
let triadSetFromArray = new Set(array)
// the Set now looks like this: [1, 3, 5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;You'll note that the &lt;code&gt;triadSetFromArray&lt;/code&gt; doesn't repeat the second &lt;code&gt;3&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt; because (again), the values in a set are unique!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If we want to add to our set, we can call a method &lt;code&gt;add()&lt;/code&gt; to do so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;triadSetFromArray.add(8);
// the Set now looks like this: [1, 3, 5, 8]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;N.B. The &lt;code&gt;add()&lt;/code&gt; method adds the new element to the end of the set object.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you want to remove an element from a set object, you can do that by calling the &lt;code&gt;delete()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;triadSetFromArray.delete(8);
// the Set now looks like this: [1, 3, 5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So let's say you've created your great new set, &lt;code&gt;triadSetFromArray&lt;/code&gt; and you want to check what it contains. Sets have a method &lt;code&gt;has()&lt;/code&gt; that you can call to check on the contents. &lt;code&gt;has()&lt;/code&gt; returns a boolean value depending on the contents and works like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;triadSetFromArray.has(5);
// true

triadSetFromArray.has(4);
// false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's say you've been given the array above and are tasked with returning the amount of unique items exist in the array. Well, sets have a &lt;code&gt;size&lt;/code&gt; property that you can call to retrieve that kind of data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let array = [1, 3, 5, 3, 1]
let triadSetFromArray = new Set(array)

return triadSetFromArray.size
// 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if you decide that you're over the entire set object and you want to get clear out the whole thing (or, you know, you have a better reason to do it 😉), you can call the &lt;code&gt;clear()&lt;/code&gt; method to do so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;triadSetFromArray.clear();
// The Set now looks like this: []
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;So there's a little introduction to Sets. I think they're awesome and super helpful and I very much recommend adding them to your arsenal!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>sets</category>
      <category>datastructures</category>
    </item>
    <item>
      <title>Solving Leetcode's "Move Zeroes" with JavaScript</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Mon, 12 Jul 2021 03:24:37 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/solving-leetcode-s-move-zeroes-with-javascript-2lkn</link>
      <guid>https://dev.to/maxjacobzander/solving-leetcode-s-move-zeroes-with-javascript-2lkn</guid>
      <description>&lt;p&gt;So before I even get into my solution for how I solved Leetcode's "Move Zeroes" problem, I just want to mention something super obvious. &lt;strong&gt;ALWAYS READ YOUR INSTRUCTIONS!!&lt;/strong&gt; Now, you may be saying to yourself, "But Max, &lt;em&gt;of course&lt;/em&gt; one reads the instructions! Why would you say something so obvious?!", but let me tell you that part of growing is learning from your mistakes. Going to solve this problem, I first read the instructions and then looked at the examples:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; that you must do this in-place without making a copy of the array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: nums = [0,1,0,3,12]
Output: [1,3,12,0,0]
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: nums = [0]
Output: [0]
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;1 &amp;lt;= nums.length &amp;lt;= 104&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-231 &amp;lt;= nums[i] &amp;lt;= 231 - 1&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;So what did I do? After looking at the examples, I saw &lt;code&gt;[1,3,12,0,0]&lt;/code&gt; as sorted in order with the zeroes moved to the end and so my first few times around, I sorted my &lt;code&gt;nums&lt;/code&gt; array before moving the zeroes!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj16xfaq2hzyma3pls9dx.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj16xfaq2hzyma3pls9dx.gif" alt="Fozzy Bear facepalming"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So yeah, moral of the story: &lt;strong&gt;ALWAYS READ YOUR INSTRUCTIONS!&lt;/strong&gt; In fact, I would recommend, reading the instructions, looking at the examples, and then reading the instructions again! Because even if you look at it quickly and say to yourself, "Oh! That's an easy one!", you very well might have missed something.&lt;/p&gt;

&lt;p&gt;Ok so, sidebar aside, let's talk about how to solve the &lt;em&gt;actual&lt;/em&gt; problem!&lt;/p&gt;




&lt;p&gt;So let's look at the problem again:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; that you must do this in-place without making a copy of the array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: nums = [0,1,0,3,12]
Output: [1,3,12,0,0]
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: nums = [0]
Output: [0]
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;1 &amp;lt;= nums.length &amp;lt;= 104&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-231 &amp;lt;= nums[i] &amp;lt;= 231 - 1&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;So what's the goal? We are given an array called &lt;code&gt;nums&lt;/code&gt; and have to take that array and leave everything as is except for any zeroes (&lt;code&gt;0&lt;/code&gt;), which we move to the end of the array. All this while &lt;strong&gt;not&lt;/strong&gt; making a copy of the array.&lt;/p&gt;

&lt;p&gt;So first things first, we want to create a variable to keep track of non-zeroes. Let's call it "nonZero":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var moveZeroes = function(nums) {
    let nonZero = 0;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cool. So now that we have our &lt;code&gt;nonZero&lt;/code&gt; variable, let's loop through the &lt;code&gt;nums&lt;/code&gt; array to look for non-zeroes. We can accomplish this with a simple &lt;code&gt;for&lt;/code&gt; loop. If the current element in our array is &lt;em&gt;not&lt;/em&gt; equal to zero (&lt;code&gt;0&lt;/code&gt;), we can set it to the current index of &lt;code&gt;nonZero&lt;/code&gt; and then increment &lt;code&gt;nonZero&lt;/code&gt; to keep going:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var moveZeroes = function(nums) {
    let nonZero = 0;
    for(let i=0; i &amp;lt; nums.length; i++){
        if(nums[i] !== 0){
            nums[nonZero] = nums[i];
            nonZero++;
        };
    };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, to take care of our zeroes, we're going to use another loop.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;NB: This is a separate, non-nested loop, which will ultimately keep our solution to O(2n) time complexity, which since constants don't matter in Big O expressions, can just be simplified to **O(n)&lt;/em&gt;* time complexity!*&lt;/p&gt;

&lt;p&gt;This loop is going to go through the array at the &lt;code&gt;nonZero&lt;/code&gt; index and replace those elements with the appropriate zeroes and it looks a little something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    for(let i = nonZero; i &amp;lt; nums.length; i++) {
        nums[i] = 0;
    };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All together, the solution looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var moveZeroes = function(nums) {
    let nonZero = 0;
    for(let i=0; i &amp;lt; nums.length; i++){
        if(nums[i] !== 0){
            nums[nonZero] = nums[i];
            nonZero++;
        };
    };

    for(let i = nonZero; i &amp;lt; nums.length; i++) {
        nums[i] = 0;
    };
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But again, perhaps the most important thing to take away from this post is to please &lt;strong&gt;READ YOUR INSTRUCTIONS MORE THAN ONCE&lt;/strong&gt; because it will save you SO much time and complexity! (See what I did there? 😂)&lt;/p&gt;

</description>
      <category>leetcode</category>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Seemingly Subtle Differences: Padding vs. Margin</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Mon, 05 Jul 2021 03:39:55 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/seemingly-subtle-differences-padding-vs-margin-2o4o</link>
      <guid>https://dev.to/maxjacobzander/seemingly-subtle-differences-padding-vs-margin-2o4o</guid>
      <description>&lt;p&gt;&lt;em&gt;TLDR: Margin is outside of border around the content/element; Padding is within border the content/element.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;If you're like me, your initial foray into development/programming is/was into HTML and CSS. Even now, as I do a lot of JavaScript-based development, the principles I learned then are extremely relevant. (Sure, a lot of this can be attributed to the general importance/power of CSS and JSX being so seemingly similar to HTML, but bear with me.)&lt;/p&gt;

&lt;p&gt;Anyway, since I use CSS &lt;em&gt;literally&lt;/em&gt; all the time, I wanted to take a second to clarify a seemingly subtle (but useful and important) difference that took me a little bit to get back when I was first learning CSS, and that is &lt;strong&gt;the difference between the margin and padding properties&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Now, this is not terribly complex, but the big thing that you need to remember is that the difference lies in the relation to the content.&lt;/p&gt;

&lt;p&gt;If we think about the border around the content as being able to push in or out, the &lt;strong&gt;margin&lt;/strong&gt; property has to do with the amount of space would be pushing &lt;em&gt;out&lt;/em&gt;. You can potentially see the margin property given generally or you can see it broken down into &lt;code&gt;margin-top&lt;/code&gt;, &lt;code&gt;margin-right&lt;/code&gt;, &lt;code&gt;margin-bottom&lt;/code&gt;, &lt;code&gt;margin-left&lt;/code&gt;. If it is given by itself, and you see a single value listed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;margin: 5px;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That means that the &lt;code&gt;margin-top&lt;/code&gt;, &lt;code&gt;margin-right&lt;/code&gt;, &lt;code&gt;margin-bottom&lt;/code&gt;, and &lt;code&gt;margin-left&lt;/code&gt; values are all 5px. If you instead see it with two values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;margin: 5px 3px;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We read it based on a clockwise motion. So in this case, we would have &lt;code&gt;margin-top&lt;/code&gt; and &lt;code&gt;margin-bottom&lt;/code&gt; at 5px and &lt;code&gt;margin-right&lt;/code&gt; and &lt;code&gt;margin-left&lt;/code&gt; at 3px. If you see three values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;margin: 5px 3px 2px;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We still read it based on a clockwise motion and, in this case, we would have &lt;code&gt;margin-top&lt;/code&gt; at 5px, &lt;code&gt;margin-right&lt;/code&gt; &lt;em&gt;and&lt;/em&gt; &lt;code&gt;margin-left&lt;/code&gt; at 3px, and &lt;code&gt;margin-bottom&lt;/code&gt; at 2px. If you do see four values though, this is one for each and we &lt;em&gt;still&lt;/em&gt; read in a clockwise motion:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;margin: 5px 3px 2px 1px;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(&lt;code&gt;margin-top&lt;/code&gt; at 5px, &lt;code&gt;margin-right&lt;/code&gt; at 3px, &lt;code&gt;margin-bottom&lt;/code&gt; at 2px, and &lt;code&gt;margin-left&lt;/code&gt; at 1px).&lt;/p&gt;




&lt;p&gt;Now for the &lt;strong&gt;padding&lt;/strong&gt; property. If we go back to the pushing in or out idea, the &lt;strong&gt;padding&lt;/strong&gt; property has to do with the amount of space would be pushing &lt;em&gt;in&lt;/em&gt;. &lt;strong&gt;Padding&lt;/strong&gt; is the amount of space between the content and its border aka &lt;strong&gt;within the element itself&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Like with margin, padding can take up to four values and is read in the exact same way (clockwise). But one more difference that is worth mentioning is that, while margin &lt;em&gt;can&lt;/em&gt; take negative values, padding &lt;em&gt;cannot&lt;/em&gt; take negative values.&lt;/p&gt;

&lt;p&gt;All in all, these are two very important properties to master, as they are super helpful for working out your layout and figuring out spacing on the page. And while the differences may seem subtle, keep them straight and you'll be on your way to some beautiful design work!&lt;/p&gt;

</description>
      <category>css</category>
      <category>padding</category>
      <category>margin</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Are You Stuck on Sticky?</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Mon, 28 Jun 2021 01:48:51 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/are-you-stuck-on-sticky-41j7</link>
      <guid>https://dev.to/maxjacobzander/are-you-stuck-on-sticky-41j7</guid>
      <description>&lt;p&gt;So lately, a few people have been asking me about the sticky navbar on the website I built for a small crafting business called &lt;a href="https://adriansdream.com/" rel="noopener noreferrer"&gt;Adrian's Dream&lt;/a&gt;. If you're not really sure what that means, it looks a little something like this:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpr8vgjb26e0jbbrw1vn.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpr8vgjb26e0jbbrw1vn.gif" alt="A GIF of the Adrian's Dream website with its sticky navbar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Take a look at the navbar in that GIF. See how it &lt;em&gt;isn't&lt;/em&gt; scrolling with the page? &lt;em&gt;That's&lt;/em&gt; a sticky navbar.&lt;/p&gt;

&lt;p&gt;Now, since it has come up enough, I figured I'd write a quick post about how to do it and I promise accomplishing it is &lt;em&gt;way&lt;/em&gt; easier than you might think.&lt;br&gt;
&lt;em&gt;(Spoiler Alert: We're doing it with CSS!)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So first off, I want to briefly review the &lt;code&gt;position&lt;/code&gt; CSS property. According to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/position" rel="noopener noreferrer"&gt;Mozilla Docs&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The position CSS property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, not to go all here's-my-life-story-before-the-recipe on you, but before I tell you how to do it, I want to mention that the default value of the &lt;code&gt;position&lt;/code&gt; property is &lt;code&gt;position: static&lt;/code&gt;. What that means is that the element with a &lt;code&gt;static&lt;/code&gt; property will be positioned in a set place in the document, so if you scroll, the element will scroll along with everything else on the page.&lt;/p&gt;

&lt;p&gt;So how do we create a sticky navbar? Simple! We use &lt;code&gt;position: sticky&lt;/code&gt;!&lt;/p&gt;

&lt;p&gt;Let's say we have a navbar with a className of "navbar" (&lt;code&gt;&amp;lt;nav className="navbar"&amp;gt;&lt;/code&gt;). If we (amongst the rest of our CSS) add our &lt;code&gt;position&lt;/code&gt; and &lt;code&gt;top&lt;/code&gt; as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.navbar {
    position: sticky;
    top: 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have a navbar that is positioned at the very top of the document and, if we scroll down, it will be stuck to that position (not scrolling along with everything else). Boom. Easy, right?&lt;/p&gt;

&lt;p&gt;Now go forth and code!&lt;/p&gt;

</description>
      <category>css</category>
      <category>frontend</category>
      <category>sticky</category>
      <category>navbar</category>
    </item>
    <item>
      <title>Advice to my former self, beginners (and an announcement!)</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Sun, 20 Jun 2021 19:45:58 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/advice-to-my-former-self-beginners-and-an-announcement-398e</link>
      <guid>https://dev.to/maxjacobzander/advice-to-my-former-self-beginners-and-an-announcement-398e</guid>
      <description>&lt;p&gt;So since I published my last blog post, something very exciting happened...&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;center&gt; I GOT ENGAGED!! &lt;/center&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_ocm_N6t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/Y5Ravx6.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_ocm_N6t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/Y5Ravx6.gif" alt="yay!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So in honor of my amazing fiancée and how supportive she has been of me throughout my entire journey into coding, I want to give some advice to my former self (circa the beginning of my journey) and anyone else who may find it useful!   Here is some advice in honor of Ashley:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt; — Algorithms and data structures are going to be super important and good to know. Re: Algorithms — try to solve them on your own. It’ll be tough at first, but you’ll get there. Enjoy that satisfaction, but realize that your earliest solution is probably not the most efficient. (If you don’t know what that means yet, learn about Big O Notation!) But study solutions and take the time to understand them. Taking that time will make it an actual skill that can be applied to things and not just to a very specific case. And review your data structures so that you know a) when certain data structures are most useful and b) which methods work with which structures. Feeling confident in this will lead to WAY more confidence when you’re applying/interviewing for jobs!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S&lt;/strong&gt; — Sometimes the solution is right in front of your face. If nothing seems to be working and you’re getting super stressed out, take a second. Breathe. Don’t be afraid to put it away for a little bit. Honestly, fresh eyes do WONDERS. (And Spoiler Alert: it’s probably a missing semicolon, but it might be the wrong number of equals signs 😉👌)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;H&lt;/strong&gt; — Help is available. Whether you’re pair-programming or you need to use Google or you just need to find somebody to message directly, it’s totally normal to need help. Nobody knows everything and there’s no shame there. Ask questions, take in answers, learn, and grow!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;L&lt;/strong&gt; — Learning is a process. Look, I know you know this, but it’s good to remember. Keep reviewing the things that you’ve learned already so that those skills don’t get stale. Also, look at the kind of jobs that you would love to have. What skills are they looking for? Start learning those! Need help learning a topic? Check out Udemy, LinkedIn Learning, and YouTube! There are some great resources out there that can launch you into developing new skills!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;E&lt;/strong&gt; — Every. Day. In addition to everything listed above, you should be coding every single day! And if you’re not writing new code, review some old code! That’s super helpful too! Regardless of long you’ve been coding, is there anything that you would write differently now? (ex. I used to write React code with a lot of class components. Now, I would write React with mostly functional components and hooks. Growth!)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Y&lt;/strong&gt; — You’ve got this. There will be easy days and there will be stressful, difficult days. This is totally normal. You’re learning new languages and that’s undeniably tough. Take some time every now and again to reflect on where you were a few months ago or a year ago. You’ve come a long way and, even if there’s still a long way to go, you’re a champ and you should be proud of yourself. Remember that, even if skill development or the job search or anything else is taking time, you’re on the path you’re meant to be on and it’s all going to work out the way it is supposed to. So yeah, you’ve got this!  &lt;/p&gt;




&lt;p&gt;Anyway, if you read all the way through this, I hope it was helpful. And, in the spirit of this last week, remember to remember all of the joy of what you’re doing (and life in general, but that’s a whole other thing!).&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>advice</category>
      <category>devjournal</category>
      <category>motivation</category>
    </item>
    <item>
      <title>A Query, if you will...</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Fri, 11 Jun 2021 03:57:57 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/a-query-if-you-will-3f1o</link>
      <guid>https://dev.to/maxjacobzander/a-query-if-you-will-3f1o</guid>
      <description>&lt;p&gt;So here's a query for you: Do you know about &lt;strong&gt;media queries&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;If you don't, I'd like to take a moment today to introduce you to them.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;center&gt;So, what exactly &lt;em&gt;is&lt;/em&gt; a media query?&lt;/center&gt;
&lt;/h3&gt;

&lt;p&gt;Basically, a media query is something used in CSS to set certain rules conditionally. Media queries are super useful if you want to make your page/project responsive (fitting to various screen sizes).&lt;/p&gt;

&lt;p&gt;We define media queries by using the &lt;code&gt;@media&lt;/code&gt; rule. Frequently, we see if used in the following way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@media screen and (max-width: 1025px){
     // conditional CSS goes here
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;where it says &lt;code&gt;max-width&lt;/code&gt; may appear a little differently (ie. &lt;code&gt;min-width&lt;/code&gt;, etc.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Media queries can be super helpful if you want something to only appear in a desktop view or perhaps appear differently in a mobile view. An example of that would be having a button that does not display on mobile devices/screens smaller than 812px:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@media screen and (max-width: 812px){
     button { display:none; }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;BONUS&lt;/strong&gt; If you have been following along with my blog posts and have been using styled-components, you can use media queries in the following way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const ConditionalBackground = styled.div`
     background-color: #ff6b35;
     @media screen and (max-width: 960px){
          background-color: #15b7d7;
     }
`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;center&gt;So why is this important?&lt;/center&gt;
&lt;/h3&gt;

&lt;p&gt;Like I said, media queries are super helpful for formatting your design to fit various screen types. Nowadays, so many people use mobile devices to surf the web or check out apps. If you want people to want to use your applications, it will certainly be to your benefit to make sure that what they see is what you intend.&lt;/p&gt;

&lt;p&gt;If you're still reading, here's a final query for you: &lt;strong&gt;what are you waiting for?!&lt;/strong&gt; Go give it a shot!&lt;/p&gt;

</description>
      <category>mediaqueries</category>
      <category>beginners</category>
      <category>css</category>
    </item>
    <item>
      <title>A Gift Wrap</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Sat, 05 Jun 2021 23:39:44 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/a-gift-wrap-5216</link>
      <guid>https://dev.to/maxjacobzander/a-gift-wrap-5216</guid>
      <description>&lt;p&gt;Hey friends! This is a super quick post that I wanted to write as a little PSA for any of you beginners out there who use VSCode. If you are like me, you may not have gone through all of the settings in VSCode yet and, perhaps you have not realized yet that a text wrapping setting exists to keep your code from overflowing horizontally. I just wanted to bring it to your attention and tell you how to turn it on.&lt;/p&gt;

&lt;p&gt;From the menu bar, open the dropdown menu for &lt;strong&gt;Code&lt;/strong&gt; and select &lt;strong&gt;Preferences&lt;/strong&gt;. From there, open up your &lt;strong&gt;Settings&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You can jump straight to this point by using the shortcut:&lt;br&gt;
&lt;code&gt;⌘&lt;/code&gt; + &lt;code&gt;,&lt;/code&gt; (Mac) or &lt;code&gt;Ctrl&lt;/code&gt;+&lt;code&gt;,&lt;/code&gt; (PC).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Within &lt;strong&gt;Settings&lt;/strong&gt;, go into the section for &lt;strong&gt;Text Editor&lt;/strong&gt; and scroll all the way down until you get to &lt;strong&gt;Word Wrap&lt;/strong&gt;. Turn that &lt;strong&gt;on&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Boom. Check that out. Much easier to read and you don't have to create your own line breaks!&lt;/p&gt;

&lt;p&gt;I hope that's helpful. Now go be productive!&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>beginners</category>
      <category>convenience</category>
      <category>psa</category>
    </item>
    <item>
      <title>Implementing Smooth Scroll</title>
      <dc:creator>Max Zander</dc:creator>
      <pubDate>Sun, 30 May 2021 16:34:58 +0000</pubDate>
      <link>https://dev.to/maxjacobzander/implementing-smooth-scroll-54bn</link>
      <guid>https://dev.to/maxjacobzander/implementing-smooth-scroll-54bn</guid>
      <description>&lt;p&gt;When I initially built the site for &lt;a href="https://adriansdream.netlify.app/"&gt;Adrian’s Dream&lt;/a&gt;, I used &lt;code&gt;react-router-dom&lt;/code&gt; to set my routes for each individual page. As I was designing and building though, I realized that what I really wanted was to have everything on a single page and, rather than having the navbar redirect us to a different page, I wanted it to scroll to the clicked component.   So in this post, I am going to tell you about &lt;a href="https://www.npmjs.com/package/react-scroll"&gt;react-scroll&lt;/a&gt; and how to use it.&lt;/p&gt;




&lt;p&gt;To get started, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install react-scroll --save
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to add &lt;code&gt;react-scroll&lt;/code&gt; to your package.   &lt;/p&gt;

&lt;p&gt;Now we jump to our navbar component and we change our &lt;code&gt;Link&lt;/code&gt; import from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Link } from 'react-router-dom';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Link } from 'react-scroll';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(Before we move on, we need to make sure that we have &lt;code&gt;id&lt;/code&gt;s for each of the places on the page that we want to scroll to. So if you don't have those yet, go ahead and add those.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now for the fun part! We're going to actually implement the functionality. Back in our navbar component, we are going to change what's in our &lt;code&gt;Link&lt;/code&gt; tag so that each one looks as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   &amp;lt;li className='nav-item'&amp;gt;
       &amp;lt;Link
       to='about'
       className='nav-links'
       onClick={closeMobileMenu}
       spy={true}
       smooth={true}
       offset={-70}
       duration={500}&amp;gt;
           ABOUT
       &amp;lt;/Link&amp;gt;
  &amp;lt;/li&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To quickly break that down:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We are linking &lt;code&gt;to&lt;/code&gt; our &lt;code&gt;id&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;We have our &lt;code&gt;className&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;We set our &lt;code&gt;onClick&lt;/code&gt; to close the menu when it is in mobile view (no applicable for desktop view)&lt;/li&gt;
&lt;li&gt;We set &lt;code&gt;spy&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; (which makes Link selected when scroll is at its targets position)&lt;/li&gt;
&lt;li&gt;We set &lt;code&gt;smooth&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; (which sets the animation)&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;offset&lt;/code&gt; makes up for any additional pixels that need to be scrolled due to padding or something, and the &lt;code&gt;duration&lt;/code&gt; is how long (in milliseconds) it is going to take.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;And honestly, that's it!&lt;/strong&gt; Set that for each &lt;code&gt;nav-item&lt;/code&gt; and you've got yourself a smooth-scrolling page!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Please check out &lt;a href="https://adriansdream.netlify.app/"&gt;Adrian’s Dream&lt;/a&gt; for any of your crafting needs! It's a wonderful company with a meaningful story.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>navbar</category>
      <category>smoothscrolling</category>
      <category>navigation</category>
    </item>
  </channel>
</rss>
