<?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: Donna Hogan</title>
    <description>The latest articles on DEV Community by Donna Hogan (@ddhogan).</description>
    <link>https://dev.to/ddhogan</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%2F33818%2F0ff999b3-8eac-4377-8354-b4acf3d71ebf.jpg</url>
      <title>DEV Community: Donna Hogan</title>
      <link>https://dev.to/ddhogan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ddhogan"/>
    <language>en</language>
    <item>
      <title>Reading The Fancy Manual: Documentation in Bash</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Sun, 03 May 2020 16:40:51 +0000</pubDate>
      <link>https://dev.to/ddhogan/read-the-fancy-manual-documentation-in-bash-39fp</link>
      <guid>https://dev.to/ddhogan/read-the-fancy-manual-documentation-in-bash-39fp</guid>
      <description>&lt;p&gt;Good afternoon quaranteam! I have a Sunday afternoon coffee question:&lt;/p&gt;

&lt;p&gt;To read documentation for a command, such as &lt;code&gt;ls&lt;/code&gt; in Bash in macOS, we use &lt;code&gt;man ls&lt;/code&gt;, but in Linux we use &lt;code&gt;ls --help&lt;/code&gt; (or &lt;code&gt;ls -h&lt;/code&gt;).&lt;br&gt;
Both macOS and Linux are built on Unix, so...&lt;/p&gt;

&lt;p&gt;What accounts for this difference in the way we access documentation?&lt;br&gt;
What other subtle differences do you think a beginner should be aware of?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>My first year as a dev</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Wed, 04 Mar 2020 18:55:30 +0000</pubDate>
      <link>https://dev.to/ddhogan/my-first-year-as-a-dev-5190</link>
      <guid>https://dev.to/ddhogan/my-first-year-as-a-dev-5190</guid>
      <description>&lt;p&gt;I recently remembered that my work-aversary was about a month ago.&lt;br&gt;&lt;br&gt;
The general advice is that junior devs shouldn't start out working remotely.  Not only are most companies not eager to hire for that level in the first place, juniors need mentorship, which can be challenging in a distributed team.&lt;br&gt;
And so while I was thrilled to be hired with my team as a remote contributor, I kept that lurking fear all year (I'm sure impostor syndrome contributed to this too).&lt;br&gt;
The work anniversary lead me to reflect on the year that had past, so I conducted my own sort of informal retrospective on what I've learned and accomplished, where I'd like to improve, and goals.&lt;br&gt;
This would have been a great exercise to do at the 6-month point, and I definitely encourage all new devs to do the same.&lt;br&gt;
While I'm here recommending things, this Coursera course "&lt;a href="https://www.coursera.org/learn/learning-how-to-learn"&gt;Learning How To Learn&lt;/a&gt;" has taught me a few new things that are already changing the way I learn - which, as we know, is crucial for being a successful dev. &lt;/p&gt;

&lt;h2&gt;
  
  
  Wins
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Learned how to write &lt;strong&gt;browser automation tests&lt;/strong&gt;, including one involving a tricky race-condition that &lt;a href="https://dev.to/ddhogan/puppeteer-stochasticity-and-timely-pauses-3kb6"&gt;I wrote about in a pretentiously-titled blog post&lt;/a&gt;.

&lt;ul&gt;
&lt;li&gt;Ironically, I feel more comfortable writing these kinds of tests than writing unit tests. I would like to improve on this in the coming year.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Further developed my React/Router/Redux skills.

&lt;ul&gt;
&lt;li&gt;Even started ejecting React apps that were initialized with Create React App in order to customize webpack.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;I got a little better at manipulating the contents of a &lt;strong&gt;webpack config&lt;/strong&gt;, but I'm still nervous about it, and would like to be better at this in the future. And perhaps make my own React boilerplate rather than using CRA.&lt;/li&gt;
&lt;li&gt;Became more fluent in Git/Github and integration with VSCode.&lt;/li&gt;
&lt;li&gt;Dabbled in &lt;strong&gt;Kibana&lt;/strong&gt; and PowerBI&lt;/li&gt;
&lt;li&gt;Learned what &lt;strong&gt;AWS Lambdas&lt;/strong&gt; are, and wrote my first!

&lt;ul&gt;
&lt;li&gt;Related to this, learned about &lt;strong&gt;virtual environments for Python&lt;/strong&gt; projects.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;My first &lt;strong&gt;Docker&lt;/strong&gt;-ized web app!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asked for something&lt;/strong&gt;, and it was fine!&lt;/li&gt;
&lt;li&gt;Wrote my first, very basic &lt;strong&gt;chatbot&lt;/strong&gt; (using &lt;a href="https://botkit.ai/"&gt;Botkit&lt;/a&gt;, that uses some simple NLP to make searches for you and reports back some answers.

&lt;ul&gt;
&lt;li&gt;Made a tiny contribution to its library.💛&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Made use of &lt;strong&gt;continuing education&lt;/strong&gt; resources like egghead.io, Udemy, YouTube, PluralSight, FreeCodeCamp, books, Slack/Discourse communities, Coursera, and lots of Podcasts. &lt;/li&gt;
&lt;li&gt;Picked up a spot of &lt;strong&gt;Sass&lt;/strong&gt;.  It's not so scary!  Since my CSS needs are usually very simple, and variables are available in plain CSS now, I might not use Sass very often, but I often run into it when working with other devs so this was important to learn.&lt;/li&gt;
&lt;li&gt;Started picking up a new JS framework: &lt;strong&gt;Vue.js&lt;/strong&gt;!&lt;/li&gt;
&lt;li&gt;Learned a lot about &lt;strong&gt;a11y/accessibility&lt;/strong&gt;.  Running audits with aXe, Lighthouse, WAVE, and some basics about aria attributes, contrast and colors, and semantic HTML.  Tried a screen reader (gonna leave that to the pros)&lt;/li&gt;
&lt;li&gt;Learned about &lt;strong&gt;static site generators&lt;/strong&gt;, including Jekyll and eleventy, and spun up a simple one for a work assignment and &lt;a href="https://dev.to/ddhogan/publishing-an-eleventy-site-to-github-pages-40c5"&gt;wrote about how to publish it on GitHub Pages&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Room for improvement
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;My &lt;strong&gt;anxiety slows me down&lt;/strong&gt;. So, I've re-started therapy, and am re-visiting some old tools to help me cope (like mindfulness practices and rescue medications). It also prevents me from asking for help in a timely manner (like, asking a human is absolute last resort), but perhaps with practice this will improve.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Writing tests&lt;/strong&gt; is still a challenge for me, particularly unit and functional tests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webpack&lt;/strong&gt; is still mysterious and scary.  I can debug sorta (because the error messages are actually very good), and make certain edits, but would like to do better here.&lt;/li&gt;
&lt;li&gt;I've &lt;strong&gt;neglected my old portfolio projects&lt;/strong&gt;.  This means my resume is woefully out of date.  I need to either move them off, or update them.  I could also postpone this until I plan to start looking for another job.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;I haven't attended any meetups.&lt;/strong&gt; Just been too busy or out of energy.

&lt;ul&gt;
&lt;li&gt;But, I did buy tickets for &lt;a href="https://codelandconf.com/"&gt;CodeLand 2020&lt;/a&gt;, and am am keeping an eye on some local (+/-) meetups.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;While I keep good personal notes in markdown format, I haven't really been &lt;strong&gt;keeping up with blogging&lt;/strong&gt; or any kind of communication about my learning progress (aside from daily stand-ups, but that's not really about my own development).

&lt;ul&gt;
&lt;li&gt;I want to &lt;strong&gt;re-visit my personal blog/page&lt;/strong&gt;, and start writing in a more formal way and sharing it.  This post is part of that, like a tiny bit of accountability.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Piles of learning fantasies:&lt;/strong&gt; In Todoist, the "backlog" and "lookit" things are overflowing, and I have a bookmark folder called "learn" and "current learning", and haven't touched them in some time (because I'm learning other things, of course!), and then there's Pocket and the dozens of newsletters and Slack/Discord groups, ahhhh

&lt;ul&gt;
&lt;li&gt;Am I ever going to rescue the old Rails projects from Heroku? Before the stack's &lt;a href="https://devcenter.heroku.com/changelog-items/1603"&gt;EOL ends&lt;/a&gt;???&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On balance, I'm basically satisfied with my progress! It can be done! And while becoming a member of the chronic condition community/disabled may have prompted me to consider this as a career initially, even if I miraculously was all better tomorrow I'd still want to do the same work, I just might be more inclined to consider working on-site (for some portion of the week), or would attend meetups or tackle a more ambitious side-project.&lt;br&gt;
Here's to another year! 👩‍💻&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>womenintech</category>
      <category>gratitude</category>
      <category>wecoded</category>
    </item>
    <item>
      <title>Publishing an Eleventy site to Github Pages</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Tue, 03 Mar 2020 20:37:28 +0000</pubDate>
      <link>https://dev.to/ddhogan/publishing-an-eleventy-site-to-github-pages-40c5</link>
      <guid>https://dev.to/ddhogan/publishing-an-eleventy-site-to-github-pages-40c5</guid>
      <description>&lt;p&gt;Eleventy is a relatively new static site generator.  I've heard it's "&lt;a href="https://css-tricks.com/a-site-for-front-end-development-conferences-built-with-11ty-on-netlify/"&gt;almost fascinatingly simple&lt;/a&gt;", and I have a situation at work that is perfect for this tool.  &lt;/p&gt;

&lt;h2&gt;
  
  
  My situation
&lt;/h2&gt;

&lt;p&gt;I have a small collection of one-off "posts" that are hosted on the repo's Github Pages site, almost like a blog, sort of.  Some posts have a template that I just shamelessly lifted from some of the org's other communications for visual continuity.&lt;br&gt;&lt;br&gt;
The problem, of course, is that this is repetitive: if I ever have to make a change to that template (and I have) it must be made on each post.&lt;br&gt;&lt;br&gt;
Additionally, I want to continue to host it on gh-pages (to avoid making this a whole huge thing by changing), so I made an extremely minimal silly little test case to see how Eleventy plays with Github Pages. &lt;br&gt;
I'm sure Netlify is amazing, but I really want to change only one thing at a time (and I also just want to see if this will work 😁)&lt;/p&gt;
&lt;h2&gt;
  
  
  Initializing
&lt;/h2&gt;

&lt;p&gt;I started by following along with their &lt;a href="https://www.11ty.dev/docs/getting-started/"&gt;getting started guide in the docs&lt;/a&gt;.&lt;br&gt;
I added a single HTML template (just an &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; element, basically), and two posts: one in Markdown and the other in HTML (since my use-case involves both).  Just some text and a little image in each.  I put the posts in the &lt;code&gt;src&lt;/code&gt; directory and the template in the &lt;code&gt;_includes&lt;/code&gt; directory, just following along with the gorgeously easy to understand docs.  So far easy-peasy!&lt;/p&gt;
&lt;h2&gt;
  
  
  Bringing it to GitHub Pages
&lt;/h2&gt;

&lt;p&gt;'0.' After &lt;a href="https://help.github.com/en/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line"&gt;pushing to Github&lt;/a&gt;, make a branch called &lt;code&gt;gh-pages&lt;/code&gt; (or whatever you'd like) and go into the settings and &lt;a href="https://help.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site"&gt;enable Github Pages&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;'1.' Then, back in your terminal, install the gh-pages package: &lt;code&gt;npm install gh-pages --save-dev&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;'2.' Because of this package's &lt;a href="https://www.npmjs.com/package/gh-pages#command-line-utility"&gt;command line utility&lt;/a&gt;, we can add this item to &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"deploy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"gh-pages -d _site"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"homepage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/silly-eleventy-demo"&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This allows us to use the command &lt;code&gt;npm run deploy&lt;/code&gt; to push to our gh-pages branch from our &lt;code&gt;_site&lt;/code&gt; directory (which is effectively the build/dist), and, if our account is already mapped to a custom domain, add the repo name to the url so we still land on the correct &lt;code&gt;index.html&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;'3.' Add this to &lt;code&gt;.eleventy.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;pathPrefix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/silly-eleventy-demo/&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;ul&gt;
&lt;li&gt;Because we're aiming to publish to a sub-directory (namely, the specific repo in our domain, as described &lt;a href="https://www.11ty.dev/docs/config/#deploy-to-a-subdirectory-with-a-path-prefix"&gt;here&lt;/a&gt;), this enables the use of Eleventy's built-in &lt;a href="https://www.11ty.dev/docs/filters/url/#url-universal-filter"&gt;URL filter&lt;/a&gt; to prefix all urls with this path.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;'4.' Then, assuming you have a permalink (like &lt;code&gt;"myFirstPost/"&lt;/code&gt;) in the &lt;a href="https://www.11ty.dev/docs/data-frontmatter/"&gt;front matter&lt;/a&gt; of the md or html content, make your links to it look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ '/myFirstPost' | url }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;First Post&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
or
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ '/'  | url }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where the &lt;code&gt;|&lt;/code&gt; is the &lt;a href="https://mozilla.github.io/nunjucks/templating.html#filters"&gt;nunjucks pipe operator&lt;/a&gt; (this is also built-in to eleventy) and says to use the &lt;code&gt;url&lt;/code&gt; filter on the string to the left of the pipe.  &lt;/p&gt;

&lt;p&gt;And finally, run &lt;code&gt;npx @11ty/eleventy&lt;/code&gt; if you haven't already since your last edits (you can add the &lt;code&gt;--serve&lt;/code&gt; if you want to see it live, as described in the docs) to generate the &lt;code&gt;_site&lt;/code&gt; directory, and then run &lt;code&gt;npm run deploy&lt;/code&gt;.  The page is ready to go at "&lt;a href="https://yourGitHubName.github.io/theRepoName"&gt;https://yourGitHubName.github.io/theRepoName&lt;/a&gt;" &lt;br&gt;
🎊&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Puppeteer stochasticity and timely pauses</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Thu, 21 Feb 2019 14:23:47 +0000</pubDate>
      <link>https://dev.to/ddhogan/puppeteer-stochasticity-and-timely-pauses-3kb6</link>
      <guid>https://dev.to/ddhogan/puppeteer-stochasticity-and-timely-pauses-3kb6</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fi.imgur.com%2FmNvMtqX.jpg" 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/http%3A%2F%2Fi.imgur.com%2FmNvMtqX.jpg" alt="Underneath ocean wave with a fish"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  When only the watched tests are passing...
&lt;/h3&gt;

&lt;p&gt;I'd written a few tests with Jest and Puppeteer for my SPA built with React.  Very simple stuff: launch the browser, navigate to the page at localhost, enter some text and click a button, then wait for the next page to load and find a particular selector, that kinda thing.&lt;/p&gt;

&lt;p&gt;I added a small feature to one of the views that caused some unexpected chaos with my tests.  I hadn't even written any new tests to cover the new component, but I noticed that my tests were suddenly only passing if ran with &lt;code&gt;{headless: false}&lt;/code&gt;.  Like it needed me to be watching in order for it to work.&lt;/p&gt;

&lt;p&gt;I assumed it was a timing issue (and I was close!) so I kept bumping the timeout ever higher on different &lt;code&gt;waitForSelector&lt;/code&gt;s and on the suite as a whole, and throwing pauses in there (I was getting so close!), still no luck.  When it ran in headless mode, it would fail inconsistently - not in the same place each time, but rather one of a few different places randomly.&lt;/p&gt;

&lt;p&gt;I googled (one of my searches yielded only 9 hits!), frantically read the docs, joined the Puppeteer slack community (which is actually very quiet), read all (like, 3) questions in the GitHub forum from people who were seeing similar results, and they all seemed to be running into issues with headless browsers being blocked by some websites. Interesting, but definitely not the issue I was having.  I'd hoped to find something like a &lt;code&gt;{stochastic: false}&lt;/code&gt; mode 😆&lt;/p&gt;

&lt;p&gt;Reflecting on what I had to change to bring in that extra little component, I remembered I had needed to add a lifecycle method (&lt;code&gt;componentDidUpdate&lt;/code&gt;) to the same view where the tests tended to start failing.&lt;/p&gt;

&lt;p&gt;So, in the tests, after landing on that page/view and identifying all the selectors and whatever (I had confirmed with screenshots that the page had sufficient time to load already), but &lt;em&gt;before&lt;/em&gt; simulating the click event on one of the links, I added a 3 second pause for both instances where it occurred... and suddenly the tests were passing consistently!  In only 9 seconds!&lt;/p&gt;

&lt;p&gt;I know pauses aren't best practice in tests, and if I was writing these tests with Enzyme instead I would probably not need to worry about this, but in this case it seems to be the best way to let that lifecycle method resolve before interacting with the links on the page.  And indeed, this more closely emulates the user's experience, since every time it was working with &lt;code&gt;{headless: false}&lt;/code&gt; I also had &lt;code&gt;{SloMo: 250}&lt;/code&gt; which was incidentally just enough time for the lifecycle method to resolve.  This means I could probably safely decrease those pauses to a half-second or less (but this builds in plenty of margin for slowness on Travis CI's end).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What seemed like chaotic behavior of the tests was really a much simpler process (that I wasn't seeing) resolving just a bit slower than the observation period.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Maybe this blog post will be search result No. 10 and save someone else a little time debugging tests!&lt;/p&gt;

</description>
      <category>react</category>
      <category>testing</category>
      <category>codenewbie</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Starship LCARS!</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Wed, 03 Oct 2018 22:53:04 +0000</pubDate>
      <link>https://dev.to/ddhogan/starship-lcars-2n50</link>
      <guid>https://dev.to/ddhogan/starship-lcars-2n50</guid>
      <description>&lt;p&gt;For my Sinatra portfolio project, I made an app for the various ficticious intelligence agencies in the Star Trek universe, based on the database they often use, called LCARS (Library Computer Access/Retrieval System).&lt;/p&gt;

&lt;p&gt;In my little non-canonical version of this world, all the intelligence agencies share information =] But of course, each agent has control over their own record (editing and deleting). This app is devoted to keeping records of all warp-capable vessels, including sub-class, top speeds, and crew complement.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some small things I’m proud of in this project:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;I experimented with flash messages! Everywhere!&lt;/li&gt;
&lt;li&gt;Used conditional formatting in a view so that logged in users don’t see the login and sign up buttons&lt;/li&gt;
&lt;li&gt;I made a custom 404 page (as a bonus it kept my own morale up as I worked on the app! No more of that “Sinatra doesn’t know this ditty…”&lt;/li&gt;
&lt;li&gt;Custom favicon&lt;/li&gt;
&lt;li&gt;consulted with my resident expert for the theme and terminology throughout&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And remember: infinite diversity in infinite combinations &lt;a href="http://memory-alpha.wikia.com/wiki/IDIC"&gt;❤&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ddhogan/starship-LCARS"&gt;Check out the repo on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://starship-lcars.herokuapp.com/"&gt;Try it out, here&lt;/a&gt; Deploying to Heroku is another part that I’m pleased to have accomplished, with the help of another &lt;a href="http://lucaskisabeth.com/2017/06/24/deploying_your_sqlite3_sinatra_app_to_heroku_using_postgresql/"&gt;blog post&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/1ajGLaZdd4Q"&gt;Or watch the tour&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://donnacodes.com/starship_lcars"&gt;&lt;em&gt;donnacodes.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on October 12, 2017.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>sinatra</category>
      <category>startrek</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Rails Portfolio Project</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Wed, 03 Oct 2018 22:33:05 +0000</pubDate>
      <link>https://dev.to/ddhogan/rails-portfolio-project-1dio</link>
      <guid>https://dev.to/ddhogan/rails-portfolio-project-1dio</guid>
      <description>&lt;p&gt;This Rails portfolio project borrows the theme from my Sinatra project, but is rebuilt from scratch to have nested resources, more complex relationships, and more features. My Sinatra project was only for CRUDing starships. This project has two models (&lt;code&gt;Crew&lt;/code&gt; and &lt;code&gt;Ships&lt;/code&gt;) that have a bi-directional &lt;code&gt;has_many_through&lt;/code&gt; association via Assignments, which acts as the join table, and can be thought of as one particular crew person’s role on one particular ship. This schema gives us easy access to listing all the crew member’s assigned to a ship, or where are crew member is currently assigned. Sounds so reasonable!&lt;/p&gt;

&lt;p&gt;Quick tip: when generating seed data for users with &lt;code&gt;has_secure_password&lt;/code&gt; through BCrypt, make the &lt;code&gt;password_digest&lt;/code&gt; attribute equal to &lt;code&gt;BCrypt::Password.create('someString')&lt;/code&gt;, and then you can use &lt;code&gt;someString&lt;/code&gt; to log in when you’re testing your app!&lt;/p&gt;

&lt;p&gt;Also, forms are more than just a pretty face! Rails form helpers sometimes makes me forget that the form dictates the structure of the params hash. At first I had checkboxes for crew people in the new assignments form, but kept getting an error message about the &lt;code&gt;crew_id&lt;/code&gt; not existing (which it totally did), but as soon as I switched to a drop down menu the problem was solved. Makes sense in retrospect since an assignment only has room for one &lt;code&gt;crew_id&lt;/code&gt;, so checkboxes make no sense in that context, and set the params hash up incorrectly.&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="https://github.com/ddhogan/starfleeter"&gt;GitHub repo&lt;/a&gt;, or my &lt;a href="https://youtu.be/STRKKznhV9Y"&gt;video&lt;/a&gt; walk-through !&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://donnacodes.com/rails_portfolio_project"&gt;&lt;em&gt;donnacodes.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on December 2, 2017.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rails</category>
      <category>codenewbie</category>
      <category>startrektng</category>
    </item>
    <item>
      <title>Thoughts on my JS-Rails project</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Wed, 03 Oct 2018 22:26:30 +0000</pubDate>
      <link>https://dev.to/ddhogan/thoughts-on-my-js-rails-project-3g95</link>
      <guid>https://dev.to/ddhogan/thoughts-on-my-js-rails-project-3g95</guid>
      <description>&lt;p&gt;Completing this was kind of a big deal for me. I had been away from the curriculum for a few months. I found the courage to face this project (and the lab/lesson immediately preceding it) by starting from scratch. After completing the JS and jQuery sections in Codecademy, and faithfully following along with Gordon Zhu’s &lt;a href="https://watchandcode.com/"&gt;Watch &amp;amp; Code&lt;/a&gt; (which, literally changed my life!) I finally started to feel comfortable enough to start &lt;em&gt;thinking&lt;/em&gt; in JS.&lt;/p&gt;

&lt;p&gt;For some reason, I decided it would be a good learning experience for me to complete all the requirements for this project without jQuery, and use only vanilla JS. My AJAX functions are a little verbose, as a result, but at this stage, it helps me conceptualize what’s happening at a more granular level to have to manage things like attaching CFRS tokens to a ‘post’ request.&lt;/p&gt;

&lt;p&gt;And, since December of 2017 (when I completed the Rails version of this project), my Twitter OmniAuth strategy broke. Their implementation became more complex since I was away, so for now I’m making due with Facebook (I resented a little bit having to sign in and get dragged down that rabbit-hole), but, it was important to get it working again for morale purposes.&lt;/p&gt;

&lt;p&gt;Checkout the:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/ddhogan/starfleeter"&gt;Github repo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Live version! &lt;a href="https://starfleeter.herokuapp.com/"&gt;starfleeter.herokuapp.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=6ZASleJcmqE"&gt;Video tour&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://donnacodes.com/thoughts_on_my_js-rails_project"&gt;&lt;em&gt;donnacodes.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on August 5, 2018.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>ajax</category>
      <category>javascript</category>
      <category>startrektng</category>
    </item>
    <item>
      <title>Scope and Hoisting of variables, functions, and `this` in JavaScript</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Wed, 03 Oct 2018 18:03:47 +0000</pubDate>
      <link>https://dev.to/ddhogan/scope-and-hoisting-of-variables-functions-and-this-in-javascript-5176</link>
      <guid>https://dev.to/ddhogan/scope-and-hoisting-of-variables-functions-and-this-in-javascript-5176</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Blog posts and articles abound for this topic (a reference list follows) so I will attempt to highlight common pitfalls for beginner-intermediate web development students learning JavaScript.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Although JavaScript is an interpreted language, implementation in a web development setting involves a step immediately prior to execution called lexical scoping (tokenizing), in which the interpreter skims through your code and identifies all the variables you’ve declared, makes a note of when they’re reassigned, and delineates chunks of code into &lt;strong&gt;scopes&lt;/strong&gt; in three levels: block, function, and global.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 1 (credit MDN)&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;exampleFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
 &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;declared inside function&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// x can only be used in exampleFunction &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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Inside function&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;x&lt;/span&gt;&lt;span class="p"&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;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Causes Reference Error&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The function’s scope includes the variable &lt;code&gt;x&lt;/code&gt;, so that variable is only known within that function. Trying to access it out in the global scope will throw an error because &lt;code&gt;x&lt;/code&gt; is not a declared variable (it’s not even &lt;code&gt;undefined&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If we move that &lt;code&gt;var&lt;/code&gt; declaration outside the function, it’ll be in the global scope, everyone knows about it, and we can access it within and outside of the function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 2 (credit MDN)&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;declared outside function&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;exampleFunction&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;exampleFunction&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Inside function&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;x&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Outside function&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;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;With the advent of ECMAScript2015 (aka “ES6”), two new ways to declare variables were introduced: &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;, which are significant because they enable more granular control over the scope in which a variable is available. Both &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; define local variables which are available only in the level in which they’re defined (whether a code block or function, and any contained sub-blocks).&lt;/p&gt;

&lt;h3&gt;
  
  
  Hoisting
&lt;/h3&gt;

&lt;p&gt;In the following example, &lt;code&gt;x&lt;/code&gt; is declared with &lt;code&gt;var&lt;/code&gt;, and that same variable called &lt;code&gt;x&lt;/code&gt; is known throughout the function (even on lines which precede it!) and in sub-blocks. If &lt;code&gt;x&lt;/code&gt; is declared with the newer &lt;code&gt;let&lt;/code&gt; or &lt;code&gt;const&lt;/code&gt;, then outer scopes don’t have access to it, and if we “&lt;code&gt;let x;&lt;/code&gt;” again in a sub-block, it’s effectively a different variable (like how human twins separated at birth, but given the same name, are not the same person).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 3 (credit MDN) &lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;varTest&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
 &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
   &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// same variable! &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;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 2 &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;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 2 &lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;letTest&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;x&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&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;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// different variable&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;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 2&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;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is relevant because of the lexing step that happens immediately prior to executing the code, and the fact that this:&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;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;is two steps listed on one line: the &lt;em&gt;declaration&lt;/em&gt; of the variable &lt;code&gt;x&lt;/code&gt;, and the &lt;em&gt;assignment&lt;/em&gt; of the integer 5 to that variable. We could also write it like this:&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;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// declaration&lt;/span&gt;
&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// assignment&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When the variable is declared with &lt;code&gt;var&lt;/code&gt;, its value is &lt;code&gt;undefined&lt;/code&gt;, but it is known to be a variable. Then the next line makes &lt;code&gt;x&lt;/code&gt;’s value equal to 5. But, this isn’t the case with &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;. Welcome to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#Temporal_Dead_Zone"&gt;Temporal Dead Zone&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 4 (credit MDN)&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;doSomething&lt;/span&gt;&lt;span class="p"&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;bar&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// undefined&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;foo&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ReferenceError&lt;/span&gt;
 &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;bar&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&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;Within this function, the declaration of &lt;code&gt;bar&lt;/code&gt; is &lt;strong&gt;&lt;em&gt;hoisted&lt;/em&gt;&lt;/strong&gt; to the top of the scope, in this case, the code contained within the function &lt;code&gt;doSomething()&lt;/code&gt;. So, effectively, it’s executed like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 5 &lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;bar&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;bar&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// undefined&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;foo&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ReferenceError&lt;/span&gt;
 &lt;span class="nx"&gt;bar&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&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;which is why trying to &lt;code&gt;console.log(bar)&lt;/code&gt; yields &lt;code&gt;undefined&lt;/code&gt; (we know it’s a variable, it just has no value), while &lt;code&gt;console.log(foo)&lt;/code&gt; throws a reference error (“a variable called ‘foo’? what are you even talking about, human?”)&lt;/p&gt;

&lt;p&gt;This makes things like this possible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 6 (credit MDN)&lt;/span&gt;
&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&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;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// returns 6&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



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

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 7 (credit MDN) &lt;/span&gt;
&lt;span class="nx"&gt;dogName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Watson&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;dogName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;My dog's name is &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// "My dog's name is Watson"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In the first example, even though it looks like &lt;code&gt;var num&lt;/code&gt; is declared after we assign it, from the computer’s perspective, it noticed that we’ve declared it in the relevant scope (global), pins that to the top, and then proceeds with executing the rest of the code. In the second example, even though we invoke/call the function before we’ve defined it, that definition is hoisted to the top of the scope, so by the time we actually start executing the code, the interpreter already knows what &lt;code&gt;dogName()&lt;/code&gt; is.&lt;br&gt;&lt;br&gt;
 For &lt;code&gt;var&lt;/code&gt; variables, note that only the declaration gets hoisted, not the assignment. So, in Example 6, writing it like this:&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;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;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// returns undefined &lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;returns &lt;code&gt;undefined&lt;/code&gt;. &lt;strong&gt;For this reason, it’s often suggested to always declare variables at the top of the scope they’re in, so you remember the order in which the interpreter will execute your code.&lt;/strong&gt; Alternatively, using &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; offer some protection against this behavior, since variables declared this way are not initialized with a value of &lt;code&gt;undefined&lt;/code&gt;. So even though they’re hoisted, you’ll still get a reference error because they won’t be initialized until they’re assigned. It’s almost like they’re not being hoisted at all. &lt;code&gt;const&lt;/code&gt; has an added advantage of protecting against unexpected reassignment (although an object declared this way may still have its properties modified), 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="c1"&gt;// Example 8 (credit Digital Ocean)&lt;/span&gt;
&lt;span class="c1"&gt;// Create a CAR object with two properties&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CAR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
 &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15000&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Modify a property of CAR&lt;/span&gt;
&lt;span class="nx"&gt;CAR&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20000&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;CAR&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Output&lt;/span&gt;
&lt;span class="c1"&gt;// { color: 'blue', price: 20000 }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Similarly, functions follow similar rules. Function &lt;em&gt;declarations&lt;/em&gt; are hoisted:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 9 (credit Elizabeth Mabishi at Scotch.io)&lt;/span&gt;

&lt;span class="nx"&gt;hoisted&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Output: "This function has been hoisted."&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;hoisted&lt;/span&gt;&lt;span class="p"&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;This function has been hoisted.&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;… while function &lt;em&gt;expressions&lt;/em&gt; are not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 10 (credit Elizabeth Mabishi at Scotch.io)&lt;/span&gt;

&lt;span class="nx"&gt;expression&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;//Output: "TypeError: expression is not a function&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;expression&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Will this work?&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  How &lt;code&gt;this&lt;/code&gt; fits into this
&lt;/h3&gt;

&lt;p&gt;A related topic, which I will discuss as it relates to scope and hoisting, is &lt;code&gt;this&lt;/code&gt;. Gordon Zhu created a nice &lt;a href="https://github.com/gordonmzhu/cheatsheet-js"&gt;cheatsheet&lt;/a&gt; which summarizes the corresponding lesson in his &lt;em&gt;life-changing&lt;/em&gt; curriculum on &lt;a href="https://watchandcode.com/"&gt;Watch &amp;amp; Code&lt;/a&gt;. Essentially &lt;code&gt;this&lt;/code&gt; is scope dependent (context). If it’s called within a regular function or just out in the wild, &lt;code&gt;this&lt;/code&gt; points to window. If you’re in a function being called as a method, &lt;code&gt;this&lt;/code&gt; points to the object being acted upon (whatever’s just to the left of the dot).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 11 (credit Gordon Zhu)&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;myObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;myMethod&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&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="k"&gt;this&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="nx"&gt;myObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;myMethod&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// --\&amp;gt; myObject&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;An extension of this is the case where this is used in a constructor as in Example 12, in which &lt;code&gt;this&lt;/code&gt; refers to the instance of the class Person:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example 12 (credit MDN) &lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&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;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&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;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;age&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;Explicitly setting the value of &lt;code&gt;this&lt;/code&gt; using call, bind, and apply is outside the scope (haha!) of this blog post.&lt;/p&gt;

&lt;p&gt;And in a callback function, it depends on where (what scope) &lt;code&gt;this&lt;/code&gt; is being called in, in accordance with the previous examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://medium.com/@nickbalestra/javascripts-lexical-scope-hoisting-and-closures-without-mystery-c2324681d4be"&gt;Javascript’s lexical scope, hoisting and closures without mystery ― @nickbalestra&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.digitalocean.com/community/tutorials/understanding-variables-scope-hoisting-in-javascript#difference-between-var,-let,-and-const"&gt;Understanding Variables, Scope, and Hoisting in JavaScript ― DigitalOcean&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://scotch.io/tutorials/understanding-hoisting-in-javascript"&gt;Understanding Hoisting in JavaScript ― Elizabeth Mabishi at Scotch.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Hoisting"&gt;Hoisting — MDN Web Docs Glossary: Definitions of Web-related terms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Scope"&gt;Scope — MDN Web Docs Glossary: Definitions of Web-related terms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Declarations"&gt;Grammar and types — JavaScript MDN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://donnacodes.com/scope_and_hoisting_of_variables_functions_and_this_in_javascript"&gt;&lt;em&gt;donnacodes.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on August 18, 2018&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>On the React-on-Rails portfolio project</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Wed, 03 Oct 2018 17:30:43 +0000</pubDate>
      <link>https://dev.to/ddhogan/on-the-react-on-rails-portfolio-project-dmo</link>
      <guid>https://dev.to/ddhogan/on-the-react-on-rails-portfolio-project-dmo</guid>
      <description>&lt;p&gt;It’s always kinda bothered me that one can’t edit tweets on Twitter.&lt;br&gt;&lt;br&gt;
 Naturally, my React-on-Rails portfolio project is yet another little Twitter clone (called &lt;a href="https://github.com/ddhogan/butter-emails"&gt;Butter Emails&lt;/a&gt;). I spent almost as much time on implementing the edit/update actions as I did on everything else. I almost left it for version 2, but the completionist in me just couldn’t it it go (it’s C-R-U-D not C-R-D!) So, I’m disproportionately proud of that.&lt;/p&gt;

&lt;p&gt;One of the things that makes it tricky is how the state tree is structured. Currently, it has a branch for auth (which includes information about the current user and where they’re logged in), and one for posts (posts are fetched as an array of objects in state.posts). This choice meant I didn’t easily have access to setting an inital state (from Redux’s perspective) of editing: false for individual posts. I resorted to having a nested return statement in the postsReducer, which, for now, works just as well, though isn’t as elegant.&lt;/p&gt;

&lt;p&gt;The next biggest effort on this project was the JWT/authentication strategy. Since I was designing my own API I didn’t want to use an OmniAuth provider, and instead chose to use the ‘Knock’ gem. I discovered how quietly opinionated this system is. It works, but it seems to lock you into using email addresses for login, which was something I was hoping to avoid. I want to collect as little information as possible from the user (I know, crazy, right?!) but still only have the user’s display name listed next to their posts. Still, it was nice to not need to re-invent the wheel on this part.&lt;/p&gt;

&lt;p&gt;Lastly, getting the two servers to work together was the next largest effort. I followed a couple good tutorials, but still couldn’t get the API server and client server to be managed by Foreman, and that ended up just being solved by specifying a more recent version of the gem. (Update your dependencies, kids!)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://donnacodes.com/on_the_react_on_rails_portfolio_project"&gt;&lt;em&gt;donnacodes.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on Sept 30, 2018.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Quick reference for ruby array methods: push/pop vs. shift/unshift</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Mon, 11 Sep 2017 00:00:00 +0000</pubDate>
      <link>https://dev.to/ddhogan/quick-reference-for-array-methods-pushpop-vs-shiftunshift-4g7h</link>
      <guid>https://dev.to/ddhogan/quick-reference-for-array-methods-pushpop-vs-shiftunshift-4g7h</guid>
      <description>&lt;p&gt;I love to make tables to help me integrate ideas or objects and how they relate to each other.&lt;/p&gt;

&lt;p&gt;When I was learning how to work with arrays in Ruby, the words for functions .push, .pop, .shift, and .unshift, didn’t carry any intrinsic meaning or distinction to me in terms of working with an array (unlike .collect, and .size, which do). I kept getting confused about which thing returns an element, and which one returns the rest of the array, and whether it acts on the beginning or the end. So, here’s my table!&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;beginning&lt;/th&gt;
&lt;th&gt;end&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;adding, returns array&lt;/td&gt;
&lt;td&gt;.unshift&lt;/td&gt;
&lt;td&gt;.push&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;returns removed element&lt;/td&gt;
&lt;td&gt;.shift&lt;/td&gt;
&lt;td&gt;.pop&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;and of course, &amp;lt;&amp;lt; (shovel) is syntactic sugar for .push&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://donnacodes.com/2017/09/11/push_pop_vs_shift_unshift/"&gt;&lt;em&gt;donnacodes.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on September 11, 2017.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Origin story: why am I doing this?</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Tue, 05 Sep 2017 00:00:00 +0000</pubDate>
      <link>https://dev.to/ddhogan/origin-story-4914</link>
      <guid>https://dev.to/ddhogan/origin-story-4914</guid>
      <description>&lt;h3&gt;
  
  
  Origin story: why am I doing this?
&lt;/h3&gt;

&lt;p&gt;In middle school (sometime in the mid 90s), I was so good at what would later be known as googling that I participated in a competitive online scavenger hunt called “Cyber Surfari” (I know…) You could say I was enthusiastic about computers as a kid, and in particular the ✨internet✨.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;And yet for some reason&lt;/em&gt;, I never even considered taking the elective CS course in high school; it just never felt like a possibility &lt;strong&gt;for me&lt;/strong&gt; specifically. I believed I lacked a certain innate, prerequisite skill, like maybe being amazing at math (when I was only just ok).&lt;br&gt;&lt;br&gt;
 It seemed like it wasn’t &lt;em&gt;meant for&lt;/em&gt; someone like me, whatever that was.&lt;/p&gt;

&lt;p&gt;And anyway, by the time I got to college I already had a hard enough time choosing between physics and biology (spoiler: I’d eventually end up doing both). During my second undergrad degree I had to take an introductory programming course for science and engineering majors, which was taught with MATLAB, and I absolutely ~loved~ it. I started using MATLAB whenever I could for other coursework, got the (second) highest grade in the class, and finished the final coding project in just a couple hours. By this time (preparing for my master’s in biochem), I believed that since I’d already invested so much time and resources towards trying to become a scientist that it was too late to think about switching &lt;em&gt;again&lt;/em&gt;.&lt;br&gt;&lt;br&gt;
 I love science (and still do). I puttered about with other resources to pick up some R and Python to help with data analysis during my thesis research, but never found the time to devote to getting past the “advanced beginner” stage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Plot twist!
&lt;/h3&gt;

&lt;p&gt;Acquiring a disability or chronic illness as a grown up has a way of forcing a new perspective on you.&lt;br&gt;&lt;br&gt;
 You have to see the world differently in order to cope and adapt. I had to take stock of where I was, what I could do, and what I really wanted, and what was worth buying with my newly limited “good days”. Previous assumptions about yourself, the world, and how you fit into it become open to examination. Suddenly, the idea of me really learning software development no longer sounded so silly. One paradigm shift ushered in another.&lt;/p&gt;

&lt;p&gt;Coincidentally, this occurred at the same time that MOOCs had matured, coding bootcamps were abundant, and the barriers to entry were getting lower all the time. Culturally, too, CS was beginning to become a much more inclusive space, and perceptions about who “belonged” were dissolving.&lt;/p&gt;

&lt;p&gt;Essentially, my new situation catalyzed the shift I’d gradually been making anyway.&lt;/p&gt;

&lt;h3&gt;
  
  
  The future!
&lt;/h3&gt;

&lt;p&gt;One advantage of my path is that I gained a whole field of domain experience that I sincerely hope will be useful someday combined with my new web development skills. Perhaps someday I can help build applications to wrangle the copious amounts of data generated by geneticists or biochemists, or work with an organization like &lt;a href="https://www.codeforamerica.org/"&gt;Code For America&lt;/a&gt; or &lt;a href="https://18f.gsa.gov/"&gt;18F&lt;/a&gt; and help to make government services more efficient and accessible. (Just think of all the blog posts I could write!)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://donnacodes.com/2017/09/05/why_am_i_doing_this/"&gt;&lt;em&gt;donnacodes.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on September 5, 2017.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>womenintech</category>
      <category>introductions</category>
      <category>introduction</category>
    </item>
    <item>
      <title>On creating my first CLI Gem</title>
      <dc:creator>Donna Hogan</dc:creator>
      <pubDate>Thu, 31 Aug 2017 00:00:00 +0000</pubDate>
      <link>https://dev.to/ddhogan/on-creating-my-first-cli-gem-595a</link>
      <guid>https://dev.to/ddhogan/on-creating-my-first-cli-gem-595a</guid>
      <description>&lt;p&gt;You code the way you do anything else in life. So for me, that means spending roughly three times as long agonizing over the thing than actually doing the thing. However, I’m not too sad, as learning to code has brought that factor down (you should have seen me in grad school…)&lt;/p&gt;

&lt;p&gt;Often, I spend so long in the planning phase trying to decide which idea is “best”, that I lose sight of the objective. My Flatiron classmates have been enormously helpful in this process, reminding me that for this, my first project as a web software developer, I’m not expected to re-create Google (or even Altavista). And that as a beginner, I won’t be able to make anything useful until I can make something usable. Sometimes it’s easy for me to get discouraged when something I make isn’t immediate useful or novel, and this gets in the way of even starting.&lt;/p&gt;

&lt;p&gt;But, one evening I made the initial commit, and had a functioning CLI gem the next evening. It was a puny little thing, and I still had a “To Do” list and “should maybe do” and “would be nice” lists. But I was surprised, all the same. Avi’s walk-through videos proved very useful, and even through I had watched them through at least once before, following along with my content helped me learn even more still.&lt;/p&gt;

&lt;h3&gt;
  
  
  Into the weeds…
&lt;/h3&gt;

&lt;p&gt;For example, all this time I thought I had to stay with Ruby 2.3.1 for the labs because most gems didn’t work with later versions. But, in going “off-road”, I ran into a similar problem with Nokogiri, despite uninstalling and reinstalling, . Several dives into Stackoverflow and Github forums later, I found this gem (pardon the pun, I’ll see myself out): gem install –user-install nokogiri. Gems were being installed in a place ruby wasn’t expecting (or rather, rvm wasn’t expecting)&lt;/p&gt;

&lt;h3&gt;
  
  
  The product (approximately)
&lt;/h3&gt;

&lt;p&gt;My gem, called &lt;a href="https://github.com/ddhogan/pharmacy_finder"&gt;Pharmacy-Finder&lt;/a&gt;, accepts a user’s zipcode and tells you the single closest location from each of two different popular drugstore chains in the US. Obviously, this forces the user to willfully suspend disbelief for a few minutes and forget that the rest of the internet doesn’t exist and search engines aren’t a thing. But I can already see how these smaller gears can fit into a larger machine with access to databases, a more intuitive UI, and more complex object models.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://donnacodes.com/2017/08/31/on_creating_my_first_cli_gem/"&gt;&lt;em&gt;donnacodes.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on August 31, 2017.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>ruby</category>
    </item>
  </channel>
</rss>
