<?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: Naya Willis</title>
    <description>The latest articles on DEV Community by Naya Willis (@greedybrain).</description>
    <link>https://dev.to/greedybrain</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%2F315123%2Fae4ce95c-e8ff-49b2-ad7c-ce24d1fb497d.jpeg</url>
      <title>DEV Community: Naya Willis</title>
      <link>https://dev.to/greedybrain</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/greedybrain"/>
    <language>en</language>
    <item>
      <title>From Trucker to Software Engineering Apprentice at Twitter</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Sun, 20 Dec 2020 02:53:21 +0000</pubDate>
      <link>https://dev.to/greedybrain/from-trucker-to-twitter-1c39</link>
      <guid>https://dev.to/greedybrain/from-trucker-to-twitter-1c39</guid>
      <description>&lt;p&gt;On Wednesday, December 17th 2020, I received some exciting news that I was selected to be an Apprentice Software Engineer at Twitter. I was super excited about the news. To be quite honest, it still hasn't processed in my mind yet. At least until my official Twitter merch arrives in the mail :) and my start date gets closer. This was a tedious and long process, and I enjoyed every bit of it and talking to the future team members. But I'd like to share my story on how I even got up to this point.&lt;/p&gt;

&lt;p&gt;First off, hello, the name is Naya Willis. I'm a truck driver in Queens, NY. I've been driving trucks for a few years now. I started coding at 21 years old. I'm 29 now. Back in 2010-2012 I was attending Queensborough Community college. I majored in Mechanical Engineering. A little into that degree program I realized that it wasn't really for me. I knew that I wanted to do something engineering wise, but not Mechanical Engineering. I for one love challenges, and Mechanical Engineering just didn't seem challenging enough. Not to mention, I was young and wasn't taking things too seriously back then. I never completed Queensborough Community College. It turned out college just isn't for everyone.&lt;/p&gt;

&lt;p&gt;A few weeks after this realization, I was walking home from school one day, and I couldn't tell you what made me walk into a Barnes and Nobles book store. I felt as if some entity took over me like "Watch out, I got this!". So I walk into the store and ask a representative about their books on computer programming, since I initially started doing some research about it at home. She directed me downstairs. I searched through the books in the computer section and came across a C++ Programming For Dummies book. I thought that that book was the holy grail of programming and had everything that I needed to know in it. Who was I kidding? I later found out that it was just a language and not programming and it's entirety. This led me down a rabbit hole in search for more and more information.&lt;/p&gt;

&lt;p&gt;I later found a book on Amazon titled Beginning Programming For Dummies, 7 Books in 1. This was it! My whole Software Engineering journey really took off with this &lt;a href="https://www.amazon.com/Beginning-Programming-All-Reference-Dummies/dp/0470108541/ref=sr_1_3?dchild=1&amp;amp;keywords=beginning+programming+for+dummies&amp;amp;qid=1608430728&amp;amp;sr=8-3"&gt;book&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IOhlhSJ_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/pddw66bqubeaczg8sjg8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IOhlhSJ_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/pddw66bqubeaczg8sjg8.png" alt="Alt Text" width="199" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This book shed light on so many programming topics. It actually became the passenger in the truck that I drive for work. At work I had a lot of downtime and would sit in the truck with that book and start highlighting text like crazy. Although, this slightly proved to be ineffective as I wasn't really able to immediately apply what I've been learning. At that point I was forcing myself to retain information. It wasn't like I could use my laptop on the truck. I eventually found my footing, and started prioritizing programming more than other things. I would get home from work and do further research on my laptop, practice some coding problems, you know? The whole shebang. I touched upon many different technologies back then. I actually fell in love with Python, and Javascript. I even dabbled a bit in Java at one point.&lt;/p&gt;

&lt;p&gt;Fast forward to 2019, years later, I thought to myself that I wanted to make a career out of this. All of those years of just being a newbie had to come to an end. That's where Flatiron Coding Bootcamp comes in. I joined the September 9 2019 cohort. There I learned how to become a more focused developer. I've become more structured, and welcomed the accountability. This stuff isn't a walk in the park as you can imagine. I graduated in July 2020. From that point on it was just continuous learning and sharpening my skills. I found it most helpful to do website clones and whatnot. It helped me tremendously. I even did a Twitter Clone, go figure. And then there was the job search. &lt;/p&gt;

&lt;p&gt;Some time into the job search process a friend of mine named Chaya (who I thank so much for telling me about this Twitter Apprenticeship program) said that I should apply. So, I did. She and some other classmates and I got together to tackle algorithms to prepare for it, and it went pretty well. Before I landed this Twitter Software Engineer Apprentice role I applied to at least 100 plus jobs. It was no fun at all, and even with rejection after rejection I didn’t give up. I most certainly wasn't going to just take any job. I had to really feel passionate about it. I always wanted to be involved in the development of a social media platform because I feel that there will always be new features to work on and new technologies to learn, which will feed my creative nature.&lt;/p&gt;

&lt;p&gt;The whole interview process took about a month. I had a very pleasant experience and I’m grateful to have met some of the kind and friendly tweeps so far. After a few interviews and not so long wait periods in between them the anxiety and anticipation came to an end. I received an email from my recruiter that I’ve been selected and extended an offer for a Twitter Software Engineering Apprentice. At the time of this writing it still feels surreal, but I know it will eventually fade away as the date that I start gets closer. I’m excited to embark on this journey to further solidify my knowledge about programming and learning from the other brilliant individuals at Twitter.&lt;/p&gt;

&lt;h1&gt;
  
  
  FYI
&lt;/h1&gt;

&lt;p&gt;In case anyone is interested, the next Apprenticeship program is scheduled for April 2021. Keep an eye out for that. &lt;a href="https://careers.twitter.com/en/twitter-engineering-apprenticeship-program.html"&gt;Here is the link&lt;/a&gt; to find out more information about it. &lt;/p&gt;

&lt;h1&gt;
  
  
  ALSO
&lt;/h1&gt;

&lt;p&gt;Add me on LinkedIn &lt;a href="https://www.linkedin.com/in/naya-willis-b6b30131/"&gt;Naya Willis&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Pug Template Engine</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Sun, 13 Dec 2020 13:48:35 +0000</pubDate>
      <link>https://dev.to/greedybrain/the-pug-template-engine-5gp5</link>
      <guid>https://dev.to/greedybrain/the-pug-template-engine-5gp5</guid>
      <description>&lt;h1&gt;
  
  
  What is Pug?
&lt;/h1&gt;

&lt;p&gt;Formerly known as Jade, Pug is a template engine for Node/Express. It allows you to write dynamic HTML which converts to plain HTML. In pug, when defining your html you don't have to use closing tags. You only specify the opening one. Once the file is converted to plain html, it will create the opening and closing tags for you.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;html(lang="en")
        head
             meta(charset="UTF-8")
             meta(name="viewport", content="width=device-width, initial-scale=1.0")
             title=title

=&amp;gt;

&amp;lt;html&amp;gt;
     &amp;lt;head&amp;gt;
          &amp;lt;meta charset="UTF-8"&amp;gt;
          &amp;lt;meta name="viewport", content="width=device-width, initial-scale=1.0"&amp;gt;
          &amp;lt;title&amp;gt;This Page&amp;lt;/title&amp;gt;
     &amp;lt;/head&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  To install
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i pug 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  To use
&lt;/h1&gt;

&lt;p&gt;Make sure that after you install it, that you tell express to set pug as your preferred template engine like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.set('view engine', 'pug')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Optionally, you should tell it where to look for your pug files as well. Most likely you'll have them in a views folder which is the default. If you have them in a different folder, you'll have to explicitly tell express:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.set('views', 'folder') 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that that's finished, let's go over some Pug syntax.&lt;/p&gt;

&lt;h1&gt;
  
  
  Defining Attributes
&lt;/h1&gt;

&lt;p&gt;To define attributes you define the html element, then immediately next to it (no whitespaces) you define the attributes within parenthesis like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;form(action="/path" method="POST")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above compiles to&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;form action="/path" method="POST"&amp;gt;
     ...
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  To add a class or id
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;h1.heading#main_heading Some text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above compiles to&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;h1 class="heading" id="main_heading"&amp;gt;
     ...
&amp;lt;/h1&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the text 'Some text'. To actually define text content you put a whitespace after you have finished defining your attributes, classes, id, what have you.&lt;/p&gt;

&lt;h1&gt;
  
  
  To define dynamic content
&lt;/h1&gt;

&lt;p&gt;Say inside your backend somewhere in a render method, you passed some data to that method in an object.&lt;/p&gt;

&lt;p&gt;i.e res.render('/path', { title: "This Page" })&lt;/p&gt;

&lt;p&gt;To use the value of 'title', there are 2 ways to make this happen.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;title=title

or

title #{ title }

Either or works and compiles to

&amp;lt;title&amp;gt;This Page&amp;lt;/title&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Writing a comment in pug
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Uncommented
p Let's comment this out

Commented
//- p Let's comment this out
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conditionals
&lt;/h1&gt;

&lt;p&gt;Say you wanted to render some content, ONLY if the user is logged in. That would look a little something like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if user.loggedIn
     a.logout_button(href='/logout') Logout
else
     a.login_button(href='/login') Login

The a tags convert to

&amp;lt;a class="logout_button" href='/logout'&amp;gt;Logout&amp;lt;/a&amp;gt;
&amp;lt;a class="login_button" href='/login'&amp;gt;Login&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;INDENTATION IS IMPORTANT. Make sure you are indenting accordingly. If the if statement above belongs in a header, then that's where you should put it. &lt;/p&gt;

&lt;h1&gt;
  
  
  Iterations
&lt;/h1&gt;

&lt;p&gt;More often than not you will be making requests to a database to get some data to work with. For example, you make a request to your backend to get all of your favorite cars. Each car has a make, model, image. It just so happens you have 3 currently. If you wanted to display this on a webpage dynamically, you would do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div.car_card
     if favCars.length &amp;gt; 0
          each car in favCars 
               div.card
                    div.car_image
                         img(src=car.image alt="car image")
                    div.car_make
                         h1=car.make
                    div.car_model
                         h2=car.model
     else
          p No cars available

The above converts to

&amp;lt;div class="car_card"&amp;gt;
     &amp;lt;div class="card"&amp;gt;
          &amp;lt;div class="car_image"&amp;gt;
               &amp;lt;img src="/nissan.png" alt="car image"/&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div class="car_make"&amp;gt;
               &amp;lt;h1&amp;gt;Nissan&amp;lt;/h1&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div class="car_model"&amp;gt;
               &amp;lt;h2&amp;gt;Maxima&amp;lt;/h2&amp;gt;
          &amp;lt;/div&amp;gt;
     &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above defines a cars card template. This template will be used for each car rendered.&lt;/p&gt;

&lt;p&gt;&amp;lt; CAR IMAGE &amp;gt;&lt;br&gt;
CAR MAKE&lt;br&gt;
CAR MODEL&lt;/p&gt;

&lt;p&gt;repeat 3x (your 3 favorite cars in the database)&lt;/p&gt;
&lt;h1&gt;
  
  
  Extends and Blocks
&lt;/h1&gt;

&lt;p&gt;Using the extends keyword with a file path defined in addition, allows us to inherit some template code from that file into the current file you are working in.&lt;/p&gt;

&lt;p&gt;The easiest example I can provide is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//- main-layout.pug

html
  head
    title=title
    link(rel="stylesheet" href="/css/index.css")
    block links
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we define a layout.pug template that has the basic html tree structure. It has a head which has a title which is set dynamically. Then it has a link that points to the css folder containing an index.css file. We specify that link because we want the styles defined in index.css to be used across all files that we 'extend' this template to. We then use the block keyword in addition to any name you want to use next to it. In our case we used links. What happens now is that when we extend this template to another pug file we can create additional links to css files that are only relevant to that specific pug file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//- cars.pug

extends layouts/main-layout.pug

block links
     link(rel="stylesheet" href="/css/cars.css")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the cars.pug file has everything that's in the main-layout.pug file PLUS the newly added link to the cars.css file. This keeps our code DRY. We don't have to copy the html tree structure from the main-layout.pug file and then paste it in the cars.pug file. &lt;/p&gt;

&lt;p&gt;Partials work similarly, but in pug it's referred to as includes.&lt;/p&gt;

&lt;p&gt;There's more that you can do with pug. I covered some of the basics. To learn more read their documentation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pugjs.org/api/getting-started.html"&gt;Pug Documentation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>pug</category>
      <category>node</category>
      <category>express</category>
      <category>programming</category>
    </item>
    <item>
      <title>5 Helpful CSS Tips</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Sun, 06 Dec 2020 21:21:47 +0000</pubDate>
      <link>https://dev.to/greedybrain/5-helpful-css-tips-1oga</link>
      <guid>https://dev.to/greedybrain/5-helpful-css-tips-1oga</guid>
      <description>&lt;h1&gt;
  
  
  1. Center an element directly on a page
&lt;/h1&gt;

&lt;p&gt;Before Centering Styles are applied&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W-1Uyg8F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/iu33zemxuks61hwpdyn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W-1Uyg8F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/iu33zemxuks61hwpdyn8.png" alt="Alt Text" width="800" height="867"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;page {
     height: 100vh;
     width: 100%;
     display: flex;
     align-items: center;
     justify-content: center;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Child elements being flexed must be block level elements.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After Centering Styles are applied&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--30RNJaGM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/4yikr0kshd6iqeofi80i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--30RNJaGM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/4yikr0kshd6iqeofi80i.png" alt="Alt Text" width="800" height="838"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Add shadow to an image directly (Image must have transparent background (PNG))
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;img { 
     filter: drop-shadow(5px 5px 4px #b6b6b6);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yf-4xEr6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/webwd54sz55vf2u8br5h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yf-4xEr6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/webwd54sz55vf2u8br5h.png" alt="Alt Text" width="350" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Properly sizing an image.
&lt;/h1&gt;

&lt;p&gt;Have you ever added an image to your html file and it just took up space on almost the whole page?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B8YdL1CG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/j4ujvykmid762xlncu5o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B8YdL1CG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/j4ujvykmid762xlncu5o.png" alt="Alt Text" width="800" height="711"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When working with images, it is good to have an image container. When you set a fixed width to that image container, and then set the actual images width to 100% it will then take up 100% of its parent container. &lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div.image-container {
     width: 200px;
}

div.image-container img {
     display: block;
     width: 100%; // of the image containers 200px width
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EqcRNeQf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/eoh375wgcxfhtx50ez63.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EqcRNeQf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/eoh375wgcxfhtx50ez63.png" alt="Alt Text" width="800" height="699"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  4. Use the CSS properties border or outline like crazy!
&lt;/h1&gt;

&lt;p&gt;To get a visual representation of your website layout or where all, or some of your elements are on a page use&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;border: 1px solid &amp;lt;some color&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 or&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;outline: 1px solid &amp;lt;some color&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 This tremendously helps you to save time guessing where everything is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hUX9g6PV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/yrnpe745hssascx65986.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hUX9g6PV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/yrnpe745hssascx65986.png" alt="Alt Text" width="800" height="676"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The outline property doesn't impact the layout of other elements around the element with the outline property defined. So outline may be better to use.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  5. Bring out elements with box-shadow
&lt;/h1&gt;

&lt;p&gt;I feel like everyone should learn a little something about box-shadow. It really makes your website stand out. I would suggest learning about the property and its value. Once you understand it, then check out &lt;a href="https://www.cssmatic.com/box-shadow"&gt;this website&lt;/a&gt; that autogenerates box shadow code for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yw0fDc1P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/p2wsnymdj9ynud9hl1fz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yw0fDc1P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/p2wsnymdj9ynud9hl1fz.png" alt="Alt Text" width="800" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
    </item>
    <item>
      <title>The Four Pillars of Object Oriented Programming</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Sun, 29 Nov 2020 23:07:37 +0000</pubDate>
      <link>https://dev.to/greedybrain/the-4-pillars-of-object-oriented-programming-4khk</link>
      <guid>https://dev.to/greedybrain/the-4-pillars-of-object-oriented-programming-4khk</guid>
      <description>&lt;p&gt;In this blog I will explain the 4 pillars of OOP and provide small examples. Small enough examples that you and I can comprehend easily.&lt;/p&gt;

&lt;h1&gt;
  
  
  Abstraction
&lt;/h1&gt;

&lt;p&gt;Abstraction is essentially "need to know". We hide the major implementation details, while keeping the obvious usage at the forefront. So remember this "hide the details, show the relevance".&lt;/p&gt;

&lt;p&gt;Abstraction example...&lt;/p&gt;

&lt;p&gt;This is a signup form of an app I'm working on (the relevance).&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%2Fi%2Ffwir96cmkcyb3x0tv4iw.png" 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%2Fi%2Ffwir96cmkcyb3x0tv4iw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the form's submission implementation logic. (the need to know).&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%2Fi%2Ffu0n7x6loz04oa6r53li.png" 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%2Fi%2Ffu0n7x6loz04oa6r53li.png" alt="Alt Text"&gt;&lt;/a&gt;&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%2Fi%2Fmm3ulfg9kxnck54356cb.png" 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%2Fi%2Fmm3ulfg9kxnck54356cb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Polymorphism
&lt;/h1&gt;

&lt;p&gt;Polymorphism is when you use one block of code, you change the version of the code being used based on the inputs being giving to it. So to make it a bit clearer, different classes can be used with the same interface but can provide its own implementation of that interface.&lt;/p&gt;

&lt;p&gt;Polymorphism example...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Animal {
  speak = () =&amp;gt; console.log('makes sound')
}
class Dog extends Animal {
  speak = () =&amp;gt; console.log('woof')
}

class Cat extends Animal {
  speak = () =&amp;gt; console.log('meowww')
}

class Cow extends Animal {
  speak = () =&amp;gt; console.log('moooooo')
}

let dog1 = new Dog()
let cat1 = new Cat()
let cow1 = new Cow()

dog1.speak() // =&amp;gt; woof
cat1.speak() // =&amp;gt; meowww
cow1.speak() // =&amp;gt; moooooo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Cat, Dog, and Cow classes are inheriting from the Animal class. This allows the Cat, Dog, and Cow class to use the Animal's interface. They only have the speak method available to them though. If we were to leave the speak method out of the Cat, Dog, and Cow class, and then create instances of a Cat, Dog, and Cow class we would still be able to call the speak method on those instances. The only issue is that it would print out the Animals 'makes sound' instead of the appropriate sounds that a Cat, Dog, and Cow makes ('meow', 'woof', 'moo'). &lt;/p&gt;

&lt;p&gt;This is where method overriding comes in. If we redefine the speak method in the Cat, Dog, and Cow classes, we can customize it to print out the sounds that cats and dogs make.&lt;/p&gt;

&lt;h1&gt;
  
  
  Encapsulation
&lt;/h1&gt;

&lt;p&gt;Encapsulation binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. A good example of encapsulation is a class. We can actually refer back to the example above where we talk about Dogs, Cats, and Cows with some slight modifications.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Dog {
  constructor(name) {
    this.name = name
  }
  printName = () =&amp;gt; console.log(this.name)
}

class Cat {
  constructor(name) {
    this.name = name
  }
  printName = () =&amp;gt; console.log(this.name)
}

class Cow {
  constructor(name) {
    this.name = name
  }
  printName = () =&amp;gt; console.log(this.name)
}

let dog1 = new Dog()
dog1.name = "Max"
dog1.printName() // =&amp;gt; Max

let cat1 = new Cat()
cat1.name = "Mark"
cat1.printName() // =&amp;gt; Mark

let cow1 = new Cow()
cow1.name = "Tom"
cow1.printName() // =&amp;gt; Tom
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice when we create instances for each animal we also assign a name to each. The takeaway here is that the '.name' after each created instances (i.e dog1.name) are all different. Those '.name' are encapsulated within their according classes. Assigning a name to an instance does not modify any other instances name value.&lt;/p&gt;

&lt;h1&gt;
  
  
  Inheritance
&lt;/h1&gt;

&lt;p&gt;Inheritance is probably the most easiest one to grasp. Inheritance is the concept of one class using(inheriting) the interface of another class. It then becomes a child or subclass while the class that it's inheriting from is the parent or superclass. We actually did some inheriting in our second example above. The Cat, Dog, and Cow class inherits from the Animal class in order to have access to the speak method. Just make sure to add the extends keyword. &lt;/p&gt;

&lt;p&gt;Thanks for reading, please do let me know if this was clear or not. Leave a comment below.&lt;/p&gt;

</description>
      <category>oop</category>
      <category>computerscience</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Working with Models in Rails vs Node</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Sun, 22 Nov 2020 20:56:38 +0000</pubDate>
      <link>https://dev.to/greedybrain/working-with-models-in-rails-vs-node-43b8</link>
      <guid>https://dev.to/greedybrain/working-with-models-in-rails-vs-node-43b8</guid>
      <description>&lt;h1&gt;
  
  
  Directory structure (And still growing)
&lt;/h1&gt;

&lt;p&gt;So far, throughout my Node.js learning journey it's been quite fun. Me personally, I love to have my code organized. So, what I've done was mimic rails like architecture. I created and app folder, and inside this app folder I have a few other folders such as models, controllers, routes, middleware, and tests. I didn't use 100% of rails architecture but just enough to help me have an organized directory structure. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DVlSD3Os--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/2wgairh7263t7i74o3cw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DVlSD3Os--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/2wgairh7263t7i74o3cw.png" alt="Alt Text" width="372" height="684"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Modeling an object
&lt;/h1&gt;

&lt;p&gt;I come from a rails background so seeing the way Node deals with Models is a tad different, but not "oh my god, what the hell" different. Say we had a model named 'Note' representing something that a user writes. The note has a title, and content. In rails you would define your schema within a migration file like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def change
     create_table :notes do |t|
          t.string :title
          t.string :content
     end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You would then go inside your note.rb file to define any validations and associations like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Notes &amp;lt; ActiveRecord::Base
     validates :title, :content, presence: true

     belongs_to :user
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is what it would look like in rails. Pretty straightforward huh? Now, let's check out modeling inside of a Node project.&lt;/p&gt;

&lt;p&gt;You define the schema and validations within the note.js file. By the way I'm using the MongoDB database which is a non-relational database. You associate your models using referencing and embedding as opposed to belongs to or has many. Let's define a Note schema and validations. I'll be using the Joi npm package to assist in the validation of a note.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r2RpypIN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/l1lkejoqnttnr9e0a8kl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r2RpypIN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/l1lkejoqnttnr9e0a8kl.png" alt="Alt Text" width="800" height="1039"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Simple enough?&lt;/p&gt;

&lt;p&gt;FYI, the validations defined within the Schema will do just fine. Using the joi package is a plus, setting up some validations on the client side.&lt;/p&gt;

&lt;p&gt;To associate a note with a User, you can simply embed the schema into a user. So a user will have an array of NoteSchemas (Every created note).&lt;/p&gt;

&lt;p&gt;It'll look a little something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qnw9M81k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/uqagxgm00ugdf2eh864q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qnw9M81k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/uqagxgm00ugdf2eh864q.png" alt="Alt Text" width="714" height="1172"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you take a look at the notes property defined in the UserSchema, we set the type to [NoteSchema]. This indicates that the user "has many" notes.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>My Twitter Mobile Clone</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Sun, 15 Nov 2020 22:27:09 +0000</pubDate>
      <link>https://dev.to/greedybrain/my-twitter-mobile-clone-30pc</link>
      <guid>https://dev.to/greedybrain/my-twitter-mobile-clone-30pc</guid>
      <description>&lt;p&gt;&lt;a href="https://5fb29adf74b97e00075f2101--modest-allen-d0c9f4.netlify.app/"&gt;LINK TO LIVE CLONE&lt;/a&gt; (Click the home button at bottom, for some reason it doesn't load the homepage right away)&lt;/p&gt;

&lt;p&gt;So, I cloned Twitter's mobile version. It was pretty challenging but I've managed to do the best I could. I used React and SCSS/CSS to build this. I practically made everything a component. I felt that the more components I use the more structured I would feel getting further into this project. After all, that's the point of react right?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c21TJYoD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/ysrzwvwha4iymqe43294.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c21TJYoD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/ysrzwvwha4iymqe43294.gif" alt="Alt Text" width="222" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Hompage
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bLLsIrO5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/57jv5oyg01ytq46782c1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bLLsIrO5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/57jv5oyg01ytq46782c1.png" alt="Alt Text" width="676" height="1480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the Twitter feed you would see. I'm actually using the npm package 'faker' to generate the fake users with fake tweets.&lt;/p&gt;

&lt;p&gt;This is the explorer page. I actually have a friend who sent me a random article to use which the one that you see on the page now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yQBPU0Pa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/ecaj8ntrw17dbr8cf8nm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yQBPU0Pa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/ecaj8ntrw17dbr8cf8nm.png" alt="Alt Text" width="676" height="1476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Navbar component at the bottom was the easiest part of the project to implement. The Navbar component is reusable across every page. I love that type of consistency. I tried to do the same with the header but it didn't work out how I wanted because of the icons on the right side of the header. For the most part, they are all different across pages.&lt;/p&gt;

&lt;h1&gt;
  
  
  Create Tweet Page
&lt;/h1&gt;

&lt;p&gt;This is the "Create Tweet" page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Xc1Z4CPy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/tkj9fjkjd5jsy2y8ccrz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xc1Z4CPy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/tkj9fjkjd5jsy2y8ccrz.png" alt="Alt Text" width="676" height="1476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was a little tough finding the exact same icons so I had to improvise and find closely similar ones. I actually used fontAwesome for the icons displayed.&lt;/p&gt;

&lt;p&gt;My favorite page to build was the one and only 🥁🥁🥁🥁🥁🥁...&lt;/p&gt;

&lt;h2&gt;
  
  
  Notifications Page
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pYJBZ5kT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/dni1b5trvi01lfjas690.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pYJBZ5kT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/dni1b5trvi01lfjas690.png" alt="Alt Text" width="678" height="1476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I looked at this and then looked at my phone to compare the clone and the actual page from the app, I said to myself, "Damn, I'm really getting good at this, the hard work is really paying off". This was a proud moment for me. &lt;/p&gt;

&lt;p&gt;To conclude, not everything on the clone is functional, again, it was mere UI practice. This clone helped me to understand component isolation a bit more. I will definitely be doing more of these. Thanks for reading.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://5fb29adf74b97e00075f2101--modest-allen-d0c9f4.netlify.app/"&gt;LINK TO LIVE CLONE&lt;/a&gt; (Click the home button at bottom, for some reason it doesn't load the homepage right away)&lt;/p&gt;

</description>
      <category>twitter</category>
      <category>javascript</category>
      <category>react</category>
      <category>css</category>
    </item>
    <item>
      <title>Node.js Under The Hood Routes vs Express Routes</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Sun, 08 Nov 2020 23:39:40 +0000</pubDate>
      <link>https://dev.to/greedybrain/node-js-under-the-hood-routes-vs-express-routes-9mc</link>
      <guid>https://dev.to/greedybrain/node-js-under-the-hood-routes-vs-express-routes-9mc</guid>
      <description>&lt;p&gt;So, I've been learning Node Js recently. It's been a little on and off but I'm still pushing through when I can. So far I'm really enjoying it. I'm actually learning it from one of my favorite developers. His name is Mosh. He has a very straightforward way of explaining things. I've actually used his videos in conjunction with another developer who goes by the handle The Net Ninja. He's pretty straightforward as well.&lt;/p&gt;

&lt;p&gt;I really enjoyed how The Net Ninja starts off showing you what's going on under the hood in is Node.js series. For example, defining your routes without using express would include you using either a switch case, or an if else block. It'll look a little something like this.&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%2Fi%2Fmpprbk78vk86gfmj7lzl.png" 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%2Fi%2Fmpprbk78vk86gfmj7lzl.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The req.url is basically the condition. We want to check if any of the following cases match this condition. If we get a match we add the .html file to the value of path so that html can be rendered. Basically, the path variable is "./views/". Which tells the application where to look for the corresponding .html file. In this case it's our views folder. &lt;/p&gt;

&lt;p&gt;On the other hand you have express which provides us some middleware functions such as app.use, app.get, etc. This makes our routing a bit more cleaner and to be honest I find it quite fun. To set up routing with express we basically do the following&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install express =&amp;gt; npm i express&lt;/li&gt;
&lt;li&gt;Import it =&amp;gt; const express = require('express')&lt;/li&gt;
&lt;li&gt;Invoke it, returning the value and setting it as the value of a variable named app (by convention)
=&amp;gt; const app = express()&lt;/li&gt;
&lt;li&gt;Start defining those routes like so
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.get('/', (req, res) =&amp;gt; {
     res.send('This is the root page')
})

app.get('/about', (req, res) =&amp;gt; {
     res.send('This is the about page'
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And so on. Clearly we see that this is more fun than using a regular switch statement or if and else block.&lt;/p&gt;

&lt;p&gt;Learn some Node my friends. If you aren't already.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Hacker Rank: Compare the Triplets</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Mon, 02 Nov 2020 04:59:22 +0000</pubDate>
      <link>https://dev.to/greedybrain/hacker-rank-compare-the-triplets-1k5h</link>
      <guid>https://dev.to/greedybrain/hacker-rank-compare-the-triplets-1k5h</guid>
      <description>&lt;p&gt;Hacker Rank Challenge - Compare the Triplets &lt;/p&gt;

&lt;p&gt;Problem:&lt;br&gt;
Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a scale from 1 to 100 for three categories: problem clarity, originality, and difficulty.&lt;/p&gt;

&lt;p&gt;The task is to find their comparison points by comparing a[0] with b[0], a[1] with b[1], and a[2] with b[2].&lt;br&gt;
If a[i] &amp;gt; b[i], then Alice is awarded 1 point.&lt;br&gt;
If a[i] &amp;lt; b[i], then Bob is awarded 1 point.&lt;br&gt;
If a[i] = b[i], then neither person receives a point.&lt;/p&gt;

&lt;p&gt;My Solution&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function compareTriplets(a, b) {
    const scoreBoard = [0, 0]
    let i = 0
    while (i &amp;lt; a.length) {
        if (a[i] &amp;gt; b[i]) {
            scoreBoard[0] += 1
        } else if (a[i] &amp;lt; b[i]) {
            scoreBoard[1] += 1
        }
        i++
    }
    return scoreBoard
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;I created a scoreBoard and set it equal to [0, 0], each element representing both Alice’s and Bob’s points initially. &lt;/li&gt;
&lt;li&gt;I created a counter and while loop that uses that counter. &lt;/li&gt;
&lt;li&gt;I created an if else if conditional. &lt;/li&gt;
&lt;li&gt;If a[i] Alice’s criteria score is greater than b[i] Bob’s criteria score, then we increment Alice’s final score by 1 which is scoreBoard[0], otherwise if Bobs criteria score is greater than Alice’s then we increment Bob’s final score by 1.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Leetcode: First Unique Char</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Sun, 25 Oct 2020 22:28:10 +0000</pubDate>
      <link>https://dev.to/greedybrain/leetcode-first-unique-char-p11</link>
      <guid>https://dev.to/greedybrain/leetcode-first-unique-char-p11</guid>
      <description>&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;Today I will be solving the First Uniq Char leetcode challenge. The instructions are as follows. &lt;/p&gt;

&lt;p&gt;Given a string, find the first non-repeating character in it and return its index. If it doesn't exist, return -1.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const firstUniqChar = s =&amp;gt; {
    // code goes here
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 1
&lt;/h2&gt;

&lt;p&gt;I started off with a for loop to loop through str.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const firstUniqChar = str =&amp;gt; {
     //
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2
&lt;/h2&gt;

&lt;p&gt;For each character in the string I get the index of it by using the method&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;str.indexOf(i =&amp;gt; current index)&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
. Obviously on the first go round it will be the 0th index. &lt;/p&gt;
&lt;h2&gt;
  
  
  Step 3
&lt;/h2&gt;

&lt;p&gt;I created a if block to check if the letter at index of i has a second appearance within the string by using str.lastIndexOf(i =&amp;gt; current index). Within that if conditional&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;if str.indexOf(i) is === to str.lastIndexOf(i)&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
. There might be a chance that there are 4 occurrences of that letter and lastIndexOf doesn't count occurrences. But, it is good enough to find out if at least there is a repeat within the string. &lt;/p&gt;

&lt;p&gt;So going back to the conditional,&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;str.indexOf(i) is === to str.lastIndexOf(i)&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
. If both str.indexOf(i) and str.lastIndexOf(i) are the same indices then we know that, that letter isn't a repeat letter and then we'll return it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(s.indexOf(s.charAt(i)) === s.lastIndexOf(s.charAt(i))){ 
     return i 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the event that there isn't a uniq char then we will just return -1&lt;/p&gt;

&lt;h2&gt;
  
  
  All Together
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const firstUniqChar = s =&amp;gt; {
    for(let i = 0; i &amp;lt; s.length; i++){
        if(s.indexOf(s.charAt(i)) === s.lastIndexOf(s.charAt(i))){ 
             return i 
        }
    }
    return -1
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Leetcode: FizzBuzz</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Mon, 19 Oct 2020 00:17:47 +0000</pubDate>
      <link>https://dev.to/greedybrain/leetcode-fizzbuzz-343i</link>
      <guid>https://dev.to/greedybrain/leetcode-fizzbuzz-343i</guid>
      <description>&lt;p&gt;Today, I will be solving the famous FizzBuzz code challenge on Leetcode. The instructions are as follows.&lt;/p&gt;

&lt;h1&gt;
  
  
  Instructions
&lt;/h1&gt;

&lt;p&gt;For numbers with multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and five output “FizzBuzz”. The twist is, they want you to return the string representation of each output stored in an array.&lt;/p&gt;

&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fizzBuzz = n =&amp;gt; {
    // Code goes here
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Let's play
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Step 1:
&lt;/h3&gt;

&lt;p&gt;I created 2 variables. One to handle a counter in a while loop, and one to store fizz buzz values as strings.&lt;/p&gt;

&lt;p&gt;let count = 1 //Starting at 1 because we only want to check from number 1 to n&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let results = []
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2:
&lt;/h3&gt;

&lt;p&gt;Start the while loop&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;while(count &amp;lt;= n) {
        if(count % 3 === 0 &amp;amp;&amp;amp; count % 5 === 0) {
            results.push("FizzBuzz")
        } else if(count % 3 === 0) {
            results.push("Fizz")
        } else if(count % 5 === 0) {
            results.push("Buzz")
        } else {
            results.push(count.toString())
        }
        count++
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this while loop a few things are happening. We set a condition in the while loop to do what ever it is in the while loop block as long as the current count is less than n (n = any number). &lt;/p&gt;

&lt;p&gt;Then we setup our if else block. The first one is checking to see if count divided by both 3 and 5 is equal to 0. We should do this first to avoid having only Fizz or only Buzz print out when it see's that a count is divisible by ONLY that number. So remember, it should be FizzBuzz when count is divisible by both 3 and 5. If it is we push the string "FizzBuzz" into the results array.&lt;/p&gt;

&lt;p&gt;In the else if's we are checking if count is divisible only by 3, and then only by 5. In that case either "Fizz" or "Buzz" will be appended to the array.&lt;/p&gt;

&lt;p&gt;In the event that count isn't divisible by either 3 or 5 we'll stringify the current count and then append it to the array. For example =&amp;gt; 1. 1 is not divisible by 3 or 5 so we'll just push 1 as a string ( "1" ).&lt;/p&gt;

&lt;p&gt;Finally we return the results array. So after all is good we have...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fizzBuzz = n =&amp;gt; {
    let count = 1
    let results = []
    while(count &amp;lt;= n) {
        if(count % 3 === 0 &amp;amp;&amp;amp; count % 5 === 0) {
            results.push("FizzBuzz")
        } else if(count % 3 === 0) {
            results.push("Fizz")
        } else if(count % 5 === 0) {
            results.push("Buzz")
        } else {
            results.push(count.toString())
        }
        count++
    }
    return results
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Leetcode: Reverse Integer</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Sun, 11 Oct 2020 23:24:20 +0000</pubDate>
      <link>https://dev.to/greedybrain/leetcode-reverse-integer-4n58</link>
      <guid>https://dev.to/greedybrain/leetcode-reverse-integer-4n58</guid>
      <description>&lt;p&gt;Today I will be walking through the Reverse Integer Leetcode coding challenge.&lt;/p&gt;

&lt;h1&gt;
  
  
  Instructions
&lt;/h1&gt;

&lt;p&gt;Given a 32-bit signed integer, reverse digits of an integer.&lt;/p&gt;

&lt;p&gt;Note:&lt;br&gt;
Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231,  231 − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows.&lt;/p&gt;
&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const reverseInteger = num =&amp;gt; {
     // CODE GOES HERE
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Example 1
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: x = -4253
Output: -3524
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Example 2
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: x = 721
Output: 127
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h1&gt;
  
  
  Let's Play
&lt;/h1&gt;

&lt;p&gt;Step 1&lt;/p&gt;

&lt;p&gt;There were 2 exponent expressions that I evaluated first. 1 - (-2 ^ 31) and 2 - (2 ^ 31 - 1). I used the Math module to handle those exponent expressions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let startPoint = Math.pow(-2, 31)
let endPoint = (Math.pow(-2, 31) - 1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2&lt;/p&gt;

&lt;p&gt;I converted the passed in number into a sting using the toString() method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numToString = num.toString()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3&lt;/p&gt;

&lt;p&gt;Split the string, reversed it, and then joined it back together.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numSplitReversedJoined = numToString.split('').reverse().join('') 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 4&lt;/p&gt;

&lt;p&gt;Check if there is a hyphen at the beginning of the string, split the string, then use the shift method to remove and return the hyphen. Otherwise, we do nothing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let hyphen = numToString.includes('-') ? numToString.split('').shift() : null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 5&lt;/p&gt;

&lt;p&gt;If there is a hyphen, concatenate it to the numToString then parsing it back into a number&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numValueWithHyphen = parseInt(hyphen + (numSplitReversedJoined))
let numValueWOHyphen = parseInt(numSplitReversedJoined)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 6&lt;/p&gt;

&lt;p&gt;Return either the number if it has a hyphen, or the number without it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numValue = hyphen !== null ? numValueWithHyphen : numValueWOHyphen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 7&lt;/p&gt;

&lt;p&gt;Lastly, check if the number reversed is within range of the startPoint and endPoint that we defined in the beginning. If it's out of range I return 0, otherwise I return the number.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (numValue &amp;lt;= startPoint || numValue &amp;gt;= endPoint || numValue === 0) {
     return 0
}
return xValue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  All together
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const reverseInteger = num =&amp;gt; {
     let startPoint = Math.pow(-2, 31)
     let endPoint = (Math.pow(-2, 31) - 1)

     let numToString = num.toString()
     let numSplitReversedJoined = numToString.split('').reverse().join('') 

     let hyphen = numToString.includes('-') ? numToString.split('').shift() : null

     let numValueWithHyphen = parseInt(hyphen + (numSplitReversedJoined))
     let numValueWOHyphen = parseInt(numSplitReversedJoined)

     let numValue = hyphen !== null ? numValueWithHyphen : numValueWOHyphen
     if (numValue &amp;lt;= startPoint || numValue &amp;gt;= endPoint || numValue === 0) {
          return 0
     }
     return numValue
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And, there we have it.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>IsPalindrome Code Challenge</title>
      <dc:creator>Naya Willis</dc:creator>
      <pubDate>Mon, 05 Oct 2020 03:11:32 +0000</pubDate>
      <link>https://dev.to/greedybrain/ispalindrome-code-challenge-3pdm</link>
      <guid>https://dev.to/greedybrain/ispalindrome-code-challenge-3pdm</guid>
      <description>&lt;p&gt;Hello, everyone. Today I will be walking you through the isPalindrome problem on LeetCode. Your approach may be different, or perhaps even better but don't rub it in, just enjoy. Ok, so let's do this.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Task
&lt;/h1&gt;



&lt;p&gt;&lt;code&gt;Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const isPalindrome = s =&amp;gt; {
    // CODE GOES IN HERE
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  My Approach
&lt;/h1&gt;

&lt;p&gt;I started by first converting the passed in string to lowercase letters to avoid any case sensitivity issues.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;s = s.toLowerCase()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, I created a string containing letters a-z and number 0-9 to rule out any special characters i.e !?:.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let alphas = "abcdefghijklmnopqrstuvwxyz0123456789"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, I created a variable called caughtAlphas which I'm going to use to push all of the alphas into that array, meanwhile ignoring special characters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let caughtAlphas = []
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I declared 2 let variables, one that I'll use to convert the caughtAlphas array to a string, and the second one will give me a boolean value based on whether or not the string is a palindrome&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let caughtAlphasToString;
let checkIfPalindrome;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To handle the checking of each character in the string, I used a for loop like so...&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 = 0; i &amp;lt; s.length; i++) {
     if(alphas.includes(s[i])) { //alphas contain current char?
          caughtAlphas.push(s[i]) //great, so push it in caught alphas
     }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, to convert the caughtAlphas array into a string...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;caughtAlphasToString = caughtAlphas.join('')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, checking it against itself reversed then assign it to the checkIfPalindrome variable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;checkIfPalindrome = (caughtAlphasToString === caughtAlphasToString.split('').reverse().join(''))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, returning it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return checkIfPalindrome
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, now if we put it all together we have...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const isPalindrome = s =&amp;gt; {
    s = s.toLowerCase()
    let alphas = "abcdefghijklmnopqrstuvwxyz0123456789"
    let caughtAlphas = []
    let caughtAlphasToString;
    let checkIfPalindrome;

    for (let i = 0; i &amp;lt; s.length; i++) {
        if(alphas.includes(s[i])) {
            caughtAlphas.push(s[i])
        }
    }

    caughtAlphasToString = caughtAlphas.join('')
    checkIfPalindrome = (caughtAlphasToString === caughtAlphasToString.split('').reverse().join(''))
    return checkIfPalindrome
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This challenge was fun. Hope you enjoyed the breakdown. Post your solutions in the comment section. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>100daysofcode</category>
    </item>
  </channel>
</rss>
