<?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 Kevin Sage on Medium]]></title>
        <description><![CDATA[Stories by Kevin Sage on Medium]]></description>
        <link>https://medium.com/@ksagedeveloper?source=rss-ca8751a9ad38------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*oOWruwRTMjQ13yHo</url>
            <title>Stories by Kevin Sage on Medium</title>
            <link>https://medium.com/@ksagedeveloper?source=rss-ca8751a9ad38------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 05:48:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ksagedeveloper/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[JavaScript for React.js]]></title>
            <link>https://medium.com/@ksagedeveloper/javascript-for-react-js-e43a6d1089ad?source=rss-ca8751a9ad38------2</link>
            <guid isPermaLink="false">https://medium.com/p/e43a6d1089ad</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Kevin Sage]]></dc:creator>
            <pubDate>Mon, 27 Apr 2020 01:46:14 GMT</pubDate>
            <atom:updated>2020-04-27T01:46:14.341Z</atom:updated>
            <content:encoded><![CDATA[<h3>Essential JavaScript for React.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*aRChJuD1NwzI_yjRAZgATA.png" /></figure><p>Learning a front-end javaScript framework /library is essential for developers as it speeds up the production process while minimizing the lines of code. For JavaScript developers, the most common frameworks are React.js, Angular, and Vue.js. Today, we’re going to focus our attention on React.js.</p><p>Before jumping headfirst into React, it is important that you have a very solid foundation in JavaScript as there are several concepts that all burgeoning react developers must become familiar/comfortable with to get the most out of this useful tool.</p><h3><strong>Var vs. Let vs. Const</strong></h3><p>ECMA6 introduced a new way to declare variables that differs from the traditional way variables are declared using the “var” keyword, the previous js standard. It is highly advised that javascript developers use “let” and “const” keywords as opposed to using “var” when declaring variables. The reasoning behind this is that ‘let’ utilizes “function” scope while ‘let’ and ‘const’ use “block” scope. This is an important distinction as block scoping is preferred because we don’t want to give access to our variables outside of a defined block.</p><pre>function helloWorld() {<br>  for (var i = 0; i &lt; 5; i++) {<br>    console.log(i)<br>  } <br>  console.log(i)<br>}<br>helloWorld()</pre><p>In the previous example, we have a helloWorld function. Within that function is a for loop that increments by one as long as ‘i’ is less than 5. In this example, we have 2 console logs, one within the function scope and the other within the for loop block. Using var to declare our variable allows the 2nd console log to have access to the ‘i’ variable within the for loop, which as we described previously, is not ideal. Now, let’s take a look at the same example, but this time we’ll use the let keyword.</p><pre>function helloWorld() {<br>  for (let i = 0; i &lt; 5; i++) {<br>    console.log(i)<br>  } <br>  console.log(i)<br>}<br>helloWorld()</pre><p>Using the let keyword, the 2nd console log should throw an error as the i variable will only be accessible within the for loop, as let is block scoped, not function scoped.</p><p>That leaves us with “let” and “const” as our preferred methods of declaring variables. “Const” is used when we have a variable that will not change and “let” if a variable will be reassigned at a later time, therefore, const would not be a good choice for an incrementing for loop.</p><h3>Objects</h3><p><strong>Properties and Methods</strong></p><p>In javascript, objects are collections of related data consisting of ‘key-value’ pairs in the for of variables, also known as properties, and functions which are referred to as methods.</p><p><strong>Dot and Bracket Notation</strong></p><p>When we know which particular property or method we’d like to access, dot notation works well.</p><pre>let dog = {<br>  name = &quot;Fido&quot;,<br>  age = 3,<br>  color = &quot;black&quot;,<br>  owner = &quot;Kevin&quot;<br>}</pre><pre>dog.owner = &quot;Richard&quot;</pre><p>On the other hand, we use bracket notation when we are unsure of the property or method we want to be able to access.</p><pre>let dog = {<br>  name = &quot;Fido&quot;,<br>  age = 3,<br>  color = &quot;black&quot;,<br>  owner = &quot;Kevin&quot;<br>}</pre><pre>let newOwner = &#39;owner&#39;<br>dog[newOwner.value] = &quot;Richard&quot;</pre><p>In our next installment, we’ll be taking a look at the ‘this’ keyword.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e43a6d1089ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Command Line Crash Course]]></title>
            <link>https://medium.com/@ksagedeveloper/command-line-crash-course-aad6d44d14d7?source=rss-ca8751a9ad38------2</link>
            <guid isPermaLink="false">https://medium.com/p/aad6d44d14d7</guid>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Kevin Sage]]></dc:creator>
            <pubDate>Fri, 24 Apr 2020 15:15:55 GMT</pubDate>
            <atom:updated>2020-04-24T15:15:55.262Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Pt. 3: Shortcuts</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0iNrCHaMVF29JCIk" /><figcaption>Photo by <a href="https://unsplash.com/@ikukevk?utm_source=medium&amp;utm_medium=referral">Kevin Ku</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The next section of our command-line crash course is to familiarize yourself with some terminal shortcuts to make your life a bit easier.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3oz8xA9gtnyVDPZJHW%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fanimation-internet-computers-3oz8xA9gtnyVDPZJHW&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3oz8xA9gtnyVDPZJHW%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/e30a1f41fee98b070e3b9eec7f51bfdf/href">https://medium.com/media/e30a1f41fee98b070e3b9eec7f51bfdf/href</a></iframe><p><strong>Terminal Hacks</strong></p><p>Command ⌘, Control ⌃, Shift ⇧, Option ⌥</p><p>⌘N = New Terminal Window</p><p>⌘T = New Terminal Tab</p><p>⌃L = Clears the terminal window</p><p>⌃C = Quit or exit process</p><p>⌃D = Exit the current shell</p><p>⌘+ , ⌘- = increases and decreases font size</p><p>⌘D = Splits terminal into two panes</p><p>⌃K = Deletes until the end of the line</p><p><strong>Navigating the Command Line</strong></p><p>We can easily navigate through previous commands by using our ↑ and ↓ arrow buttons. This will likely you save you the most time while in Terminal.</p><p>If we would like to edit a line, we can traverse within a line by using ⌃ + A, which will move your cursor to the beginning of the line and ⌃ + E, which moves the cursor to the end of the line. ⌃ + U clears the entire line.</p><p>We can also move our cursor one word at a time by using Option + → to move the cursor forward or Option + ← to move our cursor backward.</p><p><strong>Tab Completion</strong></p><p>Tab completion can save you lots of time by autocompleting by easily pressing the tab key after entering a few letters of the name of the file.</p><pre>% ls doc</pre><p>For example, I have a documents folder within my current directory, so, after typing in doc, by pressing the tab key, my entry will autocomplete to any file(s) that match:</p><pre>% ls documents</pre><p><strong>Repeating the Previous Command</strong></p><p>Using a !! symbol gives you a slightly faster way of repeating the previous command.</p><pre>echo &#39;hello world&#39;<br>hello world</pre><pre>!!<br>echo &#39;hello world&#39;<br>hello world</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aad6d44d14d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Command Line Crash Course]]></title>
            <link>https://medium.com/@ksagedeveloper/command-line-crash-course-550ea614c63b?source=rss-ca8751a9ad38------2</link>
            <guid isPermaLink="false">https://medium.com/p/550ea614c63b</guid>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Kevin Sage]]></dc:creator>
            <pubDate>Fri, 24 Apr 2020 15:12:09 GMT</pubDate>
            <atom:updated>2020-04-24T15:12:09.374Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Pt. 2: Common Commands</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MfCUZ7L9-rCvgmLw" /><figcaption>Photo by <a href="https://unsplash.com/@sammisamuel21?utm_source=medium&amp;utm_medium=referral">Sam Albury</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Commands are arguably the meat of our command line. It is the verb that determines the action that you’d like to initiate. With these commands, you’ll have the ability to create, delete, edit, rename, move, etc. files and folders.</p><p>There is a great built-in tool for information regarding commands. We simply need to type ‘man’ (short for manual), followed by the command we’d like information about.</p><p>For example</p><pre>ksagedeveloper@Kevins-MacBook-Pro ~ % man mkdir</pre><p>Entering the previous command should print to your terminal the name, synopsis description and the command’s available options.</p><p><strong>Common commands</strong></p><p><strong>cd- </strong>change directories</p><pre>% cd ~ (redirects to home directory)<br>% cd .. (redirects to one level aboe current directory)<br>% cd - (redirects to previous directory)</pre><p><strong>ls- </strong>generates a list of files within the current directory. <strong>ls</strong> can also utilize a wildcard character ‘*’ to for more specific results. Let’s say that you would like to locate all .mp4 files within a specific folder.</p><pre>ksagedeveloper@Kevins-MacBook-Pro ~ % ls *.mp4</pre><p><strong>cat- </strong>can be used to view concatenate the contents of multiple files, but very often used to view the contents of a single file.</p><p><strong>mv- </strong>moves or renames a file</p><p><strong>cp- </strong>copies an existing file</p><p><strong>diff- </strong>Can display the differences between 2 files.</p><p><strong>rm- </strong>removes or deletes an existing file</p><p><strong>touch- </strong>creates a new, empty file within the current directory</p><p><strong>mkdir- </strong>creates a new, empty folder within the current directory</p><p><strong>rmdir - </strong>remove directory (empty directories only)</p><p><strong>rm -R - </strong>remove directory including contents</p><p><strong>pwd- </strong>display the current working directory</p><p><strong>open [dir/file]- </strong>opens a file or folder using its default program</p><p><strong>head [file]- </strong>gives you the first 10 lines of a file</p><p><strong>tail [file]- </strong>gives you the last 10 lines of a file</p><p><strong>wc [file] - </strong>word count</p><p><strong>Redirect and Append Operand</strong></p><p><strong>&gt;</strong> Can update or create a new file with the content before the operand.</p><pre>$ echo &quot;Roses are red, violets are blue,&quot; &gt; poem.txt</pre><p>If a file entitled “poem.txt” exists, the content of this file will be replaced with the text included within our command. If the file doesn’t exist, a new file will be created with the text in our command.</p><p><strong>&gt;&gt;</strong> is known as the append operand, which will add text to the end of a file.</p><pre>$ echo &quot;Sugar is sweet, and so are you.&quot; &gt;&gt; poem.txt</pre><p>This should append the phrase ”Sugar is sweet, and so are you”, to our poem.</p><p>If we use our <strong>cat</strong> command to view the contents of our poem.txt file, you should get:</p><pre>Roses are red, violets are blue,</pre><pre>Sugar is sweet, and so are you.</pre><p><strong>Using less</strong></p><p>Your terminal also has a feature known as ‘less’ that allows you to search a file for specific strings. For example, to search for the keyword “Atlanta” within a specific file</p><pre>% less americancities.txt /atlanta</pre><p>If your query returns multiple selections, you can navigate through them by using typing ‘n’.</p><p><strong>Using grep</strong></p><p>Grep (<strong>g</strong>lobally search a <strong>r</strong>egular <strong>e</strong>xpression and <strong>p</strong>rint)is the most common way to search for a substring within a document.</p><pre>% grep denver americancities.txt</pre><p>Common grep patterns</p><p><strong>[a-z]</strong> This represents any letters lower case letters</p><ul><li>an * represents a number of the preceding pattern</li></ul><p>Ex.</p><pre>% grep &#39;d[a-z]*n&#39; americancities.txt</pre><p>This should return any pattern within the document that begins with the letter “d”, contains any number of lower case letters ending with the letter “n.”</p><p><strong>Sudo</strong></p><p>The command ‘sudo’ gives the user admin access giving the user permissions that you may not have access to.</p><p>For example, say you’d like to create a file within a folder with established permissions.</p><pre>$ sudo touch /folder/file.txt</pre><p>Your terminal, should at that point, prompt for your password. Once provided, you should be able to create your file.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=550ea614c63b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Command Line Crash Course]]></title>
            <link>https://medium.com/@ksagedeveloper/command-line-crash-course-47cb33173ff2?source=rss-ca8751a9ad38------2</link>
            <guid isPermaLink="false">https://medium.com/p/47cb33173ff2</guid>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[shortcut-keys]]></category>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Kevin Sage]]></dc:creator>
            <pubDate>Fri, 24 Apr 2020 15:10:25 GMT</pubDate>
            <atom:updated>2020-04-24T15:10:25.424Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Pt. 1: Anatomy of the Command Line</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d3frmi16ikjSuIDY" /><figcaption>Photo by <a href="https://unsplash.com/@ngeshlew?utm_source=medium&amp;utm_medium=referral">Lewis Ngugi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Most web software falls under the Unix umbrella of operating systems. Those include Linux, macOS, Android, and iOS.</p><p>This guide is intended for developers with limited command-line experience. The purpose is to provide a bare-bones instructional guide to the Unix command line in a practical way.</p><h3><strong>Before we get started…</strong></h3><p>I. Opening terminal</p><p>To run commands on the command line we’ll first need to open up our terminal. You can easily locate Terminal by opening spotlight on your mac and typing the word ‘terminal’.</p><p>II. Customize your terminal</p><p>There’s nothing more boring than staring at the default terminal, so why not add a little personality by changing your terminal profile.</p><p>You can do this at terminal&gt;preferences&gt;profiles. This menu allows you many different ways to personalize your terminal including different backgrounds, fonts, and color schemes.</p><h3><strong>Anatomy of a Command</strong></h3><p>The anatomy of a command very often consists of several easily identifiable components.</p><p>First, we’ll take a look at the entire command, then we’ll break it down into 5 sections;</p><p><strong>Prompt, Command, Flag, Option, Argument</strong>.</p><pre>ksagedeveloper@Kevins-Macbook-Pro ~ % mkdir -m a=rwx project</pre><p><strong>Prompt</strong></p><p>The first section is known as the prompt. The prompt gives information regarding the username, machine name, and the directory.</p><pre><strong>ksagedeveloper</strong>@Kevins-Macbook-Pro ~ %</pre><p>ksagedeveloper = user name</p><pre>ksagedeveloper<strong>@Kevins-Macbook-Pro</strong> ~ %</pre><p>Kevins-Macbook-Pro = machine name</p><p>The “~” symbol is demonstrating that I am currently in my home folder. If we change our directory, this will be reflected in the prompt.</p><p><strong>Command</strong></p><p>The second piece of our command line is the command itself. The purpose, of which, is to designate an action to be performed.</p><pre>ksagedeveloper@Kevins-Macbook-Pro ~ % <strong>mkdir</strong> -m a=rwx project</pre><p>For example, <strong>mkdir </strong>is a command that creates a new directory within the current folder. In this situation, the current folder is your home directory, represented by the “~” symbol.</p><p><strong>Flag</strong></p><p>The next piece to our puzzle is the flag. The flag modifies how the command works and is represented by a letter or digit which follows a “-” (dash) or another flag</p><pre>ksagedeveloper@Kevins-Macbook-Pro ~ % mkdir <strong>-m </strong>a=rwx project</pre><p>In this example -m is the flag that lets you establish permissions for our new directory.</p><p><strong>Options</strong></p><p>The next piece to our puzzle is the options. Most flags allow the ability to process specialized requests.</p><pre>ksagedeveloper@Kevins-Macbook-Pro ~ % mkdir -m<strong> a=rwx</strong> project</pre><p>In this example, we can alter/create the proper permissions of our directory. a=rwx allows all users (a) permission to read (r), write(w) and delete (x) this directory.</p><p><strong>Arguments</strong></p><p>The final piece is our arguments which are typically reserved for the names of files and folders.</p><pre>ksagedeveloper@Kevins-Macbook-Pro ~ % mkdir -m<strong> </strong>a=rwx <strong>project</strong></pre><p>Here, we’ve included the argument ‘project’ which will serve as our new directory.</p><p>Now that we have a pretty basic understanding of what makes up a terminal, command, in our next section we’ll take a look at some of the most common commands you’ll be using in most terminal sessions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47cb33173ff2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fetching Translations  in Your Next React App]]></title>
            <link>https://medium.com/@ksagedeveloper/fetching-translations-in-your-next-react-app-6f034850ce19?source=rss-ca8751a9ad38------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f034850ce19</guid>
            <category><![CDATA[fetch-api]]></category>
            <category><![CDATA[google-translate]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Kevin Sage]]></dc:creator>
            <pubDate>Sun, 05 Apr 2020 21:54:46 GMT</pubDate>
            <atom:updated>2020-04-05T21:54:46.937Z</atom:updated>
            <content:encoded><![CDATA[<h3>Fetching Translations in Your Next React App</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1eKJJvDYcC0I_m2MI3oRCw.jpeg" /></figure><p>For any developers that are unaware, Google has an amazing suite of resources for developers and aspiring developers. One of the most useful resources I’ve found is the <a href="https://cloud.google.com/translate/docs"><strong>Google Translate API</strong></a>, allowing instant translations of text between thousands of language pair combinations.</p><p>Today, we’ll briefly take a look at how one might use the google translate API to fetch a translation for a language acquisition application built with React.</p><p>The first thing we’ll need to do is request an API key from google. An API key is required for several reasons most importantly, providing the API with information in regards to the application making the call and allowing the application to determine whether or not the requesting application has the appropriate permissions to access the API.</p><p>Doing this is a relatively painless process that we won’t discuss here as there is a basic setup guide provided by google with step by step instruction <a href="https://cloud.google.com/translate/docs/basic/setup-basic">here</a>.</p><p>Once you’ve acquired an API key via Google cloud, we can now use our key to make fetch requests to the Google Translate API. I’ll be using fetch within a React App I’ve created called Tongue.io</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s0tsxxzJWdXVHB9ioWT7dg.png" /></figure><p>After logging creating and logging into your account we will be redirected to our language dashboard. As you can see below, I’ve already chosen the target language to be French. We’d like to have the phrase “peanut butter” translated so, we’ve included it in our input form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*24NRUJkrFzj4cBB3vmhRdQ.png" /></figure><p>To fetch our translation, google requires some information to properly analyze your request. To do this first, we’ll need a few variables.</p><p><strong>input</strong>- The language of the text we would like translated.</p><p><strong>target</strong>- The language we would like to translate our text.</p><p><strong>phrase</strong>- The text that we would like to have translated.</p><p><strong>API_KEY</strong> = the key provided by Google Cloud</p><pre>let input = &quot;en&quot;;</pre><pre>let target = &quot;fr&quot;; //French</pre><pre>let phrase = &quot;peanut butter&quot;;</pre><pre>const API_KEY = [&quot;Place your api key here&quot;]</pre><p>Now that we’ve established the information required, we need to create a URL variable that incorporates each piece of information. Using ES6 template literals, this process is quite easy.</p><pre>let url = `https://translation.googleapis.com/language/translate/v2?key=${API_KEY}`;</pre><pre>url += &quot;&amp;q=&quot; + encodeURI(phrase);</pre><pre>url += `&amp;source=${input}`;</pre><pre>url += `&amp;target=${target}`;</pre><p>Now, we can make a “GET” request to the translate API.</p><pre>fetch(url, {<br>method: &quot;GET&quot;,<br>headers: {<br>&quot;Content-Type&quot;: &quot;application/json&quot;,<br> Accept: &quot;application/json&quot;<br>}<br>})<br>.then(res =&gt; res.json())<br>.then(res =&gt; {<br>  console.log(res)<br>})<br>.catch(error =&gt; {<br>console.log(&quot;There was an error with the translation request: &quot;, error);<br>});</pre><p>If we take a look at our response within our dev tools, you’ll notice that we don’t receive a simple translation as expected, but instead, an object containing our translation tucked in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-fd9m_jHlw97vwTBCn8X0g.png" /></figure><p>By inspecting the returned object, we can use ES6 bracket notation to access our translation. So, instead of console logging our response, we’ll console log the following</p><pre>console.log(res[&quot;data&quot;][&quot;translations&quot;][0][&quot;translatedText&quot;]);<br></pre><p>Congrats, you’ve successfully queried the Google Translate API!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zwIyWLNq_LpT0lGX4RyMXQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f034850ce19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neumorphism]]></title>
            <link>https://medium.com/@ksagedeveloper/neumorphism-5002ef1613e4?source=rss-ca8751a9ad38------2</link>
            <guid isPermaLink="false">https://medium.com/p/5002ef1613e4</guid>
            <dc:creator><![CDATA[Kevin Sage]]></dc:creator>
            <pubDate>Tue, 21 Jan 2020 19:10:05 GMT</pubDate>
            <atom:updated>2020-01-21T19:10:05.349Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F10zxDv7Hv5RF9C%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Floop-computer-matrix-10zxDv7Hv5RF9C&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F10zxDv7Hv5RF9C%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="181" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5093beefca1605edbf94422f82079a7/href">https://medium.com/media/b5093beefca1605edbf94422f82079a7/href</a></iframe><p>In the ever changing landscape of software development, there’s always something new to learn that will add to your ever growing skillset as a developer. Paying attention to trending design patterns within the industry can assure that you will stay a cut above the rest, while maintaining a modern approach to your layouts.</p><p>One such trend is a design pattern known as “Neumorphism”. Sounds like something from the Matrix, I know.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FuvoECTG2uCTrG%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fthe-matrix-neo-thomas-anderson-uvoECTG2uCTrG&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FuvoECTG2uCTrG%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="310" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb2f7a6f4f0f4d157936ccce3746344d/href">https://medium.com/media/eb2f7a6f4f0f4d157936ccce3746344d/href</a></iframe><p>This method <strong>will not</strong> give you the ability to dodge bullets or stop them in mid-air. It will, however, give you a slick new tool for creating slick/modern web apps.</p><p>Neumorphism utilizes 3 simple concepts that gives your web page a modern/minimalist design with elements that appear to float just above the page or sunken. When you include additional css for clicks and hovers, the interface really comes alive. For example, adding the concepts of neumorphism can make your buttons look like actual physical buttons on your screen!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0epA0Z4kJWMx-jOx.png" /></figure><p>Neumorphism is a design pattern that has been around for several years but has recently increased in popularity with developers. It utilizes CSS built in shadowing properties to create a very modern aesthetic for web pages and apps.</p><p>There are only 3 things that you need to remember to implement this into your next project.</p><ol><li>Matching Background Color/Element Color</li><li>Light Shadow</li><li>Dark Shadow</li></ol><p>To demonstrate this content there I’ve created a simple h1 with some text. The color of our text is dark grey, for now. We need our colors for the background and the element to match, but without the shadowing, we of course wouldn’t be able to see the text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ci6z_ExzLT9G7MXM3TCCFw.png" /></figure><ol><li>The first thing that you need to do is to make certain that your background color and the color of your element matches. The “Flatiron School” text in the example is an h1.</li></ol><pre>h1 {</pre><pre>  color: #eaeaea;</pre><pre>  text-shadow: 6px 6px 12px rgba(0,0,0,.08),</pre><pre>               -6px -6px 12px rgba(255,255,255,1);<br>}</pre><p>Note that the color of our element is color: #eaeaea; which is a very light grey color. This color will also be the background of our page.</p><p>2. The next, and most important step, is to create two opposing shadows on our element. We will be utilizing a dark shadow, and a light shadow which is meant to emulates a light source.</p><pre>h1 {<br>    color: #eaeaea;</pre><pre>    text-shadow: 6px 6px 12px rgba(0,0,0,.08),</pre><pre>   -6px -6px 12px rgba(255,255,255,1);<br>}</pre><p>In the example above, the text-shadow property allows us to add shadows to multiple sides of our elements by separating our shadows with a comma.</p><p>There are 4 simple parameters that text shadow accepts.</p><ol><li>The first is the<em> h-shadow,</em> which sets the position of the horizontal shadow.</li></ol><p>2. Next is the<em> v-shadow,</em> which sets the position of the vertical shadow.</p><p>3. The blur radius is next, which simply enhances the shadowing effect, giving you more control.</p><p>4. Finally, as you can see, we select a color as our final parameter of our text shadow. The color should be a similar hue, but darker than the element and background color.</p><p>The first shadow effect creates the traditional dark shadow on the bottom and right sides of the element.</p><p>After creating our dark shadow, we create the inverse of our first shadow effect by adding a white shadow to our left and top sides of our element by simply reversing the horizontal and vertical shadows. We do do this by easily changing them to a negative value.</p><p>This design pattern is not only applicable to text but can be applied to shapes as well. The result is our original text with a few shapes thrown in for good measure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFBacISLPDOGbRlosabkug.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5002ef1613e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails: In search of DRY-Land]]></title>
            <link>https://medium.com/@ksagedeveloper/rails-in-search-of-dry-land-4ae07ba97d37?source=rss-ca8751a9ad38------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ae07ba97d37</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Kevin Sage]]></dc:creator>
            <pubDate>Tue, 31 Dec 2019 18:34:31 GMT</pubDate>
            <atom:updated>2019-12-31T18:34:31.205Z</atom:updated>
            <content:encoded><![CDATA[<h4>Pt. 1: Layouts and Templates</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F7GHRDluBmx9O8%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Focean-infinity-7GHRDluBmx9O8&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F7GHRDluBmx9O8%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/b25a3b677d3754b86c0706fafaa33f77/href">https://medium.com/media/b25a3b677d3754b86c0706fafaa33f77/href</a></iframe><p>As a developer, one of the most important and consistent principles that one will encounter on this perilous journey of becoming a developer is the art of keeping your code DRY. When developers encourage DRY code, they are simply insisting that your code is not redundant and repetitive.</p><p><strong>D</strong>on’t . <strong>R</strong>epeat. <strong>Y</strong>ourself</p><p>There are many ways to accomplish DRYing out your code, so, in this series of tutorials, I’ll be giving you tips and trick that will not only assist you in minimizing the amount of code that you have to write, but will also offer a life raft to anyone needing to read/edit your code.</p><p>One of the easiest ways to begin drying out your is by using to templates and layouts in Rails to speedup your production and keep your code simple.</p><p>Let’s say that you’ve created a super awesome layout for your site that includes navigation, menus and a footer. You’d like each of your pages to use the same layout.</p><p>The good news is that Rails provides a way to do just that without the need to copy and paste this code to each individual page.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FSvFi9tsp5TheRkfKMp%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fsnl-saturday-night-live-season-45-SvFi9tsp5TheRkfKMp&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FSvFi9tsp5TheRkfKMp%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="245" frameborder="0" scrolling="no"><a href="https://medium.com/media/9be93c33dc852696350083ae25889805/href">https://medium.com/media/9be93c33dc852696350083ae25889805/href</a></iframe><p>When a new app is created within Rails a layout is created within your app/views/ folder under the file name application.html.erb.</p><h3><strong>Yield</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mpBoBel4RG3fVKmG" /><figcaption>Photo by <a href="https://unsplash.com/@cdrying?utm_source=medium&amp;utm_medium=referral">C Drying</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Let’s say you that you created a blog site called Sample Blog and you’d like to create a template to be used on each page.</p><p>Let’s assume that your are creating an FAQ page for your website.</p><p>You’ll need to create a static controller to handle actions for your new page making certain that your controllers are properly routed. Once routed, create your view file with whatever you’d like to include within the faq.html.erb.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*li95ck1VOyJrmDhOZ_I1Ng.png" /></figure><p>Got it? Great!</p><p>Next we’ll need to add the world “yield” within ruby tags on our faq.html.erb page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r4SKWR-RKsYWrZu7x4Zo3w.png" /></figure><p>Now, when the client send a request for the faq page, your controller will include the template created in application.html.erb by default.</p><p>If you wish to use an alternative template, you can explicitly state the template you want to use for your new page.</p><p>In this example, we will be using the about page as a template for our faq page.</p><p>If you’ve already created a layout that you would like to utilize on your page and it differs from the layout in application.html.erb, you can do this by simply updating static#faq controller by calling layout followed by the the name of template you’d like to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*evxHJh4GJ7I2NUgNLJh1mw.png" /></figure><p>Keep in mind that most pages should have a similar layout as consistency in presentation is important, so don’t go overboard with your layouts</p><h3><strong>Forms</strong></h3><p>Another method that proves useful in our efforts of DRYing out our code, is creating a dedicated form page for creating and updating your database.</p><p>For example, when adding a new entry into your database from your new.html.erb page you’ll need to create a form to capture and pass the data to your create controller. You’ll need to perform a similar action when editing an entry at edit.html.erb and passing the data to your update controller.</p><p>Both forms are identical, the differences being the data outside of the forms such as any headings or any other data you would like to stay consistent across our views.</p><p>Wouldn’t it be wonderful if we could create a single form that could be used for both pages?</p><p>Well…..</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FU1ylNFtMuhI3wuEm11%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fbeyonce-beychella-homecoming-U1ylNFtMuhI3wuEm11&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FU1ylNFtMuhI3wuEm11%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="246" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7baf79abd0d1dd656087bea763afb21/href">https://medium.com/media/d7baf79abd0d1dd656087bea763afb21/href</a></iframe><p>Rails allows us to do just that by creating a separate _form.html.erb file within your view folder.</p><p>After creating your form file, write out your form</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X92znJV3txoPpflcAKllfQ.png" /></figure><p>Now, we can render this form from within your new &amp; edit pages without having to write forms in both by rendering the form within these pages, like so.</p><p>&lt;%= render ‘form’, post: Post.new %&gt;</p><p>and.</p><p>&lt;%= render ‘form’, post: Post.edit %&gt;</p><p>I hope this has provided a simpler way to create your pages, saving your time and energy for other endeavors.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ae07ba97d37" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>