<?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: Lori "Lei" Boyd</title>
    <description>The latest articles on DEV Community by Lori "Lei" Boyd (@loripb).</description>
    <link>https://dev.to/loripb</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%2F328552%2Fc6078463-aa3d-4be0-ae33-21724f258dd1.jpeg</url>
      <title>DEV Community: Lori "Lei" Boyd</title>
      <link>https://dev.to/loripb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/loripb"/>
    <language>en</language>
    <item>
      <title>Rest Parameters and Spread Operators in Javascript</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Mon, 06 Jul 2020 02:28:36 +0000</pubDate>
      <link>https://dev.to/loripb/rest-parameters-and-spread-operators-in-javascript-4o0m</link>
      <guid>https://dev.to/loripb/rest-parameters-and-spread-operators-in-javascript-4o0m</guid>
      <description>&lt;p&gt;Javascript has a functionality where depending on where it's used, &lt;code&gt;...&lt;/code&gt; can either be a &lt;code&gt;rest parameter&lt;/code&gt; or a &lt;code&gt;spread operator&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Spread Operators
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;spread operators&lt;/code&gt; allow an iterable object like an &lt;code&gt;array&lt;/code&gt; to be expanded, unpacking each element from the &lt;code&gt;array&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;fourToSix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;four&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;five&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;six&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;one&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;two&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;three&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;fourToSix&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;one&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;two&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;three&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;four&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;five&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;six&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Rest Parameters
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;rest parameter&lt;/code&gt; will bundle up all remaining elements in a parameter into an &lt;code&gt;array&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;greetings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;friend&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;everyoneElse&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Hello, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;friend&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;everyoneElse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Nice to meet you, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!`&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;greetings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Lei&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Cierra&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Aiden&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Pierre&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Miranda&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; Hello, Lei!
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; Nice to meet you, Cierra!
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; Nice to meet you, Aiden!
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; Nice to meet you, Pierre!
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; Nice to meet you, Miranda!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
    </item>
    <item>
      <title>My Minimal Linux Setup 2020</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Tue, 30 Jun 2020 07:44:20 +0000</pubDate>
      <link>https://dev.to/loripb/my-minimal-linux-setup-2020-2m0m</link>
      <guid>https://dev.to/loripb/my-minimal-linux-setup-2020-2m0m</guid>
      <description>&lt;p&gt;My preferred Os of choice is Linux, and with that, I often spend quite a lot of time setting up my environment. After 'distro' hopping, &lt;a href="https://pop.system76.com/"&gt;PopOS&lt;/a&gt; is my distro of choice. My bare minimum includes: &lt;br&gt;
. Git&lt;br&gt;
. Node &amp;amp; npm &lt;br&gt;
. Ruby &amp;amp; rails via RVM(version manager for all things ruby)&lt;br&gt;
. SQLite&lt;br&gt;
. Atom text editor&lt;/p&gt;
&lt;h2&gt;
  
  
  Installations
&lt;/h2&gt;

&lt;p&gt;This installation guide assumes you are using a Debian/Ubuntu-based Linux distro.&lt;/p&gt;

&lt;p&gt;before you start it's helpful to update your package information and do any necessary upgrades.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Git
&lt;/h4&gt;

&lt;p&gt;Installing Git is as simple as running the install command and setting up your global user.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;apt-get install git&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;To configure your profile run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s2"&gt;"John Doe"&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s2"&gt;"johndoe@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next, you can generate a new SSH key for authentication with this &lt;a href="https://help.github.com/en/enterprise/2.15/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent"&gt;guide&lt;/a&gt;.&lt;br&gt;
You can follow this &lt;a href="https://help.github.com/en/enterprise/2.15/user/articles/adding-a-new-ssh-key-to-your-github-account"&gt;guide&lt;/a&gt; to add the new SSH key to your account.&lt;/p&gt;
&lt;h4&gt;
  
  
  Node &amp;amp; NPM
&lt;/h4&gt;

&lt;p&gt;To keep this setup minimal, I'll be installing the distro-stable versions for Ubuntu. Run&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;$ sudo apt install nodejs&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 and&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;$ sudo apt install npm&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
.&lt;/p&gt;
&lt;h4&gt;
  
  
  RVM (Ruby &amp;amp; Rails)
&lt;/h4&gt;

&lt;p&gt;RVM's official installation guide is the best source to use when installing RVM. It even offers a few diffent install options. &lt;br&gt;
After installing GPG keys with this:&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;You can choose any of the basic installs. I go for the "Poor man's Rails installer"&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;\curl -sSL https://get.rvm.io | bash -s stable --rails&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;\curl -sSL https://get.rvm.io | bash -s stable --ruby&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;This installs the latest stable version of Ruby and Rails.&lt;br&gt;
After everything is finished installing, restart your terminal.&lt;/p&gt;

&lt;h4&gt;
  
  
  Sqlite
&lt;/h4&gt;

&lt;p&gt;Check to see if you currently have Sqlite installed with &lt;code&gt;$ sqlite3 ---version&lt;/code&gt;&lt;br&gt;
If you don't get a version number, install it with &lt;code&gt;$ sudo apt install sqlite3&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Text Editor
&lt;/h4&gt;

&lt;p&gt;The default text editors don't usually do it for me so I'll end up installing &lt;a href="https://atom.io/"&gt;Atom&lt;/a&gt; instead. &lt;/p&gt;

</description>
      <category>linux</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Infinite Loops Inside useEffect</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Sat, 20 Jun 2020 16:47:00 +0000</pubDate>
      <link>https://dev.to/loripb/infinite-loops-inside-useeffect-4hb9</link>
      <guid>https://dev.to/loripb/infinite-loops-inside-useeffect-4hb9</guid>
      <description>&lt;p&gt;Recently, I came across a bug when using the &lt;code&gt;useEffect&lt;/code&gt; hook. I intended to utilize the functionality of the lifecycle method &lt;code&gt;componentDidMount&lt;/code&gt;, but &lt;code&gt;useEffect&lt;/code&gt; doesn't work precisely the same way.  &lt;/p&gt;

&lt;h4&gt;
  
  
  The Bug
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:3000/categories&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;categoriesArray&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
         &lt;span class="na"&gt;categories&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;categoriesArray&lt;/span&gt;
       &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Whenever we ran the application, the fetch was successful but continued to fetch infinitely.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Solution
&lt;/h4&gt;

&lt;p&gt;After a few minutes of google searching the problem, we came across a StackOverflow post that gave us a simple solution.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:3000/categories&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;categoriesArray&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
         &lt;span class="na"&gt;categories&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;categoriesArray&lt;/span&gt;
       &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;},[])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;A user suggested that adding empty brackets as a second argument will fix the infinite fetching.&lt;/p&gt;

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

&lt;h4&gt;
  
  
  A Bit About useEffect
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;useEffect&lt;/code&gt; lets you perform side effects in function components. Data fetching, setting up a subscription, and manually changing the DOM in React components are all examples of side effects. To put it simply, &lt;code&gt;useEffect&lt;/code&gt; is like a combination of &lt;code&gt;componentDidMount&lt;/code&gt;, &lt;code&gt;componentWillUnmount&lt;/code&gt;, and &lt;code&gt;componentDidUpdate&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So what's happening when we run our broken code? When the component first renders and mounts, the fetch is called and then sets the state for categories that cause the component to render again. This blog post that &lt;a href="https://medium.com/@andrewmyint/infinite-loop-inside-useeffect-react-hooks-6748de62871"&gt;Andrew Myint&lt;/a&gt; wrote explains this pretty well. &lt;/p&gt;

&lt;p&gt;The second argument will tell &lt;code&gt;useEffect&lt;/code&gt; not to render unless the said variable changed between renders. Andrew Myint's post uses a variable inside brackets as the second argument. I think the empty brackets also work because there is no trigger to run &lt;code&gt;useEffect&lt;/code&gt; again, it'll run only once, after the component mounts.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Setting Up Git Organizations</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Sun, 14 Jun 2020 07:08:53 +0000</pubDate>
      <link>https://dev.to/loripb/setting-up-git-organizations-2la4</link>
      <guid>https://dev.to/loripb/setting-up-git-organizations-2la4</guid>
      <description>&lt;p&gt;This week I learned about a feature that GitHub offers that I completely ignored. Usually, when I collaborate with other devs on a project, I'll have an app like Trello to keep track of workflow. Github Projects are a great way to manage workflow and delegate tasks while keeping all your tools in one place.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Set-Up
&lt;/h2&gt;

&lt;p&gt;Creating a new project is as easy as clicking on "New Project" from the &lt;code&gt;+&lt;/code&gt; dropdown menu. You'll be greeted with basic input fields as well as a template menu. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;None - Start from scratch&lt;/li&gt;
&lt;li&gt;Basic Kanban - Starts with a column for To-Do, In Progress, and Done&lt;/li&gt;
&lt;li&gt;Automated kanban - Same as Kanban and includes built-in triggers to move pull requests and issues across the columns&lt;/li&gt;
&lt;li&gt;But Triage - Prioritizes bugs with To-Do, High Priority,  Low Priority, and Closed columns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I haven't used the pull request or issue feature, so basic kanban is my template of choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Workflow
&lt;/h2&gt;

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

&lt;p&gt;In addition to creating cards and moving them to the appropriate location, every card can be converted into an issue. Issues are useful because you can delegate issues to your team like so. &lt;/p&gt;

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

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There are so many cool technologies and tools to discover. Sometimes learning the tech and tools that you already have on a deeper level can boost your productivity and simplify your workflow.&lt;/p&gt;

</description>
      <category>git</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Navigating in React Native</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Sat, 06 Jun 2020 23:56:24 +0000</pubDate>
      <link>https://dev.to/loripb/navigating-in-react-native-542n</link>
      <guid>https://dev.to/loripb/navigating-in-react-native-542n</guid>
      <description>&lt;p&gt;The next project I will be working on will be to convert the Subway Times web app into a React Native application. Besides the initial set up, the first thing I want to do is work on navigation. &lt;/p&gt;

&lt;h4&gt;
  
  
  Why We Need Navigation
&lt;/h4&gt;

&lt;p&gt;Navigating through a web page is done by interacting with the browser or through links. Mobile apps typically have a bar on the top or bottom of the screen that renders a screen depending on which button is pressed. React handles this with navigator components. A few of the most used navigation libraries are React Navigation and React Native Navigation.&lt;/p&gt;

&lt;p&gt;For the Subway Times project, I will be using React Navigation. The app will be structured like so.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rDho07MU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3ty666veqpm3ao6g5j28.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rDho07MU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3ty666veqpm3ao6g5j28.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;app.js&lt;/code&gt; file will contain a drawer navigator that will list buttons that render different screens, search, lines, and Starred Stops. Each screen will be the base of a stack.  &lt;/p&gt;

&lt;h4&gt;
  
  
  Navigation Stack
&lt;/h4&gt;

&lt;p&gt;An example of what a navigation stack does is when you are on an app like twitter and click on a tweet to see more information. A new screen renders, and a back arrow is displayed. The way this works is, as you visit screens, they get stacked on top of each other. The screen on top is what gets rendered. The back arrow pops whatever screen is on top off of the stack, and the previous screen will be right where you left off. Think of it like the screens are on a skewer.&lt;/p&gt;

&lt;h6&gt;
  
  
  Documentation
&lt;/h6&gt;

&lt;p&gt;. &lt;em&gt;&lt;a href="https://reactnavigation.org/docs/hello-react-navigation"&gt;React Navigation&lt;/a&gt;&lt;/em&gt;&lt;br&gt;
. &lt;em&gt;&lt;a href="https://reactnavigation.org/docs/drawer-based-navigation/"&gt;Drawer Navigation&lt;/a&gt;&lt;/em&gt;&lt;br&gt;
. &lt;em&gt;&lt;a href="https://reactnavigation.org/docs/stack-navigator/"&gt;Stack Navigation&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Fetching With Async/Await</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Sat, 30 May 2020 19:42:28 +0000</pubDate>
      <link>https://dev.to/loripb/fetching-with-async-await-34kl</link>
      <guid>https://dev.to/loripb/fetching-with-async-await-34kl</guid>
      <description>&lt;p&gt;I was going through a refactoring phase in my last project and decided to tidy up my fetch requests. I have multiple functions that not only look similar, but they all are about 49 lines long.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// fetches arrivalTimes&lt;/span&gt;
    &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://subway-times-api.herokuapp.com/stops/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// fetch here&lt;/span&gt;
      &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://subway-times-api.herokuapp.com/lines/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// diggs through feed to find the arrays with the arrival times&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;feed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;feed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;trip_update&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;includesStopTimeUpdate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;feed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;trip_update&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;stop_time_update&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;stopTimeUpdateArrays&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;includesStopTimeUpdate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;trip_update&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stop_time_update&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;stopTimeArrays&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;stopTimeUpdateArrays&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj2&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;obj2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;trainObjs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

        &lt;span class="c1"&gt;// adds the objects with train arrival times and stop ids to "state"&lt;/span&gt;
        &lt;span class="nx"&gt;stopTimeArrays&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj2&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;trainObjs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj2&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;

        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arrivalTimes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;trainObjs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stop_id&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stop_id&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;direction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;direction&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;trainArrivalObjs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arrivalTimes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;trainTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nb"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;arrival&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;timeNow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

          &lt;span class="c1"&gt;// setting hours and mins&lt;/span&gt;
          &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;trainHour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;trainTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getHours&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;trainTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getHours&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;trainTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getHours&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
          &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;trainMin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;trainTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getMinutes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
          &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;currentHour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;timeNow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getHours&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;timeNow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getHours&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;timeNow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getHours&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
          &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;currentMin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;timeNow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getMinutes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

          &lt;span class="c1"&gt;// if trainHour is &amp;gt; current hour add 60 mins to trainMin&lt;/span&gt;
          &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trainHour&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;currentHour&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;trainMin&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;

          &lt;span class="c1"&gt;// take hour and min of train time and subtract each from the current time, if result is negative return 0&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;trainMin&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;currentMin&lt;/span&gt;
        &lt;span class="p"&gt;})&lt;/span&gt;

        &lt;span class="c1"&gt;// if train is due or has past remove&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arrivals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;trainArrivalObjs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;time&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
          &lt;span class="na"&gt;renderStopInfo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;renderStopInfo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;arrivals&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;arrivals&lt;/span&gt;
        &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This function throws away the whole DRY rule, and it's time to fix that. I've decided to throw all the logic here into my backend, so when I fetch for a stop, I get back all uptown and downtown arrival times converted to hours and minutes. To further refactor, I've decided to use async and await to handle my fetch. &lt;/p&gt;

&lt;h2&gt;
  
  
  Async
&lt;/h2&gt;

&lt;p&gt;Async is a keyword before a function, and when called, the function returns a promise.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;resolved&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Await
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await"&gt;MDN&lt;/a&gt; docs state "This [await function] can be put in front of any async promise-based function to pause your code on that line until the promise fulfills, then return the resulting value. In the meantime, other code that may be waiting for a chance to execute gets to do so."&lt;/p&gt;

&lt;p&gt;So instead of writing my event handlers like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;API&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;responce&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;apiObject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I can write the same thing with async/await&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;fetchFromApi&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;apiObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;apiobject&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;fetchFromApi&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;API&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;apiObject&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;apiObject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;responseObject&lt;/span&gt; 
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In my opinion, the later is a lot easier to read. Also, because It's reusable, I can just call on &lt;code&gt;fetchFromApi&lt;/code&gt; with any URL.   &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What I Learned By Creating My First React Native App</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Fri, 22 May 2020 21:46:54 +0000</pubDate>
      <link>https://dev.to/loripb/what-i-learned-by-creating-my-first-react-native-app-2o5f</link>
      <guid>https://dev.to/loripb/what-i-learned-by-creating-my-first-react-native-app-2o5f</guid>
      <description>&lt;p&gt;In my last post, I talked about how I began learning the Swift programming language. Since then, I've decided to hold off on that and learn a React Native instead. React is a framework that gives you the ability to write code for multiple platforms. Already knowing React makes React Native a no-brainer addition to my programming tool belt.&lt;/p&gt;

&lt;p&gt;Diving in, I decided along the programming book route and purchased the book &lt;em&gt;Practical React Native: Build Two Full Projects and One Full Game using React Native&lt;/em&gt; by Frank Zammetti. I got familiar with the basics of React Native reading through the first couple of chapters, but because technology evolves so rapidly and React Native is no exception, the examples in the book are outdated. I found myself unable to run any of the exercises. So I made my own! &lt;/p&gt;

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

&lt;p&gt;I decided to make a tip calculator because I've already built one in Ruby. I started with making a Rails API that will handle all of the logic, so I can focus on the frontend and get used to fetching in React Native (this was a good idea, more on that later). &lt;/p&gt;

&lt;p&gt;Because Frank Zammetti used Expo in his book, I decided to do the same. Expo is a framework and a platform for universal React applications. Expo is built on top of React Native, so consequently, it adds another layer of complexity. I like to think of it as the Ruby on rails of React Native. Convention over configuration. Expo has several templates for you to choose from. I chose the option with tabs to gain exposure to navigation.&lt;/p&gt;

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

&lt;p&gt;Expo is quick and easy to set up. I found that getting my development code up and running on my devices was super easy. But that comes with some limitations. I experienced one while trying to debug my code. I wanted to post information to my database but kept getting an error. It turns out iOS and Android only allow HTTPS requests by default. Because I was running on a development server, the network request had to be HTTP. I found a workaround on StackOverflow, but it required access to an &lt;code&gt;info.plist&lt;/code&gt; file, which Expo does not give you access. I ended up deploying my API on Heroku to use a secure URL. There are other limitations worth noting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not all iOS and Andriod APIs are available. If you want to include things like Bluetooth or In-App Purchases &lt;/li&gt;
&lt;li&gt;Larger app size&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Full list of limitations &lt;a href="https://docs.expo.io/introduction/why-not-expo/?redirected"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For this application, Expo did the job wonderfully. Depending on the project, I might have to use &lt;code&gt;create-react-app&lt;/code&gt; instead.&lt;/p&gt;

&lt;p&gt;Here's a gif of the Tip Calculator.&lt;/p&gt;

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

&lt;p&gt;One thing that stuck out to me was that the &lt;code&gt;&amp;lt;ScrollView&amp;gt;&lt;/code&gt; component only works on iOS. When I boot the app on an Andriod device, any content that overflows is hidden and unreachable. That influenced most of the styling. Originally, You couldn't even see the 'Calculate Your Tip' button on the Android. The &lt;code&gt;&amp;lt;FlatList&amp;gt;&lt;/code&gt; component is a better option when it comes to scrolling. Not only does it only load components once the element is scrolled into view, but both iOS and Android also support it.&lt;/p&gt;

&lt;p&gt;In summary, I've learned a lot about React Native just by building this small app. There are some topics I didn't get a chance to deeper into, like debugging with Expo and the similarities and differences of React Native and React, but I'll save those for future posts. Thanks for reading!&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>codenewbie</category>
      <category>beginners</category>
      <category>ios</category>
    </item>
    <item>
      <title>Tuples in Swift</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Sat, 16 May 2020 15:20:05 +0000</pubDate>
      <link>https://dev.to/loripb/tuples-in-swift-1cm3</link>
      <guid>https://dev.to/loripb/tuples-in-swift-1cm3</guid>
      <description>&lt;p&gt;I recently started to dive into the world of IOS development. As I was taking a tour on the &lt;a href="https://docs.swift.org/swift-book/GuidedTour/GuidedTour.html"&gt;documentation&lt;/a&gt; website, I came across a data type I've never heard before. "What's a tuple???", I asked myself. &lt;/p&gt;

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

&lt;p&gt;For context, I was reading a section on functions to get familiar with the syntax. The following code is a function that calculates the minimum, maximum, and sum of a given array of integers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calculateStatistics&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;min&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;max&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;min&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;max&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;max&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;max&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;min&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;min&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nf"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;statistics&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;calculateStatistics&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;statistics&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"the minimun"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// Prints "3 the minimum"&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;statistics&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"the sum"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// Prints "120 the sum"&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;statistics&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"the max"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// Prints "100 the max"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;A Tuple is defined by Swift's documentation as &lt;strong&gt;a comma-separated list of types, enclosed in parentheses&lt;/strong&gt; and is commonly used to return multiple values. The above code uses dot notation to call the variables placed in the tuple and can be called by name or index. To me, this resembles a mashup of a Javascript &lt;code&gt;Object&lt;/code&gt; and an array.&lt;/p&gt;

&lt;p&gt;You can also name the elements inside of a tuple like so: &lt;code&gt;var aTuple = (age: 24, name: "Lei")&lt;/code&gt; and reference them with &lt;code&gt;aTuple.age&lt;/code&gt; which will return 24. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z8grmzGX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6ljooeni39rgxhad61ns.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z8grmzGX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6ljooeni39rgxhad61ns.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A tuple can contain zero or more types. &lt;a href="https://medium.com/swift-programming/swift-tuple-328aecff50e7"&gt;Andyy Hope&lt;/a&gt; states an interesting fact on tuples over on his blog that &lt;code&gt;void&lt;/code&gt; is just a &lt;code&gt;typealias&lt;/code&gt; for an empty tuple. &lt;/p&gt;

&lt;p&gt;As I'm journeying through the language of Swift, I'm sure I'll many more gems that make Swift uniquely great.&lt;/p&gt;

</description>
      <category>swift</category>
      <category>ios</category>
      <category>programming</category>
    </item>
    <item>
      <title>How To deploy Your Web App To Heroku</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Thu, 02 Apr 2020 22:55:15 +0000</pubDate>
      <link>https://dev.to/loripb/how-to-deploy-your-web-app-to-heroku-5cef</link>
      <guid>https://dev.to/loripb/how-to-deploy-your-web-app-to-heroku-5cef</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FLuD3VQ8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1jgafild6x4fht070mr2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FLuD3VQ8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1jgafild6x4fht070mr2.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As my time as a bootcamp student is coming to an end, I've built a couple of web apps that I'd like to share with the world. So I'm going to show you how you can do just that. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://heroku.com/"&gt;Heroku&lt;/a&gt; lets you host 5 apps for free so choose them wisely. If you're like me and you haven't make separate repos for your api and client, here's a &lt;a href="https://medium.com/@nothingisfunny/deploying-rails-api-and-react-app-to-heroku-from-a-single-github-repo-7d8597abc55a"&gt;blog&lt;/a&gt; to help you out. &lt;/p&gt;

&lt;p&gt;Start by creating a new app on the Heroku website.&lt;/p&gt;

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

&lt;p&gt;When you're done, you'll be redirected to the deploy tab. There, you'll be greeted with information about pipelines, and more importantly, deployment methods. You have the option to use Heroku Git, GitHub and the Container Registry. I'll be using Heroku Git.  &lt;/p&gt;

&lt;p&gt;Download and install &lt;a href="https://devcenter.heroku.com/articles/heroku-command-line"&gt;Heroku CLI&lt;/a&gt; and run &lt;code&gt;heroku login&lt;/code&gt; in your terminal.&lt;/p&gt;

&lt;p&gt;Next, clone your new repo in your app's root directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;heroku git:clone &lt;span class="nt"&gt;-a&lt;/span&gt; &amp;lt;heroku-app-name&amp;gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &amp;lt;heroku-app-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Lastly, commit any changes you make to deploy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s2"&gt;"make it better"&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git push heroku master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you're deploying a rails API you will need to migrate and seed if needed. You can do this by using Heroku's console. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Zbj2Tm8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n21w9zh1m3udxl9i4zlp.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Zbj2Tm8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n21w9zh1m3udxl9i4zlp.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Lifting State With React</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Wed, 11 Mar 2020 19:48:53 +0000</pubDate>
      <link>https://dev.to/loripb/lifting-state-with-react-989</link>
      <guid>https://dev.to/loripb/lifting-state-with-react-989</guid>
      <description>&lt;p&gt;Lifting the state allows your sibling components to share a single source of truth. In a hierarchy tree, components can only inherit data from their parent components. &lt;/p&gt;

&lt;p&gt;Lets walk through this test application.&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%2Fjf4zr1lhtaiing8iopzz.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%2Fi%2Fjf4zr1lhtaiing8iopzz.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our hierarchy looks 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%2Fnbc9rhjccj9dwxm15jtl.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%2Fnbc9rhjccj9dwxm15jtl.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have a parent component with two children components. Our goal is to make our &lt;code&gt;Child&lt;/code&gt; component be a button that changes the color of &lt;code&gt;Child2&lt;/code&gt;'s text.&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%2Fn6lnhrwvdiq2zzb6nqed.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%2Fn6lnhrwvdiq2zzb6nqed.png" alt="Alt Text"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In our &lt;code&gt;Parent&lt;/code&gt; component, we initialize the state with a key of &lt;code&gt;color&lt;/code&gt; and value of &lt;code&gt;'blue'&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Because we want to change the sate we have a function in the &lt;code&gt;Parent&lt;/code&gt; component that does just that. It's a conditional that checks if the &lt;code&gt;this.state.color&lt;/code&gt; is equal to &lt;code&gt;'blue'&lt;/code&gt;. If that is true, we set the sate to &lt;code&gt;'red'&lt;/code&gt; and if false, we set the state to back to &lt;code&gt;'blue'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, we have a render function that returns both &lt;code&gt;Child&lt;/code&gt; and &lt;code&gt;Child2&lt;/code&gt;. &lt;code&gt;Child&lt;/code&gt; inherits the reference to &lt;code&gt;this.setColor&lt;/code&gt;, and &lt;code&gt;Child2&lt;/code&gt; inherits &lt;code&gt;this.state.color&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Child&lt;/code&gt; does one thing. It renders a button with an event listener. Our callback function for the click event is the function that &lt;code&gt;Child&lt;/code&gt; inherited from &lt;code&gt;Parent&lt;/code&gt;. We access this by using the properties given via &lt;code&gt;this.props.changeColor&lt;/code&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%2Foyqqx0pzgz6la628r2fu.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%2Foyqqx0pzgz6la628r2fu.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So now every time &lt;code&gt;Child&lt;/code&gt;'s button is clicked, the function in the &lt;code&gt;Parent&lt;/code&gt; component is invoked and changes the state.&lt;/p&gt;

&lt;p&gt;Since we are rendering our &lt;code&gt;Child2&lt;/code&gt; component in our &lt;code&gt;Parent&lt;/code&gt; as well, every time we change the state, &lt;code&gt;Parent&lt;/code&gt; gets re-rendered which inturn re-renders each child. &lt;/p&gt;

&lt;p&gt;This is where the magic happens.&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%2Fnw2f9xs1e20of1o1spuu.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%2Fi%2Fnw2f9xs1e20of1o1spuu.gif" alt="Alt Text"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now let's look at &lt;code&gt;Child2&lt;/code&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%2Ftbp9cnyz6yi50lesn8zf.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%2Ftbp9cnyz6yi50lesn8zf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Child2&lt;/code&gt;'s only job is to render some text. We have our &lt;code&gt;p&lt;/code&gt; tag with an inline style set to &lt;code&gt;Child2&lt;/code&gt;'s color property. When &lt;code&gt;Parent&lt;/code&gt; gets re-rendered by &lt;code&gt;setState&lt;/code&gt; &lt;code&gt;Child2&lt;/code&gt; get's re-rendered with the new state as its new prop!&lt;/p&gt;

&lt;h3&gt;
  
  
  Recap
&lt;/h3&gt;

&lt;p&gt;Every time &lt;code&gt;Child&lt;/code&gt;'s button is clicked, &lt;code&gt;Child&lt;/code&gt; invokes the instance method defined in the &lt;code&gt;Parent&lt;/code&gt;. That instance method changes the state based on its contents and triggers a re-render. &lt;code&gt;Child2&lt;/code&gt; is now re-rendered with the new state as an inherited property.&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%2Fjf4zr1lhtaiing8iopzz.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%2Fi%2Fjf4zr1lhtaiing8iopzz.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Making Games in Ruby With Gosu</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Wed, 19 Feb 2020 16:41:39 +0000</pubDate>
      <link>https://dev.to/loripb/making-games-with-gosu-3k04</link>
      <guid>https://dev.to/loripb/making-games-with-gosu-3k04</guid>
      <description>&lt;p&gt;Have you've ever wanted to make games with ruby? &lt;a href="https://www.libgosu.org/ruby.html"&gt;Gosu&lt;/a&gt; is a 2D game development library for Ruby and C++. It provides a window and main loop, 2D graphics and text (powered by OpenGL), sound, music, keyboard, mouse, and gamepad input. &lt;/p&gt;

&lt;h5&gt;
  
  
  Prerequisites &amp;amp; Installation
&lt;/h5&gt;

&lt;p&gt;I'll be showing how to install Gosu on OSX, but they also offer tutorials on setting gosu up with Windows, Linux, Raspbian.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/gosu/gosu/wiki/Getting-Started-on-OS-X"&gt;Gosu GitHub wiki&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Gosu depends on the SDL 2 library. So make sure you have Homebrew installed and run &lt;code&gt;brew install sdl2&lt;/code&gt;. When that's done, simply install the Gosu gem with &lt;code&gt;gem install gosu&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To test whether everything works as expected, you can use this one-liner, which should open a window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ruby &lt;span class="nt"&gt;-rgosu&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'w = Gosu::Window.new(200, 150); w.caption = "It works!"; w.show'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KoTkG2WU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6xguilhialfbi93q9ojj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KoTkG2WU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6xguilhialfbi93q9ojj.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or you can install and run the gosu-examples gem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;gem &lt;span class="nb"&gt;install &lt;/span&gt;gosu-examples
gosu-examples
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I recommend you should do the latter. &lt;/p&gt;

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

&lt;p&gt;This tutorial window shows you what Gosu is capable of. Even better, they have a shortcut to the source code for each example! You can view the source code by pressing &lt;code&gt;E&lt;/code&gt; And if you like they have a code-along for the &lt;a href="https://github.com/gosu/gosu/wiki/Ruby-Tutorial"&gt;&lt;code&gt;tutorial.rb&lt;/code&gt;&lt;/a&gt; game.&lt;/p&gt;

&lt;h5&gt;
  
  
  Examples
&lt;/h5&gt;

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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--33qwvqBo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jw8p0x8xtgt9c5zp60oy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--33qwvqBo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jw8p0x8xtgt9c5zp60oy.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;There's so much you can do with this lightweight gem. Here's a link to the &lt;a href="https://www.libgosu.org/cgi-bin/mwf/board_show.pl?bid=2"&gt;Gosu Showsace&lt;/a&gt; where you can download community projects or post your own!&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>cpp</category>
    </item>
    <item>
      <title>An Example of a Git Workflow</title>
      <dc:creator>Lori "Lei" Boyd</dc:creator>
      <pubDate>Mon, 03 Feb 2020 13:55:45 +0000</pubDate>
      <link>https://dev.to/loripb/an-example-of-a-git-workflow-kje</link>
      <guid>https://dev.to/loripb/an-example-of-a-git-workflow-kje</guid>
      <description>&lt;p&gt;Git is a distributed version control system for tracking changes in source code during software development. It’s a great tool to use when you're collaborating with other developers as well. But sometimes creating a workflow for your development process can be a little tricky.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0wSpikFW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/w8or2wnnbdeflh6b3254.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0wSpikFW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/w8or2wnnbdeflh6b3254.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First things first, you’ll need to set up a repository. Here’s an article from GitHub on &lt;a href="https://help.github.com/en/github/getting-started-with-github/create-a-repo"&gt;that&lt;/a&gt;. I would then add the skeleton of my project and commit the changes with &lt;code&gt;git commit -m "&amp;lt;commit message&amp;gt;"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After you have your repository set up, create a Development branch with git checkout. &lt;code&gt;git checkout -b  development&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This creates a new &lt;strong&gt;local&lt;/strong&gt; branch out of your master branch. This development branch is what you’ll be merging into until your project is in a working condition. Next, type in &lt;code&gt;git push origin development&lt;/code&gt; to push your local development repo to a remote repo with the same name. This way your development repo can also be accessed by your collaborators.&lt;/p&gt;

&lt;p&gt;If you’re collaborating on a project that isn’t yours, you’ll need to clone and fetch the repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone &amp;lt;repo link&amp;gt;
git fetch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Git fetch allows you to access any other existing branches.&lt;/p&gt;

&lt;p&gt;Now whenever you start working on a new feature, you’ll create a new branch for each one. If you’re not in the development branch switch to it now with git checkout. &lt;code&gt;git checkout development&lt;/code&gt; Then run &lt;code&gt;git checkout -b &amp;lt;feature branch name&amp;gt;&lt;/code&gt; This creates a branch from your development branch. Your feature branch is only on your local machine until you push your commits into the remote repository. Commit often, usually after each deliverable. Once your feature is tested and working you can push to the remote repository with git push. &lt;code&gt;git push origin &amp;lt;feature branch name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Uh-oh! You pushed the wrong button and your program is broken!
&lt;/h5&gt;

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

&lt;p&gt;No worries! If you’ve been committing often you’ll be able to reset to your last commit! Make sure you don’t have any modified files in your working tree that you wish to keep. You can check that with &lt;code&gt;git status&lt;/code&gt; It'll look something like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;On branch master
Your branch is up to &lt;span class="nb"&gt;date &lt;/span&gt;with &lt;span class="s1"&gt;'origin/master'&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;

Changes to be committed:
  &lt;span class="o"&gt;(&lt;/span&gt;use &lt;span class="s2"&gt;"git reset HEAD &amp;lt;file&amp;gt;..."&lt;/span&gt; to unstage&lt;span class="o"&gt;)&lt;/span&gt;

    new file:   newfile.rb

Untracked files:
  &lt;span class="o"&gt;(&lt;/span&gt;use &lt;span class="s2"&gt;"git add &amp;lt;file&amp;gt;..."&lt;/span&gt; to include &lt;span class="k"&gt;in &lt;/span&gt;what will be committed&lt;span class="o"&gt;)&lt;/span&gt;

    hhdjhd.txt

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To reset to your last commit:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;go to your repo on GitHub and click commits&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vT52r5GK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6m7n91lsjv4ay8gwzxck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vT52r5GK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6m7n91lsjv4ay8gwzxck.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;then copy the commit to your clipboard&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x0YsJfHN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i9jz91p3ojeb0oaxcc8v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x0YsJfHN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i9jz91p3ojeb0oaxcc8v.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;in your terminal checkout the commit, and create a new branch&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout &amp;lt;commit string&amp;gt;
git checkout -b &amp;lt;branch name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



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

&lt;p&gt;You may run into merge conflicts, and great communication with your team can remedy that. A conflict arises when two separate branches have made edits to the same line in a file, or when a file has been deleted in one branch but edited in the other. Keeping track of who works on what is crucial, so I like to use &lt;a href="https://trello.com/en-US"&gt;Trello&lt;/a&gt; to break down tasks. In case a conflict does happen though, git will notify you and you’ll be able to delete whatever is causing the conflict.&lt;/p&gt;

&lt;p&gt;When your development branch is a complete and working product, it’s time to merge to the master branch. &lt;/p&gt;

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

&lt;p&gt;Do so by switching to master &lt;code&gt;git checkout master&lt;/code&gt; and merge from your development branch  &lt;code&gt;git merge development&lt;/code&gt; Deploy!&lt;/p&gt;

&lt;p&gt;All in all, keep a development branch and make small feature branches as you go. Commit often, and keep track of who is doing what. This is just a workflow that I found easiest to use, feel free to tweak and experiment with other workflows and let me know your results!&lt;/p&gt;

</description>
      <category>git</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
