<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jacob Fromm on Medium]]></title>
        <description><![CDATA[Stories by Jacob Fromm on Medium]]></description>
        <link>https://medium.com/@jacobfromm?source=rss-703aa10fe13b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*RNtaFIFq0jN7B-G6tfRUOA.jpeg</url>
            <title>Stories by Jacob Fromm on Medium</title>
            <link>https://medium.com/@jacobfromm?source=rss-703aa10fe13b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:29:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jacobfromm/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Beefing It]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://jacobfromm.medium.com/beefing-it-fbce5a9e64ad?source=rss-703aa10fe13b------2"><img src="https://cdn-images-1.medium.com/max/832/1*3_2fh69y-6GSCMdhlJXROA.png" width="832"></a></p><p class="medium-feed-snippet">Realizing you&#x2019;ve bit off more than you can chew is a hard (meal-sized) pill to swallow.</p><p class="medium-feed-link"><a href="https://jacobfromm.medium.com/beefing-it-fbce5a9e64ad?source=rss-703aa10fe13b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://jacobfromm.medium.com/beefing-it-fbce5a9e64ad?source=rss-703aa10fe13b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbce5a9e64ad</guid>
            <dc:creator><![CDATA[Jacob Fromm]]></dc:creator>
            <pubDate>Mon, 25 Jan 2021 00:18:08 GMT</pubDate>
            <atom:updated>2021-01-25T00:18:08.818Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[In Defense of Templates]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/in-defense-of-templates-5ffc2f573724?source=rss-703aa10fe13b------2"><img src="https://cdn-images-1.medium.com/max/624/1*ukdzWwIWc-Fam7WwSHKCMQ.png" width="624"></a></p><p class="medium-feed-snippet">If you&#x2019;re a junior dev, a little structure can go a long way.</p><p class="medium-feed-link"><a href="https://medium.com/swlh/in-defense-of-templates-5ffc2f573724?source=rss-703aa10fe13b------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/in-defense-of-templates-5ffc2f573724?source=rss-703aa10fe13b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ffc2f573724</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[bootcam]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[junior-developer]]></category>
            <dc:creator><![CDATA[Jacob Fromm]]></dc:creator>
            <pubDate>Mon, 18 Jan 2021 03:08:35 GMT</pubDate>
            <atom:updated>2021-01-18T20:15:00.289Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A Tale of Two APIs]]></title>
            <link>https://medium.com/swlh/a-tale-of-two-apis-41cadb86cc98?source=rss-703aa10fe13b------2</link>
            <guid isPermaLink="false">https://medium.com/p/41cadb86cc98</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[codingbootcamp]]></category>
            <dc:creator><![CDATA[Jacob Fromm]]></dc:creator>
            <pubDate>Thu, 12 Nov 2020 08:55:52 GMT</pubDate>
            <atom:updated>2020-11-13T22:00:46.823Z</atom:updated>
            <content:encoded><![CDATA[<h4>How I built a Frankenstein’s monster from data</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqSHCBs_v7FNLtzuc6y45g.jpeg" /><figcaption>looks pretty software engineery, right?</figcaption></figure><p>Hi there! If you’ve read any of my previous articles, you may know that I’m a software engineering student in Flatiron School’s coding bootcamp. Over the course of the program, students are required to complete five projects. In the process of working on my Mod 4 project, I had an interesting experience working with apis. I’d like to share some of that experience here.</p><p>For our project, my partner and I decided to make an app that would require us to fetch data about a lot of movies. If you’ve ever built an app that requires an external api, you probably know how frustrating it can be to choose the right one. And for something as common as movies, there are lots to choose from! Our project specifically dealt with moves that are available on Netflix. For several years now, <a href="https://techcrunch.com/2014/11/16/netflix-api/?guccounter=1&amp;guce_referrer=aHR0cHM6Ly93d3cucXVvcmEuY29tLw&amp;guce_referrer_sig=AQAAANl6HsHzg9O6OLoAgIJEpdxYI2gC2CxL4MWsGSxkneRPO356r_BHjhlUR4MrsxzT_2ZjHdtWQXwbAhLom5SC2PSCPFYur8ngww3QirA2rgAbRVuIh18x2wWqPYh-44PSYiFmF7VVbL7h0df2VXuRAtmFX9fQQM9-DLrl8GdHbhEI">Netflix hasn’t offered an API of their own</a>, but there are <a href="https://rapidapi.com/collection/netflix-api-alternatives">many others available online</a>.</p><p>When choosing an API to use with your app, you need to consider a few things, such as:</p><ul><li>the cost of the API</li><li>how many calls you’re going to be making</li><li>whether you’ll be calling the API on the frontend or the backend</li><li>the format of the returned data</li></ul><p>After some deliberation, we decided to go with <a href="https://unogs.com/">uNoGSNG</a>, an unofficial Netflix API. We accessed the data through <a href="https://rapidapi.com/marketplace">RapidAPI</a>, a marketplace for browsing and testing many free and paid APIs.</p><figure><img alt="uNoGS API on RapidAPI.com" src="https://cdn-images-1.medium.com/max/1024/1*-hAKYuA1AArhcRHtO5TlWg.jpeg" /><figcaption>RapidAPI is a useful site for browsing and testing a wide variety of APIs</figcaption></figure><p>After some testing, it looked like uNoGS would provide us with good data, but it was missing certain important information like data bout the cast, crew, and plot. However, we didn’t want to jump ship because it seemed like the best API for Netflix-specific data on our budget. To learn more about the API, we visited the developer website, <a href="https://unogs.com/">https://unogs.com/</a>. Instead of finding documentation, however, we found a user interface for the API!</p><figure><img alt="a gif of the author using a movie-searching API" src="https://cdn-images-1.medium.com/max/1000/1*EXgnWtfbEq5wgqrSRcVPsA.gif" /><figcaption>pretty nifty!</figcaption></figure><p>It’s a pretty straightforward interface, laying out its features and endpoints in a visually-appealing way. You search for, say, <em>Nightcrawler</em>, and this is the result:</p><figure><img alt="a search for the movie “Nightcrawler” on the unogs website" src="https://cdn-images-1.medium.com/max/1024/1*r9QQuzGGWgkEk-4qXwarOw.jpeg" /><figcaption>nice</figcaption></figure><p>However, when you click the movie div, you’re presented with information not available from the uNoGS API itself:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*9m2pi4EsAsTwkjwDLWMxzA.gif" /><figcaption>Where’d all this data come from??</figcaption></figure><p>Despite having seemingly no data about cast and crew, the uNoGS site is giving us valuable IMDB information! I found that to be pretty odd, so I did some digging in the site’s source code. (To do this, right click on a page and click “View Page Source.” You could also right click on an element, click “Inspect,” and then go poking around in the Sources tab.)</p><p>And after a little digging, I found it: evidence that this API was serving up data from <strong><em>another API!</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwlwBS7b6Cs5CUvuxALY8w.jpeg" /><figcaption>looking for a needle in a haystack</figcaption></figure><p>It turned out that uNoGs was making a call to <a href="http://omdbapi.com/">omdb</a>, a popular API for searching movie data. I couldn’t believe my eyes! I felt like I had gone to a restaurant where half the menu was just…food from another menu!? But then I got to thinking — what if I, too, could present my users with all this information?</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FQWw4hc5gTnJhY0BUI3%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Felection2020-whoa-joe-biden-QWw4hc5gTnJhY0BUI3&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2FQWw4hc5gTnJhY0BUI3%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="248" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7c0005f6e8b3a41a6b5274f265f2fbd/href">https://medium.com/media/f7c0005f6e8b3a41a6b5274f265f2fbd/href</a></iframe><p>Through a lot of boring enumeration that I won’t get into here, I figured out a way to make the most of both of these APIs. I’m working in React, so in componentDidMount , I made a fetch request to the uNoGS api using a string of genre IDs I retrieved from their /genres endpoint. I saved the data I received from the API in an array in state and then called another function, createMovieObjects() , and passed in that data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*FpjS1HDsr4fK1CBIrG03zQ.jpeg" /><figcaption>I use the Synthwave ’84 extension for these cool colors</figcaption></figure><p>The createMovieObjects function takes in an array and maps through it:</p><pre>createMovieObjects = (<em>moviesArr</em>) =&gt; {</pre><pre>    let apiKey = [API KEY]</pre><pre>    let newArray = <em>moviesArr</em>.map(<em>movie</em> =&gt; {</pre><pre><strong>    this</strong>.omdbRequest(<em>movie</em>, apiKey)</pre><pre>    })<br>}</pre><p>And this is where the fun really starts. In omdbRequest() , I called the omdb API using the imdbidproperty from each movie object in the uNoGS array.(Looking back, it should’ve been a sign that uNoGS was serving up IMDB IDs in the first place!) I then saved that omdb data in state and use it to create a comprehensive movie object containing information from both APIs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oxq4wfvkKxRiDwhHI4OPyA.jpeg" /><figcaption>neato!</figcaption></figure><p>After that, it was just a matter of saving those objects into an array in state called frankensteinMoviesArray . And once they were saved, they were just like any other Javascript object, full of data to use in my app! Honestly, this was one of the most fun coding experiences I’ve had so far. I felt like a detective going through the uNoGS source code, searching for evidence and retracing steps. And I learned a lot about APIs, manipulating data, and making fetch requests as agile as possible.</p><p>Thanks for reading, and happy trails in your own coding adventures!</p><p><strong><em>Sources:</em></strong></p><ul><li><a href="https://techcrunch.com/2014/11/16/netflix-api/?guccounter=1&amp;guce_referrer=aHR0cHM6Ly93d3cucXVvcmEuY29tLw&amp;guce_referrer_sig=AQAAANl6HsHzg9O6OLoAgIJEpdxYI2gC2CxL4MWsGSxkneRPO356r_BHjhlUR4MrsxzT_2ZjHdtWQXwbAhLom5SC2PSCPFYur8ngww3QirA2rgAbRVuIh18x2wWqPYh-44PSYiFmF7VVbL7h0df2VXuRAtmFX9fQQM9-DLrl8GdHbhEI">Tech Crunch</a></li><li><a href="https://rapidapi.com/collection/netflix-api-alternatives">RapidApi</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41cadb86cc98" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/a-tale-of-two-apis-41cadb86cc98">A Tale of Two APIs</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gosh, Wouldja Look at the (date)time!]]></title>
            <link>https://jacobfromm.medium.com/gosh-wouldja-look-at-the-date-time-7d41dbd6b6a8?source=rss-703aa10fe13b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d41dbd6b6a8</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[rails-api]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[datetime]]></category>
            <dc:creator><![CDATA[Jacob Fromm]]></dc:creator>
            <pubDate>Thu, 22 Oct 2020 00:50:51 GMT</pubDate>
            <atom:updated>2020-10-22T00:50:51.407Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h1aOluZvpD7tuomixtbSAw.jpeg" /></figure><p>When building an API in Rails with a Javascript frontend, you may encounter the need to store and display dates and times. This can be difficult, seeing as Ruby’s datetime datatype and Javascript’s Date object are, well, completely different things. The following is a simple (like, really, really simple) primer on how to work with dates in a Rails API and a Javascript frontend.</p><p>But first: <em>why the hassle?</em> Why not just save dates as strings and Rails and be done with it? Well, it’d be a shame to sacrifice the inherent functionality and data contained in Ruby datetime. Plus, if you want to do anything at all with your date information on the frontend, you’ll need to convert it anyway.</p><p>Second: <em>buyer beware</em>. This is by no means an exhaustive explanation of either the datetime datatype or the Date object, and I’m by no means an expert. In fact, it’s because of my very lack of expertise that I felt the need to write this blog post. There’s frankly a TON of information out there on this subject, but if you’re a beginner programmer trying to figure out how to work with dates in a Rails API, you’ve come to the right place.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FhWGhxXRWSgIWAYKzOA%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ftwitter-mariah-carey-all-i-want-for-christmas-is-you-hWGhxXRWSgIWAYKzOA&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2FhWGhxXRWSgIWAYKzOA%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f84cb405e90878026a8a4eb67fac9e7/href">https://medium.com/media/9f84cb405e90878026a8a4eb67fac9e7/href</a></iframe><p><strong>Backend: </strong>I’m going to use the code I’ve written for a bare-bones mood-tracker app to take us through the setup. To create the backend, enter the following line of code (emphasis added) into your terminal. Not sure whether to use <em>model, resource, or scaffold</em>? Check out <a href="https://medium.com/@matt.readout/rails-generators-model-vs-resource-vs-scaffold-19d6e24168ee">this helpful article</a> to learn more.</p><pre>rails g [model, resource, or scaffold] Mood mood_level:integer <strong>date:datetime</strong></pre><p>Then run rails db:migrate to migrate your table to the database. You should see the following:</p><figure><img alt="image showing data in a Rails table" src="https://cdn-images-1.medium.com/max/336/1*IJxybgX07hsSaxO5k9BhQw.jpeg" /><figcaption>We’re saving mood_level as an integer for simplicity.</figcaption></figure><p>Now, you might be thinking, <em>why make a date column when you could just use Rails timestamps?</em> Great question. More on that in a bit. First, we need to display our dates in a legible way!</p><p><strong>Frontend:</strong> Once we’ve got our server up and running and a browser window open, we can demonstrate the different ways to use Ruby’s datetime format in Javascript. For starters, logging the .date property of a mood object to the console will give us the following: <em>2019–12–18T00:00:00.000Z. </em>While legible, this object (a string, by the way) isn’t all that legible. What we want to do is convert it to a JS Date object. Let’s try the following:</p><pre>moodDate = new Date(moodObj.date)<br>console.log(moodDate)</pre><p>That should give us a slightly-more-legible date object: Tue Dec 17 2019 19:00:00 GMT-0500 (Eastern Standard Time). However, there’s a lot of information here that we don’t really need. Here are a few ways we <em>might </em>format the above date object to display in the :</p><ul><li>moodDate.toDateString() “Tue Dec 17 2019”</li><li>moodDate.toLocaleDateString() “12/17/2019”</li><li>moodDate.toLocaleString() “12/17/2019, 7:00:00 PM”</li><li>moodDate.toUTCString() “Wed, 18 Dec 2019 00:00:00 GMT”</li><li>moodDate.toISOString() “2019–12–18T00:00:00.000Z”</li></ul><p>Hey, look at that! That string looks a hell of a lot like a Ruby datetime format, doesn’t it? This brings us to our next step: saving dates from the browser to the database. (By the way, there are a lot more JS Date formats you might find useful. For a deep dive into the many ways to format Javascript’s Date objects, including .toJSON(), I’d recommend <a href="https://css-tricks.com/everything-you-need-to-know-about-date-in-javascript/">this article from CSS Tricks</a>.)</p><p>When pulling a date from from, say, an HTML form, we want to make sure that our information is properly formatted to be saved to a database. With .toISOString() , it’s a pretty simple task. Say, for example, you’re trying to store an object with the current date and time as a property. To get the current date and time, you’ll want something like</p><pre>const date = new Date(Date.now())</pre><p>Conveniently, you can use this variable in a as an object’s .date property in a fetch() POST request! Simply save it to a new object or put it directly into your request’s options object:</p><pre>body: JSON.stringify({mood_level: parseInt(form.mood.value), <strong>date: date</strong>})</pre><p>Now to your earlier question: <em>why make a date column when you could just use Rails timestamps? </em>The answer is because this way, we’re able to persist data from the API to the browser and back again. It’s easy to manipulate on the frontend and easy to read on the backend. And that’s it! Boy, does time fly when you’re talking about time in programming.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F9u514UZd57mRhnBCEk%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Freaction-9u514UZd57mRhnBCEk&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2F9u514UZd57mRhnBCEk%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="217" frameborder="0" scrolling="no"><a href="https://medium.com/media/3146061d32b95e486e2002175335bd1a/href">https://medium.com/media/3146061d32b95e486e2002175335bd1a/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d41dbd6b6a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Customizing your ERB (and, by *extension*, VSCode) Experience]]></title>
            <link>https://jacobfromm.medium.com/customizing-your-erb-and-by-extension-vscode-experience-39bebf8d6a57?source=rss-703aa10fe13b------2</link>
            <guid isPermaLink="false">https://medium.com/p/39bebf8d6a57</guid>
            <dc:creator><![CDATA[Jacob Fromm]]></dc:creator>
            <pubDate>Mon, 28 Sep 2020 05:56:54 GMT</pubDate>
            <atom:updated>2020-09-28T13:11:13.934Z</atom:updated>
            <content:encoded><![CDATA[<h3>Want to Customize VSCode? You Might Have to Start from Scratch.</h3><figure><img alt="a cartoon squid eating ice cream" src="https://cdn-images-1.medium.com/max/300/1*tVyfNf3ygFKs-CzGj5Md1A.png" /><figcaption>If you think squids and ice cream cones have nothing to do with coding, you’re in for a treat!</figcaption></figure><p>Like many new coders, as soon as I started using VSCode, I wanted to customize the crap out of it. I downloaded extension upon extension, installing anything I could find that was in any way related to what I was working on in my coding bootcamp.</p><p>When we started building Rails applications with lots html.erb files, I was relieved to know that my handy-dandy extensions would help me with the cumbersome erb tags required in Rails view files. Unfortunately, nothing was working quite the way I wanted it. I searched through my plethora of extensions, but after installing so many of them, I didn’t even know what I was looking for. Was I supposed to turn a setting <em>off</em> or <em>on</em>? Did I have too many extensions, or not enough? I realized I had gotten myself in too deep and needed to nuke VSCode.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FHhTXt43pk1I1W%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FHhTXt43pk1I1W&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2FHhTXt43pk1I1W%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="243" frameborder="0" scrolling="no"><a href="https://medium.com/media/305ebaeb1072a9e8e75b003ed3adc9f7/href">https://medium.com/media/305ebaeb1072a9e8e75b003ed3adc9f7/href</a></iframe><p>Resetting VSCode to its default settings proved more difficult than I anticipated. You see, VSCode is a pretty smart program, and it does a great job of tracking your activities and settings. Even after uninstalling all my extensions, things still weren’t working the way I wanted them to.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FlNubxCPAPvSUw%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ffrustration-lNubxCPAPvSUw&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2FlNubxCPAPvSUw%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="251" frameborder="0" scrolling="no"><a href="https://medium.com/media/228d1bffee32e2c7c156526557fafb63/href">https://medium.com/media/228d1bffee32e2c7c156526557fafb63/href</a></iframe><p>I know, I know. It’s a lot of work for some carats and %s. But after talking to my classmates, I found that many of them had similar complications getting everything to work *just so*. And although I found many guides for customizing VSCode (linked below), and a few for returning the program to its default settings (also below), I couldn’t find anything explaining <em>what to do if you’ve followed the guides and things still aren’t working quite right</em>. And so, this blog post was born.</p><p>In this post I’m going to offer you various options to both reset VSCode and start customizing your erb capabilities. So, first thing’s first: how to deal with those pesky extensions.</p><ol><li><strong><em>Disabling Installed Extensions</em></strong></li></ol><p>First, go to your extensions either by navigating to Code &gt; Preferences &gt; Extensions in the menu bar…</p><figure><img alt="code &gt; preferences &gt; extensions" src="https://cdn-images-1.medium.com/max/992/1*k5Xh5GCjVBj5eFjibkPaXQ.jpeg" /></figure><p>…or hit shift-command-x. After that, in the Extensions menu bar in the upper left corner of your window (most likely), click on the three dots on the right side of the bar:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*Qm0bCY5vtrDJAQU4hk0s3Q.jpeg" /><figcaption>three dots on the right</figcaption></figure><p>From there, you can choose to disable all installed extensions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*4rGdMwbdYmlIG5zFdIQB2Q.jpeg" /><figcaption>hooray!</figcaption></figure><p>2. <strong><em>Deleting extensions and settings</em></strong></p><p>If you want something a little more extreme, you can delete your extensions and settings completely. There are two ways of accomplishing this goal: a) <em>deleting the contents of </em>settings.json, <em>or</em> b) <em>removing your settings file completely.</em></p><p>2a) To delete the contents of <em>settings.json</em>, simply go to Code &gt; Preferences &gt; Settings, then click on the text-file icon in the top right corner of the window. It looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/82/1*Xopk-lyOF_4Osjzv9hs_dA.jpeg" /><figcaption>cute lil’ file dude</figcaption></figure><p>From there, simply delete (or comment out) the code. Now, there may be code in other settings files that’s continuing to affect VSCode, unbeknownst to you. We’ll get to that later.</p><p>2b) If you’re not satisfied with erasing file contents and want to blast the whole thing to hell, you might consider removing settings files completely using the command line. But tread carefully; deleting files is a one-way trip. In the words of Name Name, author of a <a href="https://www.macworld.com/article/2082021/master-the-command-line-deleting-files-and-folders.html">helpful Macworld guide to the command line</a>:</p><blockquote>If I sound ominous when discussing the powers of the rm command, there’s a good reason. As I said before, this command deletes files; it nukes them. You can’t get them back. You can’t click on the Trash icon and retrieve files you’ve accidentally deleted.</blockquote><p>Now that you’ve been warned, this <a href="https://stackoverflow.com/questions/36108515/how-to-reset-settings-in-visual-studio-code/36109176#36109176">Stack Overflow post offers</a> several solutions for deleting VSCode settings. I’ve distilled the information for you here. To delete your settings file, open up your favorite terminal app, and enter the following code:</p><pre>rm $HOME/Library/Application Support/Code/User/settings.json</pre><p>To delete your extensions file:</p><pre>rm ~/.vscode/extensions</pre><p>At this point, your version of VSCode should be totally wiped. Now for the fun part. If you want to build erb files like a pro, <a href="https://medium.com/swlh/custom-vs-code-snippets-and-emmet-for-erb-files-d163917cce68">this Medium post is the most helpful guide I’ve found</a>. Seriously, read this post. I’m not going to summarize everything in it, but instead offer a solution the author omits. To access VSCode’s built-in autocompletion for html tags in html.erb files, access your settings (if you don’t know how by now, what have you been reading??), search for “Emmet.” You’re going to be adding functionality to Emmet’s “Include Languages” setting:</p><figure><img alt="“Include Language” in VSCode’s Emmet settings" src="https://cdn-images-1.medium.com/max/1024/1*B7a_Szxp4f0T0lriApYPPg.jpeg" /></figure><p>If you were to open up Emmet’s json file, you’d find a has with included languages. Luckily for you, VSCode allows you to edit this file from the user interface. Add “erb” under “item” and “html” under “value,” and you should be autocompleting html tags in html.erb files in no time.</p><p>Erb settings are even more fun! (This is fun, right? Right?? Hey come back!)</p><p>For this step, you’re going to navigate to Code &gt; Preferences &gt; User Snippets and search for “erb” in the search bar. You’re looking for a file titled <em>erb.json</em>; if no such file exists, you can make one yourself! Once you’re in the erb settings file, try pasting the following code snippet from Graham Flaspoehler, author of the aforementioned <em>very</em> <em>useful</em> Medium post on html.erb settings:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7af32d673da0ea8388214c815f0f9ba1/href">https://medium.com/media/7af32d673da0ea8388214c815f0f9ba1/href</a></iframe><p>Once you’ve saved this file, navigate to an html.erb file. Start typing “snowcone,” “squid,” or “cmmt,” and you should notice that VSCode is suggesting an autocomplete solution. Just press enter and you should see the appropriate erb tags. And the cool part is, you can make your own! Here’s a snippet I wrote to easily create a form_for with a submit tag:</p><pre>&quot;form_for with submit&quot;: {</pre><pre>&quot;prefix&quot;: &quot;ffs&quot;,</pre><pre>&quot;body&quot;: [</pre><pre>&quot;&lt;%= form_for @${1:model} do |f| %&gt;\n\t$0\n &lt;%= f.submit %&gt;\n&lt;%end%&gt;\n&quot;</pre><pre>],</pre><pre>&quot;description&quot;: &quot;form_for with submit tag&quot;,</pre><pre>}</pre><p>The “prefix” is what you type into VSCode to generate an autocompleted tag. Play around with this file and have some fun! Oh, and go ahead and download some extensions if you want, but like all things coding, be intentional—you don’t want to have to start over and read this post all over again!</p><h3><strong>Resources:</strong></h3><ul><li><a href="https://medium.com/@ethanjf/how-to-use-visual-studio-code-like-your-instructor-18a3295021b7">How to Use Visual Studio Code Like Your Instructor</a></li><li><a href="https://www.macworld.com/article/2082021/master-the-command-line-deleting-files-and-folders.html">Master the command line: Deleting files and folders</a></li><li><a href="https://stackoverflow.com/questions/36108515/how-to-reset-settings-in-visual-studio-code/36109176#36109176">How to reset settings in Visual Studio Code?</a></li><li><a href="https://medium.com/swlh/custom-vs-code-snippets-and-emmet-for-erb-files-d163917cce68">Custom VS Code Snippets and Emmet for ERB files</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39bebf8d6a57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The .sum is greater than the .each of its parts]]></title>
            <link>https://jacobfromm.medium.com/the-sum-is-greater-than-the-each-of-its-parts-14b1f686d07?source=rss-703aa10fe13b------2</link>
            <guid isPermaLink="false">https://medium.com/p/14b1f686d07</guid>
            <dc:creator><![CDATA[Jacob Fromm]]></dc:creator>
            <pubDate>Tue, 08 Sep 2020 12:19:19 GMT</pubDate>
            <atom:updated>2020-09-08T17:05:52.536Z</atom:updated>
            <content:encoded><![CDATA[<h3>The .sum is greater than the .each of its parts</h3><p>I’m a new software engineering student at the Flatiron School, only three weeks into an intense fifteen-week coding bootcamp. Like many other new students, I started coding a few short months before starting this program. And to my surprise, most of that time was spent learning a language (Javascript) I won’t even be using for until much later in the program!</p><p>Instead, we’ve been focused on Ruby, a high-level programming language that’s relatively simple to learn and use. In Ruby’s case, however, “simple” certainly doesn’t mean “superficial.” There’s lots to learn about Ruby, and your ability to write robust, clean code depends (partially, at least) on how much of Ruby’s “vocabulary” you know. One of the best ways to build your Ruby vocabulary is to study its many <a href="https://ruby-doc.org/core-2.4.1/Enumerable.html">enumerable methods</a>.</p><p>Unfortunately for new students, there’s not much time to keep up with the curriculum and memorize methods at the same time. Fortunately, we’ve gotten lots of practice putting many of these methods to use in our labs and assignments.</p><p>One such opportunity came during our Mod1 Mock Code Challenge, which prepared us for this module’s assessment—the feared <em>code challenge</em>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F7232934&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fscaredtodeath-frightened-gif-7232934&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2F3c95cf4d4bdaf4e953e6b80efca8234f%2Ftenor.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/dda737f8ae94dea2c7ca4c64806dd211/href">https://medium.com/media/dda737f8ae94dea2c7ca4c64806dd211/href</a></iframe><p>We were tasked with writing a pared-down version of a ride-sharing app to model class associations, including classes for a Passenger, Driver, and Ride. One of the required deliverables for the ride class was a method that found the average length of all total rides. Since this was a timed challenge and I’m a total n00b, I’m relied on familiar with Ruby’s catchall enumerable, #each. In short, the #each method applies whatever code you write in a code block to—you’ll never believe this—each element in an array or a hash.</p><figure><img alt="Each, y’know? For, like, each of ‘em?" src="https://cdn-images-1.medium.com/max/1024/1*lN924GAnR_Q53zL5v1t_7g.jpeg" /><figcaption>Each, y’know? Like, for each of ‘em? See—coding’s super easy!</figcaption></figure><p>Now, I’ve historically identified as very-much-not-a-math-person. And despite recent attempts to drop that narrative, when faced with both arithmetic AND a coding challenge, I only have so much bandwith. It’s like parallel parking and listening to music: I can do both well enough, but not at the same time. So I focused on the math and came up with the following code:</p><figure><img alt="a clunky solution to a method that finds the average length of all rides" src="https://cdn-images-1.medium.com/max/850/1*w3D_LR21jiJ56oqA6olKtw.jpeg" /><figcaption>A truly robust solution…not</figcaption></figure><p>So what’s happening here? I set the variable total_dist to 0, and then used the Ruby #each enumerable to increment total_dist by the distance property of each instance of the self class. And since we’re finding the average, I then divided total_dist by the number of total rides. It was a simple solution, which is a nice way of saying inefficient and bad.</p><p>As we reviewed our code for the mock challenge, I offered this solution and found that many of my classmates had used different enumerables to find the same solution. In fact, most of them had used two specific methods—#map and #sum—to solve this problem. I’d never used the #sum method before, so I spent some time toying with my code, and here’s where I landed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*mt1Jzwy3m_x-iX9tHVF-jw.jpeg" /><figcaption>getting closer…</figcaption></figure><p>What do you know! Instead of going to the trouble of doing all that math (<em>ok, I know it was barely any math at all, but still…ugh</em>), I could’ve used one of Ruby’s built-in methods to do the calculation for me! That’s the cool thing about Ruby enumerables: for most data manipulations you could ever want to do, there’s a method for that! So, to break down what’s happening here: I’m telling the #map method to return an array composed only of each ride instance’s distance property, and then I’m telling Ruby to find the total of those numbers chaining the #sum method to the end of the expression. Unfortunately there’s no method to find the average of a set of numbers, but by dividing the sum by the length of the array (found by #count, another handy method), I was able to find the mean. Now, this is pretty good, but it could be even better:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*q4LJHS5YW_TzB9n-GnmDiQ.jpeg" /><figcaption>Hey, look at that! One pretty little line.</figcaption></figure><p>Remembering that Ruby returns the last calculated value of a method whether being explicitly told to or not, I’m able to simply write the expression without setting it equal to a variable. I never would’ve gotten to this solution without the creativity and insight of my brilliant classmates, and after learning about their solutions, I was able to experiment with code and think differently about my approach to data manipulation. For a beginner like me, chaining enumerables instead of doing simple calculations can feel like stacking things I don’t know on top of things I don’t know, but that’s a blog post for another time. And with useful enumerables like #map and #sum, I’m not can spend way less time doing all that math—which is good, considering I have a bootcamp to focus on!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14b1f686d07" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>