<?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: Carl Saunders</title>
    <description>The latest articles on DEV Community by Carl Saunders (@deadlybyte).</description>
    <link>https://dev.to/deadlybyte</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%2F88500%2F56020204-0ed0-4720-94c8-4e9d8a1f4d31.jpeg</url>
      <title>DEV Community: Carl Saunders</title>
      <link>https://dev.to/deadlybyte</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/deadlybyte"/>
    <language>en</language>
    <item>
      <title>🧠 Level Up Your CSS Flexbox Skills with Fun Games 🎮</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Wed, 28 Jun 2023 14:36:00 +0000</pubDate>
      <link>https://dev.to/deadlybyte/level-up-your-css-flexbox-skills-with-fun-games-22j</link>
      <guid>https://dev.to/deadlybyte/level-up-your-css-flexbox-skills-with-fun-games-22j</guid>
      <description>&lt;p&gt;CSS Flexbox can pose a challenge for developers looking to enhance their layout skills, regardless of their experience level. This was particularly evident for me as I delved into Flexbox while working on a React Native project.&lt;/p&gt;

&lt;p&gt;Traditional learning methods may not always offer the most engaging or effective way to master this concept. However, there is a fun and interactive way to master CSS Flexbox, Games! 🎮&lt;/p&gt;

&lt;p&gt;Below is a selection of websites that offer games specifically designed to teach and reinforce your understanding of CSS Flexbox concepts. So let's dive in and level up your skills! 🇱🇻🇱⬆️&lt;/p&gt;

&lt;h2&gt;
  
  
  Flexbox Froggy
&lt;/h2&gt;

&lt;p&gt;Flexbox Froggy is an excellent starting point for beginners. The game presents a series of challenges where you need to position the frogs using CSS Flexbox properties. Each level introduces new concepts and gradually increases in difficulty. You'll learn about aligning items, ordering, and distributing space. The game provides a visual representation of the flex container and its items, making it easy to understand and apply Flexbox principles.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6csw2vq6bm2otd29nw4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6csw2vq6bm2otd29nw4e.png" alt="Learn CSS Flexbox using Flexbox Froggy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flexboxfroggy.com" rel="noopener noreferrer"&gt;Play Flexbox Froggy&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Flexbox Defense
&lt;/h2&gt;

&lt;p&gt;Flexbox Defense combines the excitement of tower defense games with CSS Flexbox learning. In this game, you defend your castle by strategically placing towers along a path using Flexbox properties. Each tower represents a flex item, and you must position them correctly to repel the attacking enemies. Flexbox Defense reinforces your understanding of Flexbox by challenging you to think about layout and alignment in a dynamic and engaging way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbe81k5foa3jirrtmhrxp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbe81k5foa3jirrtmhrxp.png" alt="Learn CSS Flexbox using Flexbox Defense"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flexboxdefense.com" rel="noopener noreferrer"&gt;Play Flexbox Defense&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CSS Diner
&lt;/h2&gt;

&lt;p&gt;Although not exclusively focused on Flexbox, CSS Diner is a game worth mentioning for its coverage of CSS layout in general. Through a series of restaurant-themed challenges, you'll learn CSS selectors, properties, and, of course, Flexbox. The game provides a hands-on experience for manipulating HTML elements' styles and is an excellent resource to solidify your understanding of Flexbox alongside other CSS layout techniques.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcy5aa7hheta25x3odncs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcy5aa7hheta25x3odncs.png" alt="Learn CSS Flexbox via CSS Diner"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flukeout.github.io" rel="noopener noreferrer"&gt;Play CSS Diner&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Flexbox Resources
&lt;/h2&gt;

&lt;p&gt;In addition to the CSS Flexbox games mentioned above, here are some additional resources to further support your learning journey.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox" rel="noopener noreferrer"&gt;MDN Web Docs - CSS Flexbox Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jonitrythall.com/flexbox-cheatsheet" rel="noopener noreferrer"&gt;Flexbox Cheatsheet by Joni Trythall&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jonitrythall.com/assets/flexboxfieldguide.pdf" rel="noopener noreferrer"&gt;A Field Guide to Flexbox - Free PDF from Joni Trythall&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox" rel="noopener noreferrer"&gt;CSS Tricks - A Guide to Flexbox&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thought 🤔
&lt;/h2&gt;

&lt;p&gt;Remember learning CSS Flexbox doesn't have to be boring or overwhelming. These games provide an interactive and enjoyable way to grasp the Flexbox concepts and apply them practically. Whether you prefer visual challenges, tower defense battles or coding puzzles, there's a game out there to suit your learning style. Embrace the gamified approach, have fun, and watch your CSS Flexbox skills soar to next level.&lt;/p&gt;

</description>
      <category>css</category>
      <category>flexbox</category>
      <category>webdesign</category>
    </item>
    <item>
      <title>Working with GeoJSON 🗺️ and VS Code</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Mon, 20 Apr 2020 11:09:37 +0000</pubDate>
      <link>https://dev.to/deadlybyte/working-with-geojson-and-vs-code-2ken</link>
      <guid>https://dev.to/deadlybyte/working-with-geojson-and-vs-code-2ken</guid>
      <description>&lt;p&gt;I've been working on a project that uses &lt;strong&gt;GeoJSON&lt;/strong&gt; to display geographical points on a interactive map. Whilst working with the &lt;code&gt;.geojson&lt;/code&gt; files I noticed that VS Code was not validating the JSON or providing the usual &lt;em&gt;IntelliSense&lt;/em&gt; when typing.&lt;/p&gt;

&lt;blockquote&gt;GeoJSON is a format for encoding a variety of geographic data structures.&lt;p&gt;&lt;cite&gt;- &lt;a href="https://geojson.org"&gt;https://geojson.org/&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is because VS Code does not know how to validate the JSON and the JSON Schema for this file extension has not been registered.&lt;/p&gt;

&lt;p&gt;So how do we fix this? The below steps can be used to configure VS Code with any JSON Schema for a file extension.&lt;/p&gt;

&lt;h1&gt;
  
  
  Add the JSON Schema
&lt;/h1&gt;

&lt;p&gt;First we need to open VS Code, once you've opened VS Code we need to edit the settings.json file. To open the Settings editor use the following VS Code menu command:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On Windows/Linux - &lt;code&gt;File &amp;gt; Preferences &amp;gt; Settings&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;On macOS - &lt;code&gt;Code &amp;gt; Preferences &amp;gt; Settings&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;strong&gt;Note:&lt;/strong&gt; You can also open the Settings editor from the &lt;strong&gt;Command Palette&lt;/strong&gt; (Ctrl+Shift+P) with &lt;strong&gt;Preferences: Open Settings&lt;/strong&gt; or use the keyboard shortcut (Ctrl+, for Windows and ⌘+, for macOS).
&lt;/blockquote&gt;

&lt;p&gt;In the &lt;strong&gt;Settings editor&lt;/strong&gt; type &lt;code&gt;JSON: Schemas&lt;/code&gt; and click the link &lt;code&gt;Edit in settings.json&lt;/code&gt; in the filtered results panel.&lt;/p&gt;

&lt;p&gt;Using the above approach will open the &lt;strong&gt;Settings editor&lt;/strong&gt; with the "json.schemas" array expanded. Now all we have to do is insert the correct JSON Schema as an entry within this array.&lt;/p&gt;

&lt;p&gt;The first thing we need to do is setup the file extension VS Code will used to validate. As the common file extension for GeoJSON is &lt;em&gt;.geojson&lt;/em&gt;, we can use a &lt;strong&gt;fileMatch&lt;/strong&gt; property (which expects an array of file extensions) with the value of &lt;em&gt;["*.geojson"]&lt;/em&gt;. The next property is the &lt;strong&gt;url&lt;/strong&gt;, which indicates where the JSON Schema is located. VS Code will download this file and then validate the JSON against this schema.&lt;/p&gt;

&lt;p&gt;Luckily for us GeoJSON is a standard and it already has a defined JSON Schema and can be found at the following URL:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://json.schemastore.org/geojson"&gt;http://json.schemastore.org/geojson&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the final JSON for defining the GeoJSON JSON Schema will look something like the below.&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;"json.schemas"&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="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"fileMatch"&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="s2"&gt;".geojson"&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;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http://json.schemastore.org/geojson"&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="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file and your GeoJSON will now be validate using the JSON Schema specified.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bE98Knys--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/au4ux7was45cq2tzsbiu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bE98Knys--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/au4ux7was45cq2tzsbiu.png" alt="Invalid GeoJSON validated via JSON Schema" width="800" height="187"&gt;&lt;/a&gt;&lt;/p&gt;
Invalid GeoJSON validated via JSON Schema in VS Code



&lt;p&gt;If you visit &lt;a href="http://schemastore.org"&gt;http://schemastore.org&lt;/a&gt; you will notice many more JSON Schemas, so if you find VS Code does not support a JSON file your using regularly then you can use the above steps to add support along with the JSON Schema from the &lt;a href="http://schemastore.org"&gt;http://schemastore.org&lt;/a&gt; or your own.&lt;/p&gt;

&lt;h1&gt;
  
  
  Resources
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://geojson.org/"&gt;https://geojson.org/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://json-schema.org/"&gt;https://json-schema.org/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings"&gt;https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://schemastore.org"&gt;http://schemastore.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://json.schemastore.org/geojson"&gt;http://json.schemastore.org/geojson&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Icons made by &lt;a href="https://www.flaticon.com/authors/smashicons" title="Smashicons"&gt;Smashicons&lt;/a&gt; from &lt;a href="https://www.flaticon.com/" title="Flaticon"&gt; &lt;/a&gt;&lt;a href="http://www.flaticon.com"&gt;www.flaticon.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vscode</category>
      <category>productivity</category>
      <category>codenewbie</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Easter Egg 🐇🥚 Hunt Anyone? - Add ASCII Art to the console log</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Wed, 08 Apr 2020 19:01:31 +0000</pubDate>
      <link>https://dev.to/deadlybyte/easter-egg-hunt-anyone-add-ascii-art-to-the-console-log-4emg</link>
      <guid>https://dev.to/deadlybyte/easter-egg-hunt-anyone-add-ascii-art-to-the-console-log-4emg</guid>
      <description>&lt;p&gt;As Easter is upon us and we're all trying to bring some happiness in these hard times. Why not add an Easter Egg 🐇🥚 to your website or client websites?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLDR;&lt;/strong&gt; - It's quick and easy, just generate the ASCII art and use &lt;code&gt;console.log&lt;/code&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  DEV Easter Egg
&lt;/h1&gt;

&lt;p&gt;Did you know that dev.to has this Easter Egg?&lt;/p&gt;

&lt;p&gt;If you've ever opened the development tools of your favourite browser (F12) when visiting the dev.to website you probably all ready seen the ASCII art displayed in the console logs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-oooooooo/-      .+ooooooooo:  +ooo+        oooo/
+MMMMMMMMMMm+   -NMMMMMMMMMMs  +MMMM:      /MMMM/
+MMMNyyydMMMMy  /MMMMyyyyyyy/   mMMMd      mMMMd
+MMMm    :MMMM. /MMMN           /MMMM/    /MMMM:
+MMMm    .MMMM- /MMMN            dMMMm    mMMMh
+MMMm    .MMMM- /MMMMyyyy+       :MMMM/  +MMMM-
+MMMm    .MMMM- /MMMMMMMMy        hMMMm  NMMMy
+MMMm    .MMMM- /MMMMoooo:        -MMMM+oMMMM-
+MMMm    .MMMM- /MMMN              yMMMmNMMMy
+MMMm    +MMMM. /MMMN              .MMMMMMMM.
+MMMMdddNMMMMo  /MMMMddddddd+       sMMMMMMs
+MMMMMMMMMNh:   .mMMMMMMMMMMs        yMMMMs
.///////:-        -/////////-         .::.

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

&lt;/div&gt;
Output on the console log with dev tools opened when visiting dev.to.





&lt;p&gt;And thought that looks awesome.&lt;/p&gt;

&lt;h1&gt;
  
  
  How Do I Add That To My Site?
&lt;/h1&gt;

&lt;p&gt;First we need a way to convert text to ASCII art, I've used the following npm package &lt;code&gt;figlet-cli&lt;/code&gt;, which can be executed on the command line.&lt;/p&gt;

&lt;blockquote&gt;
&lt;strong&gt;Note:&lt;/strong&gt; Other packages or applications are available.&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/figlet-cli"&gt;https://www.npmjs.com/package/figlet-cli&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;npx figlet-cli &lt;span class="s2"&gt;"Raven Code"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;strong&gt;Note:&lt;/strong&gt; Used npx to install as we don't need as a global package.&lt;/blockquote&gt;

&lt;p&gt;This will generate the following output using the default font.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ____                          ____          _      
 |  _ \ __ ___   _____ _ __    / ___|___   __| | ___
 | |_) / _` \ \ / / _ \ '_ \  | |   / _ \ / _` |/ _ \
 |  _ &amp;lt; (_| |\ V /  __/ | | | | |__| (_) | (_| |  __/
 |_| \_\__,_| \_/ \___|_| |_|  \____\___/ \__,_|\___|
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now to output this to the console we have to escape the special characters using a &lt;code&gt;\&lt;/code&gt; (backslash) and terminating each line with &lt;code&gt;\n\&lt;/code&gt; (a new line &lt;code&gt;\n&lt;/code&gt; and the backlash to indicate the string spans multiple lines).&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;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;     ____                          ____          _&lt;/span&gt;&lt;span class="se"&gt;\n\&lt;/span&gt;&lt;span class="s2"&gt;
    |  _ &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt; __ ___   _____ _ __    / ___|___   __| | ___&lt;/span&gt;&lt;span class="se"&gt;\n\&lt;/span&gt;&lt;span class="s2"&gt;
    | |_) / _` &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt; / / _ &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt; '_ &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;  | |   / _ &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt; / _` |/ _ &lt;/span&gt;&lt;span class="se"&gt;\\\n\&lt;/span&gt;&lt;span class="s2"&gt;
    |  _ &amp;lt; (_| |&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt; V /  __/ | | | | |__| (_) | (_| |  __/&lt;/span&gt;&lt;span class="se"&gt;\n\&lt;/span&gt;&lt;span class="s2"&gt;
    |_| &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;_&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;__,_| &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;_/ &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;___|_| |_|  &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;____&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;___/ &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;__,_|&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;___|&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;blockquote&gt;
&lt;strong&gt;Note:&lt;/strong&gt; Could use `Template Literals` in ES6 as this supports multiline strings and you wouldn't need the \n\ syntax.&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Change The Font
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;figlet-cli&lt;/code&gt; package supports other command line parameters, one of those being the &lt;code&gt;-f&lt;/code&gt; flag. Specifying this option determines the font used to generate the ASCII art.&lt;/p&gt;

&lt;p&gt;To see the list of fonts supported use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx figlet-cli &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To use a font called &lt;code&gt;ANSI Shadow&lt;/code&gt;, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx figlet-cli &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="s2"&gt;"ANSI Shadow"&lt;/span&gt; &lt;span class="s2"&gt;"Raven Code"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will generate the following output using the &lt;code&gt;ANSI Shadow&lt;/code&gt; font.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;██████╗  █████╗ ██╗   ██╗███████╗███╗   ██╗     ██████╗ ██████╗ ██████╗ ███████╗
██╔══██╗██╔══██╗██║   ██║██╔════╝████╗  ██║    ██╔════╝██╔═══██╗██╔══██╗██╔════╝
██████╔╝███████║██║   ██║█████╗  ██╔██╗ ██║    ██║     ██║   ██║██║  ██║█████╗
██╔══██╗██╔══██║╚██╗ ██╔╝██╔══╝  ██║╚██╗██║    ██║     ██║   ██║██║  ██║██╔══╝
██║  ██║██║  ██║ ╚████╔╝ ███████╗██║ ╚████║    ╚██████╗╚██████╔╝██████╔╝███████╗
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So what are you waiting for get creative!&lt;/p&gt;

&lt;h2&gt;
  
  
  Extra Creative
&lt;/h2&gt;

&lt;p&gt;If you want to go the extra mile and convert an image to ASCII art than look at the &lt;code&gt;ascii-art&lt;/code&gt; npm package.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/ascii-art"&gt;https://www.npmjs.com/package/ascii-art&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again this can be installed via &lt;code&gt;npx&lt;/code&gt; using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ascii-art image path/to/image.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;strong&gt;Note:&lt;/strong&gt; This package also supports generating text to ASCII art. However, the font support seem to be limited.&lt;/blockquote&gt;

&lt;p&gt;You could use this to generate ASCII art for your logo and output this on the console.log.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Easter Egg Hunt 🐇🥚🔍
&lt;/h1&gt;

&lt;p&gt;Let's do a virtual Easter Egg Hunt and hunt down those websites that have an Easter Egg, list the best in the comments below. So get hunting!&lt;/p&gt;

&lt;h1&gt;
  
  
  Resources
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://dev.to"&gt;https://dev.to&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.npmjs.com/package/figlet-cli"&gt;https://www.npmjs.com/package/figlet-cli&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/khrome/ascii-art"&gt;https://github.com/khrome/ascii-art&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>challenge</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Switch Off Hyper-V on Boot in Windows</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Fri, 13 Mar 2020 19:05:09 +0000</pubDate>
      <link>https://dev.to/deadlybyte/switch-off-hyper-v-on-boot-in-windows-5gpc</link>
      <guid>https://dev.to/deadlybyte/switch-off-hyper-v-on-boot-in-windows-5gpc</guid>
      <description>&lt;p&gt;As you may or may not know Hyper-V on Windows hijacks the Hypervisor and you can't have two Hypervisors running at the same.&lt;/p&gt;

&lt;p&gt;We could use Window's &lt;strong&gt;Add/Remove features&lt;/strong&gt; to turn the &lt;strong&gt;Hyper-V&lt;/strong&gt; support off and back on, but that's a lot of hassle.&lt;/p&gt;

&lt;p&gt;Luckily we can update the boot entry, which can be configured to switch off the hypervisor (at launch). But instead of updating the existing boot entry, we can go one better and create another boot entry. This will then trigger a prompt for the boot option at startup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;bcdedit /copy &lt;span class="o"&gt;{&lt;/span&gt;current&lt;span class="o"&gt;}&lt;/span&gt; /d &lt;span class="s2"&gt;"No Hyper V"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
cmd syntax





&lt;blockquote&gt;Make sure you run the commands as Administrator, otherwise you'll get the "Access is denied" error.&lt;/blockquote&gt;

&lt;p&gt;Or run the following if using PowerShell.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nf"&gt;bcdedit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;--&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/copy&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;/d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"No Hyper V"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
PowerShell syntax





&lt;p&gt;Once the boot entry has been successfully copied the &lt;code&gt;GUID&lt;/code&gt; will be displayed in the output. You'll need to copy this ID and use it in the next command. E.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nf"&gt;C:\&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;bcdedit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;--&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/copy&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;/d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"No Hyper V"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nf"&gt;The&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;entry&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;was&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;successfully&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;copied&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;a10f071b-5711-4d5d-b7a9-9b0a4957d6fb&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next step is to set the &lt;code&gt;hypervisorlaunchtype&lt;/code&gt; to the value &lt;code&gt;off&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;bcdedit /set &lt;span class="o"&gt;{&lt;/span&gt;a10f071b-5711-4d5d-b7a9-9b0a4957d6fb&lt;span class="o"&gt;}&lt;/span&gt; hypervisorlaunchtype off
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
cmd syntax





&lt;blockquote&gt;Remember to replace the GUID with the id returned from the copy command.&lt;/blockquote&gt;

&lt;p&gt;Or run the following if using PowerShell.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nf"&gt;bcdedit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;--&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;a10f071b-5711-4d5d-b7a9-9b0a4957d6fb&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;hypervisorlaunchtype&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;off&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
PowerShell syntax





&lt;p&gt;Restart your machine and you should now be prompted to select your operating system. Either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows 10&lt;/li&gt;
&lt;li&gt;No Hyper V&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Select &lt;code&gt;No Hyper V&lt;/code&gt; and you can now be sure that the Hypervisor is no longer hijacked by &lt;strong&gt;Hyper-V&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>windows</category>
      <category>virtualization</category>
      <category>productivity</category>
      <category>hyperv</category>
    </item>
    <item>
      <title>Import SVG Directly as a ReactComponent</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Thu, 05 Mar 2020 13:34:16 +0000</pubDate>
      <link>https://dev.to/deadlybyte/import-svg-directly-as-a-reactcomponent-adk</link>
      <guid>https://dev.to/deadlybyte/import-svg-directly-as-a-reactcomponent-adk</guid>
      <description>&lt;p&gt;I've been working on a React project that uses custom SVG icons and needed a nice way to import these icons. Since I'm using &lt;code&gt;create-react-app&lt;/code&gt;, I've been able to import SVGs as React components.&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="nx"&gt;React&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;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ReactComponent&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Icon&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;./icon.svg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Icon&lt;/span&gt; &lt;span class="o"&gt;/&amp;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; This feature is only available with &lt;code&gt;react-script@2.0.0&lt;/code&gt; and higher, and &lt;code&gt;react@16.3.0&lt;/code&gt; and higher.
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hey presto!🎉&lt;/p&gt;

&lt;p&gt;I can now access them as a normal React component, which saves me hassle.&lt;/p&gt;

&lt;p&gt;You can also add props to the React component, just like you would normally. E.g.&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="nx"&gt;React&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;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ReactComponent&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;DevIcon&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;./dev-brands.svg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;DevIcon&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DEV Icon&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;icon&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
App.jsx - Code to import SVG as React Component







&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.icon&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24px&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;
App.css - CSS for the svg icon







&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"http://www.w3.org/2000/svg"&lt;/span&gt; &lt;span class="na"&gt;aria-hidden=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt; &lt;span class="na"&gt;focusable=&lt;/span&gt;&lt;span class="s"&gt;"false"&lt;/span&gt; &lt;span class="na"&gt;data-prefix=&lt;/span&gt;&lt;span class="s"&gt;"fab"&lt;/span&gt; &lt;span class="na"&gt;data-icon=&lt;/span&gt;&lt;span class="s"&gt;"dev"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"svg-inline--fa fa-dev fa-w-14"&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"img"&lt;/span&gt; &lt;span class="na"&gt;viewBox=&lt;/span&gt;&lt;span class="s"&gt;"0 0 448 512"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;path&lt;/span&gt; &lt;span class="na"&gt;fill=&lt;/span&gt;&lt;span class="s"&gt;"currentColor"&lt;/span&gt; &lt;span class="na"&gt;d=&lt;/span&gt;&lt;span class="s"&gt;"M120.12 208.29c-3.88-2.9-7.77-4.35-11.65-4.35H91.03v104.47h17.45c3.88 0 7.77-1.45 11.65-4.35 3.88-2.9 5.82-7.25 5.82-13.06v-69.65c-.01-5.8-1.96-10.16-5.83-13.06zM404.1 32H43.9C19.7 32 .06 51.59 0 75.8v360.4C.06 460.41 19.7 480 43.9 480h360.2c24.21 0 43.84-19.59 43.9-43.8V75.8c-.06-24.21-19.7-43.8-43.9-43.8zM154.2 291.19c0 18.81-11.61 47.31-48.36 47.25h-46.4V172.98h47.38c35.44 0 47.36 28.46 47.37 47.28l.01 70.93zm100.68-88.66H201.6v38.42h32.57v29.57H201.6v38.41h53.29v29.57h-62.18c-11.16.29-20.44-8.53-20.72-19.69V193.7c-.27-11.15 8.56-20.41 19.71-20.69h63.19l-.01 29.52zm103.64 115.29c-13.2 30.75-36.85 24.63-47.44 0l-38.53-144.8h32.57l29.71 113.72 29.57-113.72h32.58l-38.46 144.8z"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
dev-brands.svg - Dev Icon from FontAwesome





&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://create-react-app.dev/docs/adding-images-fonts-and-files/#adding-svgs"&gt;Create React App Adding SVGs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://fontawesome.com/icons/dev?style=brands"&gt;Font Awesome Dev Icon&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>svg</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Add Destroy Script 🔥💻 To package.json</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Tue, 25 Feb 2020 09:55:34 +0000</pubDate>
      <link>https://dev.to/deadlybyte/add-destroy-script-to-package-json-43mf</link>
      <guid>https://dev.to/deadlybyte/add-destroy-script-to-package-json-43mf</guid>
      <description>&lt;p&gt;On rare occasions I find myself having to clean my development environment (i.e. delete the following folders - node_modules, build, coverage, etc). As this could include multiple folders, I decided the best approach was to create a script. I also hate typing the same commands over and over again, save those fingers!🖐️&lt;/p&gt;

&lt;p&gt;I wanted a cross platform approach (works on both Linux and Windows), &lt;code&gt;rimraf&lt;/code&gt; is the ideal candidate as it's an &lt;a href="https://www.npmjs.com/package/rimraf" title="rimraf - npm"&gt;npm package&lt;/a&gt; that deletes folders recursively and works cross platform.&lt;/p&gt;

&lt;p&gt;Why make the solution cross platform? So all developers that collaborate on the code base can benefit.&lt;/p&gt;

&lt;p&gt;Now we could install rimraf globally, but we can't guarantee that another developer has this installed, which will result in the script failing when executed.&lt;/p&gt;

&lt;p&gt;A cleaner approach is to have the dependency installed as a dev dependency. However, this will cause issues as &lt;code&gt;rimraf&lt;/code&gt; will try to delete the node_modules folder where &lt;code&gt;rimraf&lt;/code&gt; is currently executing from. Hence it would try and delete itself and fail.&lt;/p&gt;

&lt;p&gt;So to resolve this issue, we can execute &lt;code&gt;rimraf&lt;/code&gt; when we need to run it (one-off invocation without local installation) via the &lt;code&gt;npx&lt;/code&gt; command. The &lt;code&gt;npx&lt;/code&gt; command was introduced with npm 5.2.0 and later.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Destroy Script 🔥
&lt;/h1&gt;

&lt;p&gt;Below is an example of the destroy script, this will delete the node_modules, build and coverage folders and all their contents.&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="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&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;"destroy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx rimraf node_modules build coverage"&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="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Execute Destroy Script
&lt;/h1&gt;

&lt;p&gt;The destroy script can be executed either by using npm or yarn.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run destroy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn destroy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>productivity</category>
      <category>webdev</category>
      <category>npm</category>
    </item>
    <item>
      <title>Make VS Code Your Default Git Editor 📝</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Tue, 18 Feb 2020 22:54:06 +0000</pubDate>
      <link>https://dev.to/deadlybyte/make-vs-code-your-default-git-editor-j6d</link>
      <guid>https://dev.to/deadlybyte/make-vs-code-your-default-git-editor-j6d</guid>
      <description>&lt;p&gt;Recently I've found myself using the git command &lt;code&gt;git commit --amend&lt;/code&gt; to change typos in my commit messages. By default the &lt;a href="https://www.nano-editor.org/" title="GNU's Not Unix!" rel="noopener noreferrer"&gt;GNU nano&lt;/a&gt; text editor is used, which for me isn't a great experience and was starting to &lt;strong&gt;BUG&lt;/strong&gt; me!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fne7mlf08p45kd99hg07i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fne7mlf08p45kd99hg07i.png" alt="Default GNU nano editor for changing git message"&gt;&lt;/a&gt;&lt;/p&gt;
GNU nano editor is used by default to change git commit message



&lt;p&gt;I use VS Code daily and as I'm typing the git command in the built-in VS Code terminal, naturally I want to edit the commit message using the same editor. Well luckily you can configure this with a one liner.&lt;/p&gt;

&lt;h1&gt;
  
  
  Default VS Code As The Git Editor (Globally)
&lt;/h1&gt;

&lt;p&gt;Type the following in the command prompt / bash shell.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global core.editor "code --wait"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, alternatively if you don't like typing too much then use.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global core.editor "code -w"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;code&gt;--wait&lt;/code&gt; or &lt;code&gt;-w&lt;/code&gt; flag is crucial without this git won't know the editing has completed and in turn won't finish executing the git command.&lt;/p&gt;

&lt;h2&gt;
  
  
  See It Working!
&lt;/h2&gt;

&lt;p&gt;Below is a gif showing VS Code as the default editor for git.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuwzyumaypx5yxff61lw0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuwzyumaypx5yxff61lw0.gif" alt="VS Code As The Default Git Editor"&gt;&lt;/a&gt;&lt;/p&gt;
Working example of VS Code as the default git editor



&lt;h1&gt;
  
  
  Default VS Code As The Git Editor (Local Repo)
&lt;/h1&gt;

&lt;p&gt;But wait there's more, if you don't want the change to happen globally you can set it locally for a git repository by using the flag &lt;code&gt;--local&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --local core.editor "code -w"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Revert Back To GNU nano (or default)
&lt;/h1&gt;

&lt;p&gt;And if you prefer GNU nano and want to reset this to the default git editor, then run the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global --unset core.editor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you set the editor locally and you want to reset then replace the &lt;code&gt;--global&lt;/code&gt; flag with the &lt;code&gt;--local&lt;/code&gt; flag instead.&lt;/p&gt;

</description>
      <category>git</category>
      <category>beginners</category>
      <category>productivity</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Simple HTML - Click To Call (tel: schema) 🖱️📞</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Mon, 10 Feb 2020 18:45:49 +0000</pubDate>
      <link>https://dev.to/deadlybyte/html-click-to-call-tel-schema-1k1l</link>
      <guid>https://dev.to/deadlybyte/html-click-to-call-tel-schema-1k1l</guid>
      <description>&lt;p&gt;Make your website even more accessible when dealing with telephone numbers by allowing the user to click your number to make a call.&lt;/p&gt;

&lt;p&gt;TL;DR&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wrap the telephone number in an anchor tag &lt;code&gt;&amp;lt;a&amp;gt;&amp;lt;/a&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Prefix the telephone number in the &lt;code&gt;href&lt;/code&gt; attribute with the &lt;code&gt;tel:&lt;/code&gt; schema&lt;/li&gt;
&lt;li&gt;Make sure the telephone number uses the &lt;a href="https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers" rel="noopener noreferrer"&gt;international dialling format&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This takes seconds to implement, so there's no excuse not to do it!&lt;/p&gt;

&lt;h1&gt;
  
  
  Problem
&lt;/h1&gt;

&lt;p&gt;You want to talk with a real human to discuss a problem and you visit the website's &lt;strong&gt;"Contact Us"&lt;/strong&gt; page to get the telephone number, you now have to copy the number from the website into your phone and then press the dial button. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Arrrrgggh&lt;/strong&gt;, it shouldn't be this hard!&lt;/p&gt;

&lt;p&gt;Those websites not in the know have the telephone number contained in the following HTML markup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;+44 (0)20 7946 0123&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The number above is a fictitious, so it'll fail to connect. Fictitious numbers are used in movies, television programs, etc. You can find out more about &lt;a href="https://en.wikipedia.org/wiki/Fictitious_telephone_number" rel="noopener noreferrer"&gt;fictitious numbers on Wikipedia&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution (tel: Schema)
&lt;/h1&gt;

&lt;p&gt;What is the &lt;code&gt;tel:&lt;/code&gt; schema, its a URI schema for telephone numbers. Browsers are able to parse these values and understand that they should be treated as a telephone number.  &lt;/p&gt;

&lt;p&gt;HTML has built-in support for &lt;strong&gt;Click to Call&lt;/strong&gt;, by wrapping the telephone number in an anchor link and using the &lt;code&gt;tel:&lt;/code&gt; schema. E.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"tel:+44-207-946-0123"&lt;/span&gt; &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"Click to Call"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;+44 (0)20 7946 0123&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Be a good citizen and use the international telephone dialling format to make sure the call is always connected, irrespective of where the caller is located.&lt;/p&gt;

&lt;p&gt;There's no excuse not to implement this &lt;strong&gt;5 seconds fix&lt;/strong&gt;, we owe it to our users.✅&lt;/p&gt;

&lt;h2&gt;
  
  
  What Happens
&lt;/h2&gt;

&lt;p&gt;Depending on whether you visit the website with a mobile device or desktop changes the behaviour of the link.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mobile Devices
&lt;/h3&gt;

&lt;p&gt;Pressing the telephone number will now open the device's default dialler app with the telephone number already inserted, user only has to press the dial button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq5i76gbug5fod9zc7whf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq5i76gbug5fod9zc7whf.gif" alt="Click To Call On Android Phone"&gt;&lt;/a&gt;&lt;/p&gt;
Click To Call On Android Phone



&lt;h3&gt;
  
  
  Desktop
&lt;/h3&gt;

&lt;p&gt;This will depend on the browser used to navigate the website, but most modern browsers will prompt the user to make a call using their phone or pick an application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjv19v7wj09oq93om1u09.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjv19v7wj09oq93om1u09.png" alt="Google Chrome Make A Call Prompt"&gt;&lt;/a&gt;&lt;/p&gt;
Google Chrome Make A Call Prompt



&lt;h2&gt;
  
  
  Try It Out
&lt;/h2&gt;

&lt;p&gt;Below is an example of how the telephone number will appear when visiting the website. Again this is a fictitious number so the call won't be connected, but should allow you to view the UX.&lt;/p&gt;

&lt;p&gt;&lt;a href="tel:+44-207-946-0123" title="Click to Call"&gt;+44 (0)20 7946 0123&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Credits
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Cover Image:&lt;/strong&gt; Photo by &lt;a href="https://unsplash.com/@jamessutton_photography" rel="noopener noreferrer"&gt;James Sutton&lt;/a&gt; on Unsplash&lt;/p&gt;

</description>
      <category>html</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>webdev</category>
    </item>
    <item>
      <title>🙏 Please Add .gitattributes To Your Git Repository</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Mon, 03 Feb 2020 14:39:44 +0000</pubDate>
      <link>https://dev.to/deadlybyte/please-add-gitattributes-to-your-git-repository-1jld</link>
      <guid>https://dev.to/deadlybyte/please-add-gitattributes-to-your-git-repository-1jld</guid>
      <description>&lt;h1&gt;
  
  
  What Is .gitattributes?
&lt;/h1&gt;

&lt;p&gt;The &lt;em&gt;.gitattributes&lt;/em&gt; file allows you to specify the files and paths attributes that should be used by git when performing git actions, such as &lt;code&gt;git commit&lt;/code&gt;, etc.&lt;/p&gt;

&lt;p&gt;In other words git automatically saves the file according to the attributes specified, every time a file is created or saved.&lt;/p&gt;

&lt;p&gt;One of these attributes is the &lt;strong&gt;eol&lt;/strong&gt; (end of line) and is used to configure the line endings for a file. This article will now dive deeper into how to configure the line endings, so every developer uses the same value when using different machines / OSes across the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why .gitattributes (Developers At War ⚔️)?
&lt;/h2&gt;

&lt;p&gt;Not all developers are the same, just because you develop on a Windows machine using Visual Studio Code, don't expect the next pull request to have been implemented using the same dev environment (MacOS machine using Sublime Text 2). &lt;/p&gt;

&lt;p&gt;As mentioned above the developers are using different OSes (Windows and MacOS) the default for the line ending will differ. On the Windows machine the default for the line ending is a Carriage Return Line Feed (CRLF), whereas on Linux/MacOS it's a Line Feed (LF).&lt;/p&gt;

&lt;p&gt;To the naked eye the content will look the same, so why should we bother???&lt;/p&gt;

&lt;p&gt;Well, if you have prettier enabled and the &lt;strong&gt;endOfLine&lt;/strong&gt; property is set to &lt;strong&gt;lf&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&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;"endOfLine"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"lf"&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;On the Windows machine the developer will encounter linting issues from prettier, like those below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foez62e8wsfms4oswp2kb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foez62e8wsfms4oswp2kb.png" alt="Code File With Prettier Linting Errors - .gitattributes"&gt;&lt;/a&gt;&lt;/p&gt;
Code File With Prettier Linting Errors



&lt;p&gt;This is where .gitattributes comes to the rescue and saves the day 🦸!&lt;/p&gt;

&lt;h2&gt;
  
  
  New Repository (Repo)
&lt;/h2&gt;

&lt;p&gt;To add the .gitattributes to the repo first you need to create a file called .gitattributes into the root folder for the repo.&lt;/p&gt;

&lt;p&gt;Below is an example of the contents for the .gitattributes file.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

*.js    eol=lf
*.jsx   eol=lf
*.json  eol=lf



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

&lt;/div&gt;

&lt;p&gt;Commit this file to the repo and push your changes to the server.&lt;/p&gt;

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

git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Added .gitattributes to repo"&lt;/span&gt;
git push


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

&lt;/div&gt;

&lt;p&gt;Now when anyone gets the code from the repo the default correct line ending will be used automatically via git, when creating and modifying the files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add to Existing Git Repository (Repo)
&lt;/h2&gt;

&lt;p&gt;Follow the steps mentioned in the New Repository (Repo) steps to create the .gitattributes file. Once the file has been pushed to the git server then make sure that your local repo is clean and has nothing to commit. Use &lt;code&gt;git status&lt;/code&gt; to determine whether your repo is clean.&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;&lt;strong&gt;Note:&lt;/strong&gt; If you still have files to push or commit, please make sure that these actions are performed or the files are stashed before you perform the next commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  GitAttributes Reset
&lt;/h3&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

git rm --cached -r .
git reset --hard


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

&lt;/div&gt;

&lt;p&gt;The above commands will now update the files for the repo using the newly defined line ending as specified in the .gitattributes.&lt;/p&gt;

&lt;p&gt;Any changes or new changes will automatically use the line endings specified for that file type.&lt;/p&gt;

&lt;p&gt;Next step is to inform any team mate or collaborator, to run the GitAttributes Reset commands.&lt;/p&gt;

&lt;p&gt;Now prettier won't complain about CR and all developers can now live in peace! ☮️&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe7des7q11sbhnpiveu27.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe7des7q11sbhnpiveu27.png" alt="Code File With No Linting Errors - .gitattributes"&gt;&lt;/a&gt;&lt;/p&gt;
Code File With No Prettier Linting Errors



</description>
      <category>git</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>💻💨 Quick TypeScript - Make Object Literal Properties Read-only</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Wed, 29 Jan 2020 22:47:11 +0000</pubDate>
      <link>https://dev.to/deadlybyte/quick-typescript-make-object-literals-properties-readonly-2ncb</link>
      <guid>https://dev.to/deadlybyte/quick-typescript-make-object-literals-properties-readonly-2ncb</guid>
      <description>&lt;p&gt;Have you ever found yourself declaring a variable (for an object literal) using the &lt;code&gt;const&lt;/code&gt; keyword and then assume those properties within that variable were read-only?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Carl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Saunders&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;In the above example most developers would assume the &lt;em&gt;firstName&lt;/em&gt; and &lt;em&gt;lastName&lt;/em&gt; properties cannot be changed and are read only. &lt;strong&gt;WRONG!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The below code is perfectly valid and can lead to bugs and these won't be caught until your code is production.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Joe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// valid assignment, even though const was used&lt;/span&gt;
&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lastName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bloggs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// valid assignment, even though const was used&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Const Assertions (as const keyword)
&lt;/h1&gt;

&lt;p&gt;TypeScript has built-in support for guarding against this and can be achieved by using the const assertions. Behind the scenes TypeScript is converting all those properties defined on the object literal into read-only versions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Carl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Saunders&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if we tried to assign &lt;em&gt;firstName&lt;/em&gt; property a new value the compiler would report the following error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cannot assign to 'firstName' because it is a read-only property.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The const assertion &lt;code&gt;as const&lt;/code&gt; feature is supported in TypeScript 3.4+. Also only works when you haven't already typed the object.&lt;/p&gt;

&lt;h2&gt;
  
  
  More Info
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions"&gt;TypeScript Docs - Const Assertions&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>snippet</category>
    </item>
    <item>
      <title>💨Super Quick CSS: Smooth Scrolling</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Wed, 22 Jan 2020 19:30:01 +0000</pubDate>
      <link>https://dev.to/deadlybyte/super-quick-css-smooth-scrolling-4321</link>
      <guid>https://dev.to/deadlybyte/super-quick-css-smooth-scrolling-4321</guid>
      <description>&lt;h1&gt;
  
  
  Transform Your Website's UX With This One Liner
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;html&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;scroll-behavior&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;smooth&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;If like me you've got a single page website and your using bookmarks (anchors tags that reference an element by id), allowing user to navigate to different sections of the website. Then you need to add this &lt;strong&gt;CSS&lt;/strong&gt; property &lt;code&gt;scroll-behavior: smooth;&lt;/code&gt;, which will smoothly scroll the page content into view.&lt;/p&gt;

&lt;h1&gt;
  
  
  Working Example
&lt;/h1&gt;

&lt;p&gt;Below the CodePen demonstrates the smooth scrolling of the content when you click one of the navigation links.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/deadlybyte/embed/jOEdbpw?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h1&gt;
  
  
  Demo
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa7y31pbgkibtvgghdkji.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa7y31pbgkibtvgghdkji.gif" alt="Before - Without Smooth Scrolling"&gt;&lt;/a&gt;&lt;/p&gt;
Before - Without Smooth Scrolling



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Frkj5qi6as92knz2dod19.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Frkj5qi6as92knz2dod19.gif" alt="After - With Smooth Scrolling"&gt;&lt;/a&gt;&lt;/p&gt;
After - With Smooth Scrolling



&lt;h1&gt;
  
  
  Things To Note
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;scroll-behavior&lt;/code&gt; property doesn't seem to work on the &lt;code&gt;body&lt;/code&gt; element, so best to add it to the &lt;code&gt;html&lt;/code&gt; element.&lt;/p&gt;

&lt;p&gt;This property isn't currently support by all browsers, but this shouldn't stop you using it as it won't break and defaults to the standard behavior.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://caniuse.com/#feat=mdn-css_properties_scroll-behavior" rel="noopener noreferrer"&gt;https://caniuse.com/#feat=mdn-css_properties_scroll-behavior&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Pair Programming &amp; Dyslexic? Visual Studio Code Font Switcher to the Rescue</title>
      <dc:creator>Carl Saunders</dc:creator>
      <pubDate>Mon, 01 Jul 2019 16:05:28 +0000</pubDate>
      <link>https://dev.to/deadlybyte/pair-programming-dyslexic-visual-studio-code-font-switcher-to-the-rescue-2l2a</link>
      <guid>https://dev.to/deadlybyte/pair-programming-dyslexic-visual-studio-code-font-switcher-to-the-rescue-2l2a</guid>
      <description>&lt;p&gt;I've been using the OpenDyslexic font in VS Code (see my other post on &lt;a href="https://dev.to/deadlybyte/have-dyslexia-make-coding-easier-in-visual-studio-code-4kmg"&gt;Have Dylexia? Make Coding Easier In Visual Studio Code&lt;/a&gt;) and recently I've been doing some pair programming. However, my colleagues don't appreciate the font and find it hard to read when driving on my machine. So I was going to write a handy VS Code extension, but turns out that someone (&lt;a href="https://marketplace.visualstudio.com/publishers/evan-buss"&gt;Evan Buss&lt;/a&gt;) already beat me to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=evan-buss.font-switcher"&gt;Font Switcher&lt;/a&gt; - Helps when using the OpenDyslexic font and having to pair program on your machine, can quickly switch back and forth between fonts.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>productivity</category>
      <category>dyslexic</category>
      <category>opendyslexic</category>
    </item>
  </channel>
</rss>
