<?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: Jacob Cofman</title>
    <description>The latest articles on DEV Community by Jacob Cofman (@jcofman).</description>
    <link>https://dev.to/jcofman</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%2F395095%2F158d6cbf-bf66-4d97-a78e-61bc4e55f7a2.jpeg</url>
      <title>DEV Community: Jacob Cofman</title>
      <link>https://dev.to/jcofman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jcofman"/>
    <language>en</language>
    <item>
      <title>Make VS Code better by editing and updating some settings</title>
      <dc:creator>Jacob Cofman</dc:creator>
      <pubDate>Fri, 18 Mar 2022 21:53:24 +0000</pubDate>
      <link>https://dev.to/jcofman/make-vs-code-better-by-editing-and-updating-some-settings-4m9a</link>
      <guid>https://dev.to/jcofman/make-vs-code-better-by-editing-and-updating-some-settings-4m9a</guid>
      <description>&lt;p&gt;This article describes five tips on how to make&lt;br&gt;
&lt;a href="https://code.visualstudio.com/"&gt;VS Code&lt;/a&gt; development experience a bit better (at least for my kind&lt;br&gt;
of use cases -&amp;gt; Frontend Development) by enabling and editing some settings which are not set by default. You can go to your&lt;br&gt;
settings and enable each one of these by either opening it up via the command palette&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;CMD + ⌘ + P&lt;/li&gt;
&lt;li&gt;Type in &lt;em&gt;settings&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;- 3. Select &lt;em&gt;Open Workspace Settings (JSON)&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;or with the shortcut (CMD + ,) and click on the icon Open Settings (JSON) on the upper right corner.&lt;/p&gt;

&lt;p&gt;Here are the five 🔥 things I add to improve my development environment.&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Enable bracket colorization
&lt;/h2&gt;

&lt;p&gt;Using bracket colorization makes it easier to see where code blocks start and end.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// settings.json&lt;/span&gt;

&lt;span class="c1"&gt;// 1. enables vscode native bracket colorization&lt;/span&gt;
 &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;editor.bracketPairColorization.enabled&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Enable bracket pair guides
&lt;/h2&gt;

&lt;p&gt;Besides using bracket colorization, I love to add bracket pair guides.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// settings.json&lt;/span&gt;

&lt;span class="c1"&gt;// 2. enables vscode pair guides&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;editor.guides.bracketPairs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Highlight modified Tab
&lt;/h2&gt;

&lt;p&gt;I like to make it more clear which file I work on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// settings.json&lt;/span&gt;

&lt;span class="c1"&gt;// 3. highlight active tab&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;workbench.editor.highlightModifiedTabs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Using Font Ligatures
&lt;/h2&gt;

&lt;p&gt;It makes it easier to distinguish comparisons between code lines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// settings.json&lt;/span&gt;

&lt;span class="c1"&gt;// use a font with font ligatures&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;editor.fontFamily&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="s2"&gt;Jetbrains Mono, Menlo, Monaco, 'Courier New', monospace&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="c1"&gt;// 4. enable font ligature&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;editor.fontLigatures&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Enabling Inlay hints
&lt;/h2&gt;

&lt;p&gt;It can help you see what properties need to get passed into functions. without having to hover over the function call.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// settings.json&lt;/span&gt;

&lt;span class="c1"&gt;// 5. enable parameter hints&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;typescript.inlayHints.parameterNames.enabled&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="s2"&gt;all&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;



</description>
      <category>vscode</category>
      <category>javascript</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Datastructure Stacks in JS</title>
      <dc:creator>Jacob Cofman</dc:creator>
      <pubDate>Sun, 06 Jun 2021 11:07:28 +0000</pubDate>
      <link>https://dev.to/jcofman/datastructure-stacks-in-js-ek4</link>
      <guid>https://dev.to/jcofman/datastructure-stacks-in-js-ek4</guid>
      <description>&lt;p&gt;TLDR;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A stack in terms of computer science is a data structure to store a collection of elements&lt;/li&gt;
&lt;li&gt;There are two core functionalities for stacks

&lt;ul&gt;
&lt;li&gt;You can ➕ add an element on top 🔝&lt;/li&gt;
&lt;li&gt;And also ➖ remove an element pop from the top (the most recently added element)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is a Stack
&lt;/h2&gt;

&lt;p&gt;In real-life situations, stacks can be found everywhere. In your kitchen where your plates are stacked on top of each other, you can see a perfectly working stack. If you have a clean plate you put it on top of the stack and if you want to get a fresh one you typically just take them from the top of the stack. There are literally thousands of memes about stacks.&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%2Fgfz6jb5krdev01ix2vnr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfz6jb5krdev01ix2vnr.jpg" alt="Stack meme first example: Stacked plates"&gt;&lt;/a&gt;&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%2Fsuhzpspy3shumw02sbmi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsuhzpspy3shumw02sbmi.jpg" alt="Stack meme second example: Stacked pancakes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Stacks in JavaScript
&lt;/h2&gt;

&lt;p&gt;In JavaScript, stacks can be used to implement do and undo functionality.&lt;/p&gt;

&lt;p&gt;The JavaScript language itself uses a call stack to figure out which function to call next. There is an awesome talk about how this works by &lt;a href="https://www.youtube.com/watch?v=8aGhZQkoFbQ" rel="noopener noreferrer"&gt;Phillip Roberts&lt;/a&gt; and you can find a detailed explanation on &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Call_stack" rel="noopener noreferrer"&gt;MDN&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can implement a stack using an array. The following example shows an implementation using functions with a function&lt;br&gt;
constructor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * Represents a stack.
 * @constructor
 * @param {array} items - the array to store elements in the stack
 */&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Stack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;items&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="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;_storage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="cm"&gt;/**
   * Returns and removes the top element of the stack.
   * @return {*} the most recently added element of the stack
   */&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pop&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="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;_storage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="cm"&gt;/**
   * Adds a new element at then end (on top) of the stack.
   * @param {*} element which should be put on top of the stack
   */&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;push&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&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;_storage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="cm"&gt;/**
   * Returns the current size (length) of the stack
   * @return {number} current size of the stack
   */&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;size&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="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;_storage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="cm"&gt;/**
   * Returns the value at the end of the stack without removing it
   * @return {*} the last and newest value in the stack
   */&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;peek&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="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;_storage&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;size&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="cm"&gt;/*
   * @return {*} wheter no values are stored in stack
   */&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isEmpty&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="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;_storage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="cm"&gt;/**
   * Empties the stack
   */&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reset&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="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;_storage&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;pop&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;peek&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;reset&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;isEmpty&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;p&gt;On &lt;a href="https://visualgo.net/en/list" rel="noopener noreferrer"&gt;Visaulgo&lt;/a&gt; you can also find awesome visual representations of a stack.&lt;/p&gt;

&lt;p&gt;They used a list to implement the Stack instead of an array.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-world usage and Problems
&lt;/h2&gt;

&lt;p&gt;Some real-world use cases and questions where you can make use of a stack data structure.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/valid-parentheses/" rel="noopener noreferrer"&gt;https://leetcode.com/problems/valid-parentheses/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/techie-delight/stack-data-structure-practice-problems-and-interview-questions-9f08a35a7f19" rel="noopener noreferrer"&gt;https://medium.com/techie-delight/stack-data-structure-practice-problems-and-interview-questions-9f08a35a7f19&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try it yourself maybe you can also find problems on &lt;a href="https://adventofcode.com/" rel="noopener noreferrer"&gt;https://adventofcode.com/&lt;/a&gt; where you can make use of a Stack.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
  </channel>
</rss>
