<?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: Connor Dillon</title>
    <description>The latest articles on DEV Community by Connor Dillon (@connoro7).</description>
    <link>https://dev.to/connoro7</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%2F443967%2Fb89b148a-864c-4a3d-a435-2058f65cc7c5.jpeg</url>
      <title>DEV Community: Connor Dillon</title>
      <link>https://dev.to/connoro7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/connoro7"/>
    <language>en</language>
    <item>
      <title>Supercharge Your Vim</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Wed, 30 Sep 2020 02:03:26 +0000</pubDate>
      <link>https://dev.to/connoro7/supercharge-your-vim-25mn</link>
      <guid>https://dev.to/connoro7/supercharge-your-vim-25mn</guid>
      <description>&lt;h1&gt;
  
  
  Supercharge Your Vim
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Basic Setup
&lt;/h2&gt;

&lt;p&gt;The following changes should be made to your &lt;code&gt;.vimrc&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Enter the current millenium (Force Vim to NOT behave like Vi)&lt;/span&gt;
&lt;span class="nb"&gt;set &lt;/span&gt;nocompatible

&lt;span class="c"&gt;# Enable syntax and plugins (for `netrw`)&lt;/span&gt;
syntax &lt;span class="nb"&gt;enable
&lt;/span&gt;filetype plugin on
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Finding Files
&lt;/h2&gt;

&lt;p&gt;The following changes should be made to your &lt;code&gt;.vimrc&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Search down into subfolders&lt;/span&gt;
&lt;span class="c"&gt;# Provides tab-completion for all file-related tasks&lt;/span&gt;
&lt;span class="nb"&gt;set &lt;/span&gt;path+&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;**&lt;/span&gt;

&lt;span class="c"&gt;# Display all mathicng files when we tab complete, navigable with Tab and Shift+Tab&lt;/span&gt;
&lt;span class="nb"&gt;set &lt;/span&gt;wildmenu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Sanity check: view Vim's &lt;code&gt;path&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;:set path?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Type &lt;code&gt;:find&lt;/code&gt; and use Tab &amp;amp; Shift+Tab to search by partial match&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;*&lt;/code&gt; to make it a fuzzy Search&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Things to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;:ls&lt;/code&gt; will print out all open Vim buffers&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:b&lt;/code&gt; lets you autocomplete any open buffer (&lt;code&gt;:b&lt;/code&gt; is short for buffer)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tag Jumping
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create the `tags` file (may need to install `ctags` first)&lt;/span&gt;
&lt;span class="nb"&gt;command&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; MakeTags &lt;span class="o"&gt;!&lt;/span&gt;ctags &lt;span class="nt"&gt;-R&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="c"&gt;# `!` tells Vim to run this as a shell command, i.e. pretend we type it into the console&lt;/span&gt;
&lt;span class="c"&gt;# Alternatively, execute `ctags -R .` in your project root directory (back in the console, not Vim!), and check out the new `tags` file&lt;/span&gt;
&lt;span class="nb"&gt;set &lt;/span&gt;tags? &lt;span class="c"&gt;# View `tags` path&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;ctags&lt;/code&gt; often comes pre-installed with most Linux distros. For OSX, &lt;code&gt;ctags&lt;/code&gt; can be installed via &lt;code&gt;brew install ctags&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Usage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;^]&lt;/code&gt; to jump to tag under cursor, (^ = Ctrl, not Caret)&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;g^]&lt;/code&gt; for ambiguous tags, (^ = Ctrl, not Caret)&lt;/li&gt;
&lt;li&gt;Use ^t to jump back up the tag stack, (^ = Ctrl, not Caret)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Things to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This doesn't help if you want a visual list of tags&lt;/li&gt;
&lt;li&gt;Using this can cause you to jump around files, use &lt;code&gt;:echo expand("%")&lt;/code&gt; within Vim to print working directory (i.e. &lt;code&gt;pwd&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Autocomplete
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Now we're getting to the good stuff. All of this is documented in &lt;code&gt;:help ins-completion&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Autocomplete comes pre-configured with Vim. It automatically reads from your &lt;code&gt;tags&lt;/code&gt; file (if one exists!). Even if you don't have a &lt;code&gt;tags&lt;/code&gt; file, it will still work within the file that you're working in, as well as language-specific configurations that allows it to follow language-specific dependency chains.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For example, Vim's built-in autocomplete will recursively search through any files/modules/etc that you've set as &lt;code&gt;require&lt;/code&gt;ed dependencies for your current file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;^x^n&lt;/code&gt; for &lt;em&gt;JUST&lt;/em&gt; this file&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;^x^f&lt;/code&gt; for filenames only (works with our path trick!)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;^x^]&lt;/code&gt;for tags only&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;^n&lt;/code&gt; for anything specified by the "complete" option&lt;/li&gt;
&lt;li&gt;Please see &lt;code&gt;:help ins-completion&lt;/code&gt; for further &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;^n&lt;/code&gt; and &lt;code&gt;^p&lt;/code&gt; to go back and forth in the suggestion list.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  File Browsing
&lt;/h2&gt;

&lt;p&gt;Tweaks for file browsing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;let &lt;/span&gt;g:netrw_banner&lt;span class="o"&gt;=&lt;/span&gt;0            &lt;span class="c"&gt;# disable annoying banner&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;g:netrw_browse_split&lt;span class="o"&gt;=&lt;/span&gt;4      &lt;span class="c"&gt;# open in prior window&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;g:netrw_altv&lt;span class="o"&gt;=&lt;/span&gt;1              &lt;span class="c"&gt;# open splits to the right&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;g:netrw_liststyle&lt;span class="o"&gt;=&lt;/span&gt;3         &lt;span class="c"&gt;# tree view&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;g:netrw_list_hide&lt;span class="o"&gt;=&lt;/span&gt;netrw_gitignore#Hide&lt;span class="o"&gt;()&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;g:netrw_list_hide.&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;',\(^\|\s\s\)\zs\.\S\+'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;:edit&lt;/code&gt; a folder to open a file browser

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;:edit .&lt;/code&gt; for current working directory&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;CR&amp;gt;/v/t&lt;/code&gt; to open in an h-split/v-split/tab&lt;/li&gt;
&lt;li&gt;Check out &lt;code&gt;:help netrw-browse-maps&lt;/code&gt; for more mappings&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Snippets
&lt;/h2&gt;

&lt;p&gt;As with any snippet manager, effective use of snippets in Vim can save you tons of time. Snippets are natively supported in Vim, and can be easily created by remapping a relevant keyword that will read from a skeleton file and auto-complete it at your cursor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Read an empty HTML template and move cursor to title&lt;/span&gt;
nnoremap ,html :-1read &lt;span class="nv"&gt;$HOME&lt;/span&gt;/.vim/.skeleton.html&amp;lt;CR&amp;gt;3jwf&amp;gt;a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;nnoremap&lt;/code&gt; remaps for normal mode (usually &lt;code&gt;nremap&lt;/code&gt;), and &lt;code&gt;nnoremap&lt;/code&gt; ensures that there are no collisions with default Vim commands, if any exist (i.e. overrides pre-existing commands)

&lt;ul&gt;
&lt;li&gt;Please see &lt;code&gt;:help map-modes&lt;/code&gt; for documentation on Vim's key mapping modes&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;,html&lt;/code&gt; is the mapping that we're assigning&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:&lt;/code&gt; tells Vim to enter command mode&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-1read&lt;/code&gt; invokes the &lt;code&gt;read&lt;/code&gt; command into the current Vim buffer, with -1 tweaking cursor placement (for quality of life)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$HOME/.vim/.skeleton.html&lt;/code&gt; is the file that we're reading from (in this example)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;CR&amp;gt;&lt;/code&gt; sends the command automatically, so that we don't have to hit enter every time&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;3jwf&amp;gt;a&lt;/code&gt; Moves the cursor to a specific location (This will be unique to each snippet, and is not necessary)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Build Integration
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Pro tip: Steal &lt;a href="https://www.philipbradley.net/posts/rspec-into-vim-with-quickfix"&gt;Mr. Bradley's formatter&lt;/a&gt; &amp;amp; add it to our &lt;code&gt;spec_helper&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Configure the &lt;code&gt;make&lt;/code&gt; command to run RSpec:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;set &lt;/span&gt;&lt;span class="nv"&gt;makeprg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;bundle&lt;span class="se"&gt;\ &lt;/span&gt;&lt;span class="nb"&gt;exec&lt;/span&gt;&lt;span class="se"&gt;\ &lt;/span&gt;rspec&lt;span class="se"&gt;\ &lt;/span&gt;&lt;span class="nt"&gt;-f&lt;/span&gt;&lt;span class="se"&gt;\ &lt;/span&gt;QuickfixFormatter
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;:make&lt;/code&gt; to run RSpec&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:cl&lt;/code&gt; to list errors&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:cc#&lt;/code&gt; to jump to error by number (#)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:cn&lt;/code&gt; and &lt;code&gt;:cp&lt;/code&gt; to navigate forward and back through test failures&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Registers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;"add&lt;/code&gt; to delete into the &lt;code&gt;a&lt;/code&gt; register&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"by&lt;/code&gt; to yank into the &lt;code&gt;b&lt;/code&gt; register&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"cp&lt;/code&gt; to paste from the &lt;code&gt;c&lt;/code&gt; register&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:reg&lt;/code&gt; to display all non-empty registers

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;:reg a b c&lt;/code&gt; to filter and display only the &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt;, and &lt;code&gt;c&lt;/code&gt; registers.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"+&lt;/code&gt; to interface with the system clipboard as a register&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Registers can be accessed via &lt;code&gt;Ctrl + r + registerName&lt;/code&gt;, such as &lt;code&gt;Ctrl + r + f&lt;/code&gt; to paste the &lt;code&gt;f&lt;/code&gt; register into the current buffer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Numbered Registers
&lt;/h3&gt;

&lt;p&gt;Numbered registers are handled automatically by Vim, and allow us to access the last 10 deleted/yanked texts. The numbered registers will roll over, such that &lt;code&gt;"0&lt;/code&gt; contains the content of the most recent delete/yank, and &lt;code&gt;"9&lt;/code&gt; contains the content of the oldest delete/yank.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fun Vim Toys
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;⌘ + /&lt;/code&gt; to immediately find that pesky, runaway cursor of yours.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:set showcmd&lt;/code&gt; to display current chain of command keystrokes in lower-right of Vim - great for those of us with short attention spans!&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:help key-notation&lt;/code&gt; opens documentation for Vim's keyboard shortcuts - a huge life-saver!&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:helpgrep SEARCH_TERM&lt;/code&gt; to use &lt;code&gt;grep&lt;/code&gt; to search through all of Vim's help documentation for your search term &lt;/li&gt;
&lt;li&gt;Look up any shortcut or command in any mode with prefixes:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;:help i_^n&lt;/code&gt; to look up what Ctrl+N does in insert mode&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:help c_^n&lt;/code&gt; to look up what Ctrl+N does in command mode&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:help v_^n&lt;/code&gt; to look up what Ctrl+N does in visual mode&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vim</category>
      <category>bash</category>
    </item>
    <item>
      <title>5 Wonderful Javascript Tricks</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Wed, 30 Sep 2020 01:52:45 +0000</pubDate>
      <link>https://dev.to/connoro7/5-wonderful-javascript-tricks-436d</link>
      <guid>https://dev.to/connoro7/5-wonderful-javascript-tricks-436d</guid>
      <description>&lt;h1&gt;
  
  
  Javascript Tricks
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Query Selector
&lt;/h2&gt;

&lt;p&gt;You can get elements through the DOM API with methods like &lt;code&gt;getElementsByClassName&lt;/code&gt; or &lt;code&gt;getElementById&lt;/code&gt;, but these can both be replaced with &lt;code&gt;querySelector&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;querySelector&lt;/code&gt; works like a CSS selector, using a period &lt;code&gt;.&lt;/code&gt; to select classes and pounds &lt;code&gt;#&lt;/code&gt; to select IDs. For example:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;classElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.myClass&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;idElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#myID&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;p&gt;&lt;code&gt;querySelector&lt;/code&gt; is also able to target sub elements, which is not available to &lt;code&gt;getElementById&lt;/code&gt; or &lt;code&gt;getElementsByClassName&lt;/code&gt;. Use the &lt;code&gt;space&lt;/code&gt; syntax to get the direct child, or the &lt;code&gt;caret&lt;/code&gt; &lt;code&gt;&amp;gt;&lt;/code&gt; syntax to get all children.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;querySelectorAll&lt;/code&gt; gets you all of the matches and returns an array of nodes.&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="c1"&gt;// sub elements&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;subElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.myClass &amp;gt; li&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// return multiple elements&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;allDivs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Array Methods
&lt;/h2&gt;

&lt;p&gt;Some array methods are overrated, and some are underrated:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;reduce&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;reduce&lt;/code&gt; is underrated, especially by new developers - it takes a while to understand it's full power. &lt;code&gt;reduce&lt;/code&gt; gives you an accumulator and a value in your callback function, &lt;strong&gt;but the accumulator doesn't have to be a number!&lt;/strong&gt; -- It can be anything: an object, an array, a string,&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Best practice: accumulator value defaults to first element of the object/array, so be sure to specify a default of zero to avoid typeof() errors.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="c1"&gt;// object, [ '123' ]&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;concat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="c1"&gt;// array, [1, 2, 3]&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// string, '123'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;reduce&lt;/code&gt; allows you to very easily convert arrays to hashmaps or objects, build up strings, build up a variation of the original array&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;veggies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;potato&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;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;onion&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;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cucumber&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;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;veggiePrices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;veggies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;v&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="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&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;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;veggiePrices&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// { potato: 1, onion: 2, cucumber: 1 }&lt;/span&gt;
&lt;span class="c1"&gt;// Creates {name: price} object&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;reduce&lt;/code&gt; is powerful enough to do the job of &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;sort&lt;/code&gt;, and &lt;code&gt;filter&lt;/code&gt; &lt;strong&gt;if you write the right callback function.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Destructuring Tricks
&lt;/h2&gt;

&lt;p&gt;Destructuring is (almost) unique to Javascript, and allows you to pull out one (or more) properties from an object, and is heavily used in frameworks such as Angular or React.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;veggie&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;potato&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;1&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;veggie&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;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Destructuring is also used anytime that you're importing libraries:&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;debounce&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lodash&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Destructuring can also be used as a parameter to a function:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;veggie&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;potato&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;1&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;printPrice&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;price&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;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;printPrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;veggie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Destructuring can also be nested, going multiple layers deep into an object:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;veggiePrices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;potatoes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;red&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;gold&lt;/span&gt;&lt;span class="p"&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;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;veggiePrices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;potatoes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;red&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;red&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Destructuring can also be used directly after writing an array method. For example, if you want to sort an array and then pull out the first item, you can easily do that with destructuring&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;first&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sort&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;first&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Promise Tips
&lt;/h2&gt;

&lt;p&gt;Promises are asynchronous because they run in the background relative to the code you see on the screen.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://google.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://facebook.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://instagram.com&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;p&gt;Promises can be treated like any other object and store them in data structures.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;URLs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://google.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://facebook.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://instagram.com&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;p&gt;You can use the map function to create an array of promises:&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="c1"&gt;// OK Practice:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;requests&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;URLs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But do we want the promises to run at the same time or one after the other?&lt;/p&gt;

&lt;p&gt;To run them at the same time, use the &lt;code&gt;Promise.all()&lt;/code&gt; function. This ties all of the promises together, such that &lt;strong&gt;the array resolves after all of the promises resolve&lt;/strong&gt;. The result is an array of the results, &lt;strong&gt;some of which may be failures&lt;/strong&gt;, so this will also handle your errors.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;responses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want the promises to run one after another, you need to be careful!&lt;/p&gt;

&lt;p&gt;You can use &lt;code&gt;async await&lt;/code&gt;, but keep in mind your &lt;code&gt;awaits&lt;/code&gt; need to be &lt;strong&gt;inside&lt;/strong&gt; an &lt;code&gt;async&lt;/code&gt; function.&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="c1"&gt;// Better Practice - Make it an async IIFE!&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;requests&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;URLs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;responses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;requests&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;You also can't run an &lt;code&gt;await&lt;/code&gt; inside an array method! So if you tried to &lt;code&gt;map()&lt;/code&gt; by using an &lt;code&gt;await&lt;/code&gt; inside of a &lt;code&gt;map()&lt;/code&gt; or &lt;code&gt;forEach()&lt;/code&gt;, it's not going to work.&lt;/p&gt;

&lt;p&gt;To fix this, you can write &lt;code&gt;await&lt;/code&gt; inside a &lt;code&gt;map&lt;/code&gt; function, you just need to make it an &lt;code&gt;async map&lt;/code&gt; function.&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="c1"&gt;// !!! Won't work !!!&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;requests&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;URLs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;})()&lt;/span&gt;

&lt;span class="c1"&gt;// !!! Works !!!&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;requests&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;URLs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;})()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In order to get this to work, you can to use a &lt;code&gt;for(){}&lt;/code&gt; or &lt;code&gt;forOf(){}&lt;/code&gt; loop.&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="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;responses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
  &lt;span class="k"&gt;for&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;url&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;URLs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Error Handling
&lt;/h2&gt;

&lt;p&gt;Error handling is made super easy with a &lt;code&gt;try{} catch(){}&lt;/code&gt; block.&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;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// code that might throw Error&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// what do if Error is thrown&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also handle errors with a &lt;code&gt;.catch()&lt;/code&gt; on a promise. For example, when using a &lt;code&gt;.then()&lt;/code&gt; chain, you can append a &lt;code&gt;.catch()&lt;/code&gt; to handle errors that might have occured along the way.&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="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://google.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;got json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;json failed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;request failed&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;p&gt;If using &lt;code&gt;async await&lt;/code&gt; on the above example, we can either throw an &lt;code&gt;await&lt;/code&gt; in a &lt;code&gt;try catch&lt;/code&gt; block, &lt;strong&gt;OR&lt;/strong&gt; we can append a &lt;code&gt;.catch()&lt;/code&gt; on the end of the &lt;code&gt;await&lt;/code&gt; syntax. This is much cleaner than the above example, because we're combining traditional promise syntax with &lt;code&gt;await&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you have the same error handler for both &lt;code&gt;await&lt;/code&gt;, you can just wrap both &lt;code&gt;await&lt;/code&gt; in a &lt;code&gt;try&lt;/code&gt; block, and handle both errors in the corresponding &lt;code&gt;catch&lt;/code&gt; block.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&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;got json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
    </item>
    <item>
      <title>`wget` God Mode</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 07:19:41 +0000</pubDate>
      <link>https://dev.to/connoro7/wget-god-mode-441f</link>
      <guid>https://dev.to/connoro7/wget-god-mode-441f</guid>
      <description>&lt;p&gt;If you're anything like me, you like to download things. And sometimes, it's too cumbersome to &lt;code&gt;right click &amp;gt; Save As...&lt;/code&gt; each item on a webpage. The solution to your problem sits in your terminal: the &lt;code&gt;wget&lt;/code&gt; utility. If we add a few options, &lt;code&gt;wget&lt;/code&gt; becomes a beast of a website downloader, and is capable of pulling an entire site for offline viewing, include all of the linked files.&lt;/p&gt;

&lt;p&gt;All you have to do is copy &amp;amp; paste your desired URL into the following terminal command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;wget &lt;span class="nt"&gt;-mkEpnp&lt;/span&gt; WEBPAGE-URL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The options &lt;code&gt;-mkEpnp&lt;/code&gt; are specified below (pulled from the &lt;code&gt;man&lt;/code&gt; page):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-m&lt;/code&gt; (aka &lt;code&gt;--mirror&lt;/code&gt;): Turns on options suitable for mirroring. This option turns on recursion and time-stamping, sets infinite recursion depth and keeps FTP directory listings. It is currently equivalent to &lt;code&gt;-r -N -l inf --no-remove-listing&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-k&lt;/code&gt; (aka &lt;code&gt;--convert-links&lt;/code&gt;): Converts links for offline viewing.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-E&lt;/code&gt; (aka &lt;code&gt;--adjust-extension&lt;/code&gt;): Adds proper filename extensions to downloaded files.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-p&lt;/code&gt; (aka &lt;code&gt;--page-requisites&lt;/code&gt;): Downloads images, sounds, stylesheets, and other required files for proper offline site rendering.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-np&lt;/code&gt; (aka &lt;code&gt;--no-parent&lt;/code&gt;): Prevents retrieval of the parent directory. Guarantees that only files below a certain hierarchy will be downloaded.&lt;/p&gt;

&lt;p&gt;More fun &lt;code&gt;wget&lt;/code&gt; options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nt"&gt;--execute&lt;/span&gt; &lt;span class="nv"&gt;robots&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;off &lt;span class="c"&gt;#ignore robots.txt&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nt"&gt;--wait&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;30 &lt;span class="c"&gt;#be gentle, wait between fetch requests&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nt"&gt;--random-wait&lt;/span&gt; &lt;span class="c"&gt;#waits for a random amount of time before fetch requests&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nt"&gt;--user-agent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Mozilla &lt;span class="c"&gt;#sends a mock user agent with each request&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Happy downloading! Oh and... I can't be held responsible if you suddenly find yourself investing in a home server setup, NAS drives, or the like.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>tips</category>
    </item>
    <item>
      <title>Regular Expressions in 1 Minute</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 07:02:54 +0000</pubDate>
      <link>https://dev.to/connoro7/regular-expressions-in-1-minute-57f5</link>
      <guid>https://dev.to/connoro7/regular-expressions-in-1-minute-57f5</guid>
      <description>&lt;h2&gt;
  
  
  Syntax
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Sets the regex query for "hello":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/hello/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Sets the regex query to be case-insensitive:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/hello/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Sets the regex query as a global search, searching for all instances, not just the first:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/hello/g&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Special Characters
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Literal Characters
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Matches with any string containing &lt;em&gt;exactly&lt;/em&gt; &lt;code&gt;hello&lt;/code&gt;, and is &lt;em&gt;case-sensitive&lt;/em&gt;:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/hello/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches with any string containing &lt;code&gt;hello&lt;/code&gt;, and is &lt;em&gt;case-insensitive&lt;/em&gt;:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/hello/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Meta-character Symbols
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;^&lt;/code&gt; "Must start with"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches with "Hello World":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^h/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches with "Hello World":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^hel/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;$&lt;/code&gt; "Must end with"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches with "Hello World":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/d$/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches with "Hello World":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/ world$/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;^...$&lt;/code&gt; "Must begin with and end with"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Not a match with "Hello World", only Matches "Hello":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^hello$/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;.&lt;/code&gt; "Matches any ONE character"
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;Basically a wild card but for ONLY ONE character, try changing &lt;code&gt;str&lt;/code&gt; to "Hbllo World"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Matches with "Hello" or "Hbllo" or "Hwllo" or "H7llo" or "H@llo", etc.:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/h.llo/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;*&lt;/code&gt; "Matches any character 0 or more times"
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;This is a true wild card (also works for zero characters!)"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Matches with "hello" or "heeeello" or "heebbllo" or "h52340978562llo" or "H!@#\$&amp;amp;^!%#*@%!%llo", etc.:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/h&lt;/span&gt;&lt;span class="se"&gt;\*&lt;/span&gt;&lt;span class="sr"&gt;llo/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;?&lt;/code&gt; "Optional character"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches with "hello" or "hallo" or "hullo" or "hllo":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/ha&lt;/span&gt;&lt;span class="se"&gt;?&lt;/span&gt;&lt;span class="sr"&gt;e&lt;/span&gt;&lt;span class="se"&gt;?&lt;/span&gt;&lt;span class="sr"&gt;u&lt;/span&gt;&lt;span class="se"&gt;?&lt;/span&gt;&lt;span class="sr"&gt;llo/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;\&lt;/code&gt; "Escape character"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Not a match with "Hello", only Matches "Hello?":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/hello&lt;/span&gt;&lt;span class="se"&gt;\?&lt;/span&gt;&lt;span class="sr"&gt;/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;[ ]&lt;/code&gt; Brackets Character sets
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches "hello" or "hallo", but not "hllo" or anything else:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/h&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;ae&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;llo/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches "Hello" or "Zello":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;HZ&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;ello/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Not a match; &lt;code&gt;[^HZ]&lt;/code&gt; = anything EXCEPT H or Z":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[^&lt;/span&gt;&lt;span class="sr"&gt;HZ&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;ello/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches ANY uppercase letter:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;A-Z&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;ello/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches ANY lowercase letter:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;a-z&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;ello/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches ANY letter with any case:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;A-Za-z&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;ello/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Only matches a number like "1ello" or "9ello", NOTE: "1234ello" also matches because it's just looking for a single digit before "ello":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;0-9&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;ello/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Only matches a double digit number like "69ello" or "420ello", NOTE: still only looks for 2 digits before "ello":&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;0-9&lt;/span&gt;&lt;span class="se"&gt;][&lt;/span&gt;&lt;span class="sr"&gt;0-9&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;ello/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;{ }&lt;/code&gt; Braces Quantifiers
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches if &lt;code&gt;l&lt;/code&gt; occurs exactly {m} amount of times:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/Hel&lt;/span&gt;&lt;span class="se"&gt;{2}&lt;/span&gt;&lt;span class="sr"&gt;o/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches if &lt;code&gt;l&lt;/code&gt; occurs 2-4 times:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/Hel&lt;/span&gt;&lt;span class="se"&gt;{2,4}&lt;/span&gt;&lt;span class="sr"&gt;o/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches if &lt;code&gt;l&lt;/code&gt; occurs at least 2 times:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/Hel&lt;/span&gt;&lt;span class="se"&gt;{2,}&lt;/span&gt;&lt;span class="sr"&gt;o/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;( )&lt;/code&gt; Parentheses Grouping
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches as long as it finds &lt;code&gt;Xp&lt;/code&gt; repeating 3 times:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;([&lt;/span&gt;&lt;span class="sr"&gt;0-9&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;p&lt;/span&gt;&lt;span class="se"&gt;){3}&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches only if it finds &lt;code&gt;Xp&lt;/code&gt; repeating &lt;em&gt;exactly&lt;/em&gt; 3 times:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^&lt;/span&gt;&lt;span class="se"&gt;([&lt;/span&gt;&lt;span class="sr"&gt;0-9&lt;/span&gt;&lt;span class="se"&gt;]){3}&lt;/span&gt;&lt;span class="sr"&gt;$/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Shorthand Character Classes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;\w&lt;/code&gt; "Word Character"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches for any letter, number, or underscore &lt;code&gt;_&lt;/code&gt;, but no other symbols or characters:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\w&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;+&lt;/code&gt; "One or More"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches for one or more letter, number, or underscore &lt;code&gt;_&lt;/code&gt;:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\w&lt;/span&gt;&lt;span class="sr"&gt;+/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;\W&lt;/code&gt; "Non-Word Character"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches only if it finds something that's NOT a letter, number, or underscore:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\W&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;\d&lt;/code&gt; "Digit Character"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches for a single digit:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\d&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matches for one or more digits:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\d&lt;/span&gt;&lt;span class="sr"&gt;+/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;\D&lt;/code&gt; "Non-Digit Character"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches for any non-digit character:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\D&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;\s&lt;/code&gt; "Whitespace Character"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches for a space, tab, or similar whitespace characters:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;\S&lt;/code&gt; "Non-Whitespace Character"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches for anything other than a space, tab, or similar whitespace characters:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\S&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;\b&lt;/code&gt; "Word Boundary"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches for words that have a word boundary at that position, so that you avoid matching strings that contain a word inside of another word, like with Hell &amp;amp; Hello or Beetle &amp;amp; Beetlejuice:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/Hell&lt;/span&gt;&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="sr"&gt;/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Assertions
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;x(?=y)&lt;/code&gt; "x followed by y"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches &lt;code&gt;x&lt;/code&gt; only if followed by &lt;code&gt;y&lt;/code&gt;:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/x&lt;/span&gt;&lt;span class="se"&gt;(?=&lt;/span&gt;&lt;span class="sr"&gt;y&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;x(?!y)&lt;/code&gt; "x not followed by y"
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Matches &lt;code&gt;x&lt;/code&gt; only if NOT followed by &lt;code&gt;y&lt;/code&gt;:&lt;/strong&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="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/x&lt;/span&gt;&lt;span class="se"&gt;(?!&lt;/span&gt;&lt;span class="sr"&gt;y&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;/i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reference: Strings we've used to match in this article
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello World&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;3p3p3p&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, welcome to Hell&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;asgkljhalwxqflife&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>regex</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Hosting an Application on Heroku in 7 Steps</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 06:59:50 +0000</pubDate>
      <link>https://dev.to/connoro7/hosting-an-application-on-heroku-in-7-steps-3h9k</link>
      <guid>https://dev.to/connoro7/hosting-an-application-on-heroku-in-7-steps-3h9k</guid>
      <description>&lt;p&gt;Before we start, go to &lt;a href="//Heroku.com"&gt;Heroku.com&lt;/a&gt; and log in or sign up for an account (if you don't already have one).&lt;/p&gt;

&lt;p&gt;You will also need the Heroku CLI tool, available from &lt;a href="https://devcenter.heroku.com/articles/heroku-cli"&gt;Heroku Dev Center&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Heroku uses Git for source control, so make sure you have that installed as well. Git install documentation can be &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"&gt;found here&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Check that everything is installed&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;heroku &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Log in through the terminal within your project directory&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;heroku login
&lt;span class="c"&gt;# Then enter your email and password for Heroku&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Initalize a git repository&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Make sure to create a &lt;code&gt;.gitignore&lt;/code&gt; containing anything that you don't want pushed to Heroku: &lt;code&gt;node_modules&lt;/code&gt;, reference docs, sandbox files, etc.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git init
&lt;span class="nv"&gt;$ &lt;/span&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s1"&gt;'Initial commit'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Initialize the Heroku container&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;heroku create
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Set Heroku as Remote Repository&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Go to your Heroku dashboard and open up the new Heroku container.&lt;/p&gt;

&lt;p&gt;Scroll down to "&lt;em&gt;Create a new Git repository&lt;/em&gt;" and grab the command to add this container as our remote repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;heroku git:remote &lt;span class="nt"&gt;-a&lt;/span&gt; CONTAINER-NAME-12345
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then paste that command into your project directory terminal.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Push to &lt;code&gt;master&lt;/code&gt; branch of Heroku App&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push heroku master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;View Your New Application&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Go to the URL provided when pushing to &lt;code&gt;master&lt;/code&gt; or just type &lt;code&gt;heroku open&lt;/code&gt; into the project terminal.&lt;/p&gt;

&lt;p&gt;A Few Notes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In &lt;code&gt;index.js&lt;/code&gt;, we've set &lt;code&gt;const PORT = process.env.PORT || 5000&lt;/code&gt; - Heroku will be using &lt;code&gt;process.env.PORT&lt;/code&gt; and not &lt;code&gt;PORT = 5000&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Make sure that you have a &lt;code&gt;start&lt;/code&gt; script in &lt;code&gt;package.json&lt;/code&gt; - &lt;code&gt;"start": "node index"&lt;/code&gt;. Change &lt;code&gt;index&lt;/code&gt; to whatever entrypoint you're using if necessary.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>heroku</category>
      <category>git</category>
      <category>github</category>
      <category>json</category>
    </item>
    <item>
      <title>Merging Local Git Branches</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 06:53:21 +0000</pubDate>
      <link>https://dev.to/connoro7/merging-local-git-branches-4bc5</link>
      <guid>https://dev.to/connoro7/merging-local-git-branches-4bc5</guid>
      <description>&lt;h2&gt;
  
  
  Using Merge
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="nb"&gt;test
&lt;/span&gt;git pull
git checkout master
git pull
git merge &lt;span class="nt"&gt;--no-ff&lt;/span&gt; &lt;span class="nt"&gt;--no-commit&lt;/span&gt; &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method will test your merge before a full commit, and will avoid a fast-forward commit by &lt;code&gt;--no-ff&lt;/code&gt;,&lt;/p&gt;

&lt;p&gt;If a conflict is encountered, we can run &lt;code&gt;git status&lt;/code&gt; to check details about the conflicts and try to solve&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we solve the conflicts, or if there is no conflict, we commit and push them&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s1"&gt;'merge test branch'&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But this way will lose the changes history logged in &lt;code&gt;test&lt;/code&gt; branch, and it would make &lt;code&gt;master&lt;/code&gt; branch difficult for other developers to understand the history of the project.&lt;/p&gt;

&lt;p&gt;So the best method is we have to use &lt;code&gt;rebase&lt;/code&gt; instead of &lt;code&gt;merge&lt;/code&gt; (suppose, when in this time, we have solved the branch conflicts)...&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Rebase
&lt;/h2&gt;

&lt;p&gt;Following is one simple sample, for advanced operations, please refer to &lt;a href="http://git-scm.com/book/en/v2/Git-Branching-Rebasing"&gt;http://git-scm.com/book/en/v2/Git-Branching-Rebasing&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout master
git pull
git checkout &lt;span class="nb"&gt;test
&lt;/span&gt;git pull
git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; master
git checkout master
git merge &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yep, when you have uppers done, all the Test branch's commits will be moved onto the head of Master branch. The major benefit of rebasing is that you get a linear and much cleaner project history.&lt;/p&gt;

&lt;h2&gt;
  
  
  ❗️ CAUTION
&lt;/h2&gt;

&lt;p&gt;The only thing you need to avoid is: &lt;strong&gt;never use &lt;code&gt;rebase&lt;/code&gt; on public branch, like &lt;code&gt;master&lt;/code&gt; branch.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In other words, if you're ever about to perform an operation like the following, please be absolutely sure you know what you're doing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout master
git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more details, please see this article from Atlassian on &lt;a href="https://www.atlassian.com/git/tutorials/merging-vs-rebasing/the-golden-rule-of-rebasing"&gt;The Golden Rule of Rebasing&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>Error Handling With Fetch</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 06:47:38 +0000</pubDate>
      <link>https://dev.to/connoro7/error-handling-with-fetch-1caj</link>
      <guid>https://dev.to/connoro7/error-handling-with-fetch-1caj</guid>
      <description>&lt;p&gt;Error handling with fetch is a bit different than with something like Axios or jQuery. If there is an http error, it will not fire off &lt;code&gt;.catch&lt;/code&gt; automatically. You have to check the response and throw an error yourself. Here is an example:&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="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/todo/1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&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="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I would suggest creating a separate function for error handling:&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="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;handleErrors&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&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="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/todo/1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handleErrors&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>fetch</category>
      <category>api</category>
      <category>javascript</category>
      <category>http</category>
    </item>
    <item>
      <title>Debugging Pattern: "ControllerID"</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 06:40:36 +0000</pubDate>
      <link>https://dev.to/connoro7/debugging-pattern-controllerid-49nl</link>
      <guid>https://dev.to/connoro7/debugging-pattern-controllerid-49nl</guid>
      <description>&lt;p&gt;This debugging pattern was shared with me by a close friend (who also happens to be a very skilled developer). This is an incredibly useful and time-saving debugging pattern when working with modules or controllers that need to be instantiated only once per instance. &lt;/p&gt;

&lt;p&gt;The idea behind this pattern is to apply a controller ID to each instance of a given module/controller in order to keep track of the number of times it is being instantiated.&lt;/p&gt;

&lt;p&gt;To do this, create a global variable that we will increment:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Then, assign a variable within the module that will be assigned a controller ID, and increment the controller count:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const Controller = () =&amp;gt; {
    const controllerID = ++controllerCount
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, add the following code to your tests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log({data, controllerID})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create Custom DOM &amp;amp; Window Tests
&lt;/h2&gt;

&lt;p&gt;To make information that would normally be buried deep within the DOM, we can create our own tests to make things more readily available.&lt;/p&gt;

&lt;p&gt;Just add this pattern to the correct scope:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window.test = { module1, module2, ... }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>debugging</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Sass Setup and Basic Use</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 06:34:06 +0000</pubDate>
      <link>https://dev.to/connoro7/sass-setup-and-basic-use-2830</link>
      <guid>https://dev.to/connoro7/sass-setup-and-basic-use-2830</guid>
      <description>&lt;h2&gt;
  
  
  How to Set Up Sass Using NPM
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In main project folder, (outside of dist folder if using one), create a folder called &lt;code&gt;scss&lt;/code&gt;, and &lt;code&gt;main.scss&lt;/code&gt; file within the new &lt;code&gt;scss&lt;/code&gt; folder.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Right click up-one-level folder from dist and open in terminal (i.e. in terminal, go to your dist folder, then do '$ cd ..')&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In terminal, do &lt;code&gt;$ npm init&lt;/code&gt; to create a package.json file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter package name and details.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In terminal, do &lt;code&gt;$ npm i node-sass&lt;/code&gt; to initialize sass.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open &lt;code&gt;package.json&lt;/code&gt; file, change:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&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;"test"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"echo &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Error: no test specified&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; &amp;amp;&amp;amp; exit 1"&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to:&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;"sass"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node-sass -w scss/ -o dist/css/ --recursive"&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; File directories in the script must match your folder layout!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, if you don't have a &lt;code&gt;dist/&lt;/code&gt; folder, just use &lt;code&gt;... -o css/ --recursive&lt;/code&gt; instead.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Make sure to point your stylesheet correctly in your html code!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, if using &lt;code&gt;main.scss&lt;/code&gt; (and thus &lt;code&gt;main.css&lt;/code&gt;), use: &lt;code&gt;&amp;lt;link rel="stylesheet" href="css/main.css"&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In your terminal, start the Sass script with: &lt;code&gt;npm run sass&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In &lt;code&gt;main.scss&lt;/code&gt;, start writing your sass.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Do not edit your &lt;code&gt;main.css&lt;/code&gt; file. The Sass compiler will overwrite any changes you might make, so be sure to write your CSS directly to &lt;code&gt;main.scss&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>css</category>
      <category>sass</category>
    </item>
    <item>
      <title>REST APIs &amp; HTTP Requests</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 06:27:13 +0000</pubDate>
      <link>https://dev.to/connoro7/rest-apis-http-requests-2efl</link>
      <guid>https://dev.to/connoro7/rest-apis-http-requests-2efl</guid>
      <description>&lt;ul&gt;
&lt;li&gt;
REST APIs &amp;amp; HTTP Requests

&lt;ul&gt;
&lt;li&gt;What is an API?&lt;/li&gt;
&lt;li&gt;What is REST?&lt;/li&gt;
&lt;li&gt;Types of Requests&lt;/li&gt;
&lt;li&gt;API Endpoints&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is an API?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;API stands for "Application Programming Interface"&lt;/li&gt;
&lt;li&gt;Contract provided by one piece of software to another&lt;/li&gt;
&lt;li&gt;Structured request and response&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is REST?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;REST stands for "Representational State Transfer"&lt;/li&gt;
&lt;li&gt;Architectural style for designing networked applications&lt;/li&gt;
&lt;li&gt;Relies on a stateless, client-server protocol, almost always HTTP&lt;/li&gt;
&lt;li&gt;Treats server objects as resources that can be created or destroyed&lt;/li&gt;
&lt;li&gt;Can be used by virtually any programming language&lt;/li&gt;
&lt;li&gt;All APIs have their own rules and structure&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Types of Requests
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GET&lt;/strong&gt;: Retrieve data from a specified resource&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;POST&lt;/strong&gt;: Submit data to be process to a specified resource&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PUT&lt;/strong&gt;: Update a specified resource&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DELETE&lt;/strong&gt;: Delete a specified resource&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HEAD&lt;/strong&gt;: Same as get but does not return a body (only returns header)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OPTIONS&lt;/strong&gt;: Returns the supported HTTP methods&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PATCH&lt;/strong&gt;: Update partial resources (similar to PUT)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  API Endpoints
&lt;/h2&gt;

&lt;p&gt;Endpoints are URLs that you can access to do certain things:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;URL&lt;/th&gt;
&lt;th&gt;Function&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;&lt;a href="https://website.com/api/users"&gt;https://website.com/api/users&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Get all users&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;&lt;a href="https://website.com/api/users/1"&gt;https://website.com/api/users/1&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Get single user&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;&lt;a href="https://website.com/api/users"&gt;https://website.com/api/users&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Add user&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PUT&lt;/td&gt;
&lt;td&gt;&lt;a href="https://website.com/api/users/1"&gt;https://website.com/api/users/1&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Update user&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;&lt;a href="https://website.com/api/users/1"&gt;https://website.com/api/users/1&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Delete user&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>rest</category>
      <category>api</category>
      <category>http</category>
    </item>
    <item>
      <title>Intro to Ajax &amp; XHR</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 06:24:37 +0000</pubDate>
      <link>https://dev.to/connoro7/intro-to-ajax-xhr-5g30</link>
      <guid>https://dev.to/connoro7/intro-to-ajax-xhr-5g30</guid>
      <description>&lt;ul&gt;
&lt;li&gt;
Intro to Ajax &amp;amp; XHR

&lt;ul&gt;
&lt;li&gt;Synchronous Code&lt;/li&gt;
&lt;li&gt;Asynchronous Code&lt;/li&gt;
&lt;li&gt;Most Async code you work with will be part of an API or Library&lt;/li&gt;
&lt;li&gt;A few ways to work with Async code&lt;/li&gt;
&lt;li&gt;Ajax "Asynchronous Javascript &amp;amp; XML"&lt;/li&gt;
&lt;li&gt;XmlHttpRequest XHR Object&lt;/li&gt;
&lt;li&gt;Libraries and Other Methods&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Synchronous Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;posts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;loadPostsSync&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;// ... wait til posts are fetched&lt;/span&gt;
&lt;span class="c1"&gt;// ... do something with posts&lt;/span&gt;

&lt;span class="nx"&gt;doTheNextThing&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// Has to wait until posts load&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Asynchronous Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;loadPostsAsync&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="c1"&gt;// ... wait til posts are fetched&lt;/span&gt;
  &lt;span class="c1"&gt;// ... do something with posts&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nx"&gt;doTheNextThing&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// Doesn't have to wait until posts load&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Most Async code you work with will be part of an API or Library
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;XMLHttpRequest &amp;amp; Fetch&lt;/li&gt;
&lt;li&gt;jQuery Ajax, Axios, other HTTP Libraries&lt;/li&gt;
&lt;li&gt;Node.js fs (filesystem) module&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  A few ways to work with Async code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Callbacks&lt;/li&gt;
&lt;li&gt;Promises (ES6/ES2015)&lt;/li&gt;
&lt;li&gt;Async/Await&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Ajax ("Asynchronous Javascript &amp;amp; XML")
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Set of web technologies&lt;/li&gt;
&lt;li&gt;Send &amp;amp; receive data asynchronously&lt;/li&gt;
&lt;li&gt;Does not interfere with current page&lt;/li&gt;
&lt;li&gt;JSON has replaced XML for the most part

&lt;ul&gt;
&lt;li&gt;Ajax engine sits between the server and the client as a middleman&lt;/li&gt;
&lt;li&gt;Client sends JS calls to Ajax Engine&lt;/li&gt;
&lt;li&gt;Ajax Engine returns HTML response to client&lt;/li&gt;
&lt;li&gt;Ajax Engine sends XmlHttpRequest to Server&lt;/li&gt;
&lt;li&gt;Server returns XML/JSON&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Makes async requests in the background&lt;/li&gt;
&lt;li&gt;No page reload/refresh needed&lt;/li&gt;
&lt;li&gt;Fetches data&lt;/li&gt;
&lt;li&gt;Very interactive&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  XmlHttpRequest (XHR) Object
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Core tech in Ajax&lt;/li&gt;
&lt;li&gt;API in the form of an object&lt;/li&gt;
&lt;li&gt;Provided by the browser's JS environment&lt;/li&gt;
&lt;li&gt;Methods transfer data between client &amp;amp; server&lt;/li&gt;
&lt;li&gt;Can be used with other protocols than HTTP&lt;/li&gt;
&lt;li&gt;Can work with data other than XML (JSON, plain text)

&lt;ul&gt;
&lt;li&gt;*Nowadays we mostly just work with JSON data&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Libraries and Other Methods
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fetch API (part of vanilla JS)&lt;/li&gt;
&lt;li&gt;Axios (external library)&lt;/li&gt;
&lt;li&gt;Superagent (external library)&lt;/li&gt;
&lt;li&gt;jQuery (not recommended if just using it for Ajax. jQuery is a complete DOM manipulation library, which is very bloated for just Ajax)&lt;/li&gt;
&lt;li&gt;Node HTTP (good if using Node.js)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>http</category>
      <category>xhr</category>
      <category>ajax</category>
    </item>
    <item>
      <title>Github Contributing.md Markdown Template</title>
      <dc:creator>Connor Dillon</dc:creator>
      <pubDate>Fri, 31 Jul 2020 06:17:19 +0000</pubDate>
      <link>https://dev.to/connoro7/github-contributing-md-markdown-template-1h6k</link>
      <guid>https://dev.to/connoro7/github-contributing-md-markdown-template-1h6k</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;The following content is a boilerplate/template for Contributing guidelines that you can use for your next (or current!) development projects.&lt;br&gt;
If you would like to use this, please &lt;a href="https://gist.github.com/connoro7/7418012da1d8942a8f6f1f069ae6407b"&gt;grab the raw markdown file from this gist&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  Contributing
&lt;/h1&gt;

&lt;p&gt;When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change. &lt;/p&gt;

&lt;p&gt;Please note we have a code of conduct, please follow it in all your interactions with the project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pull Request Process
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Ensure any install or build dependencies are removed before the end of the layer when doing a build.&lt;/li&gt;
&lt;li&gt;Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.&lt;/li&gt;
&lt;li&gt;Increase the version numbers in any examples files and the &lt;code&gt;README.md&lt;/code&gt; to the new version that this pull request would represent. The versioning scheme we use is &lt;a href="http://semver.org/"&gt;SemVer&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Code of Conduct
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Our Pledge
&lt;/h3&gt;

&lt;p&gt;In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Our Standards
&lt;/h3&gt;

&lt;p&gt;Examples of behavior that contributes to creating a positive environment include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using welcoming and inclusive language&lt;/li&gt;
&lt;li&gt;Being respectful of differing viewpoints and experiences&lt;/li&gt;
&lt;li&gt;Gracefully accepting constructive criticism&lt;/li&gt;
&lt;li&gt;Focusing on what is best for the community&lt;/li&gt;
&lt;li&gt;Showing empathy towards other community members&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples of unacceptable behavior by participants include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The use of sexualized language or imagery and unwelcome sexual attention or advances&lt;/li&gt;
&lt;li&gt;Trolling, insulting/derogatory comments, and personal or political attacks&lt;/li&gt;
&lt;li&gt;Public or private harassment&lt;/li&gt;
&lt;li&gt;Publishing others' private information, such as a physical or electronic address, without explicit permission&lt;/li&gt;
&lt;li&gt;Other conduct which could reasonably be considered inappropriate in a professional setting&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Our Responsibilities
&lt;/h3&gt;

&lt;p&gt;Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.&lt;/p&gt;

&lt;p&gt;Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scope
&lt;/h3&gt;

&lt;p&gt;This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enforcement
&lt;/h3&gt;

&lt;p&gt;Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the &lt;a href="//mailto:contact@your-email-here.com"&gt;project team here&lt;/a&gt;. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.&lt;/p&gt;

&lt;p&gt;Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.&lt;/p&gt;

&lt;h3&gt;
  
  
  Attribution
&lt;/h3&gt;

&lt;p&gt;This Code of Conduct is adapted from the &lt;a href="http://contributor-covenant.org"&gt;Contributor Covenant&lt;/a&gt;, version 1.4,&lt;br&gt;
available &lt;a href="http://contributor-covenant.org/version/1/4/"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>template</category>
    </item>
  </channel>
</rss>
