<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Stojan Peshov on Medium]]></title>
        <description><![CDATA[Stories by Stojan Peshov on Medium]]></description>
        <link>https://medium.com/@stojanpeshov?source=rss-d004b0aa04d7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kUuq-qemZ413svZKB4qNsA.jpeg</url>
            <title>Stories by Stojan Peshov on Medium</title>
            <link>https://medium.com/@stojanpeshov?source=rss-d004b0aa04d7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 23:13:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stojanpeshov/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to setup GatsbyJS starter with Typescript, ESLint, Prettier]]></title>
            <link>https://medium.com/@stojanpeshov/how-to-setup-gatsbyjs-starter-with-typescript-eslint-prettier-269b1a0a812f?source=rss-d004b0aa04d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/269b1a0a812f</guid>
            <category><![CDATA[gatsbyjs]]></category>
            <category><![CDATA[prettier]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[eslint]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Stojan Peshov]]></dc:creator>
            <pubDate>Wed, 23 Oct 2019 22:00:07 GMT</pubDate>
            <atom:updated>2019-10-23T22:00:07.795Z</atom:updated>
            <content:encoded><![CDATA[<h3>In Short</h3><ol><li>Fork, clone and install the Gatsby default starter</li><li>Install gatsby-plugin-typescript and TypeScript</li><li>Configure tsconfig.json and type-check script</li><li>Converting files to TypeScript</li><li>Setting up ESLint &amp; Prettier</li><li>Setting up VSC</li></ol><h3>1. Clone and install the Gatsby default starter</h3><p>So yes just fork the Gatsby default starter to your own Github account and clone it to your local machine from there.</p><ul><li>Go to <a href="https://github.com/gatsbyjs/gatsby-starter-default">https://github.com/gatsbyjs/gatsby-starter-default</a></li><li>Clone the repository to your local machine with git clone git@github.com:gatsbyjs/gatsby-starter-default.git</li><li>cd into the folder</li><li>Run npm install</li><li>Run npm run develop</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FtiwALxE6_En9HvU" /><figcaption>And you are done with setting you your Gatsby starter and it’s running , on <a href="http://localhost:8000/">http://localhost:8000/</a> and we can start to set-up TypeScript now!</figcaption></figure><h3>2. Install TypeScript &amp; gatsby-plugin-typescript and</h3><p>TypeScript can be added to the devDependencies whilst Gatsby plugins should be added as a dependency:</p><pre>npm install gatsby-plugin-typescript &amp; npm install typescript --save-dev</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*S5QEONEB1fCM6hPD" /></figure><p>And we need to enable the plugin gatsby-plugin-typescript in the gatsby-config.js file in the root of your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0_-m5j-BenKo-9at" /></figure><h3>3. Add and configure tsconfig.json</h3><p>Our config file should look something like this:</p><pre>{<br>  &quot;compilerOptions&quot;: {<br>    &quot;module&quot;: &quot;commonjs&quot;,<br>    &quot;target&quot;: &quot;esnext&quot;,<br>    &quot;jsx&quot;: &quot;preserve&quot;,<br>    &quot;lib&quot;: [&quot;dom&quot;, &quot;esnext&quot;],<br>    &quot;strict&quot;: true,<br>    &quot;noEmit&quot;: true,<br>    &quot;isolatedModules&quot;: true,<br>    &quot;esModuleInterop&quot;: true,<br>    &quot;noUnusedLocals&quot;: false<br>  },<br>  &quot;exclude&quot;: [&quot;node_modules&quot;, &quot;public&quot;, &quot;.cache&quot;]<br>}</pre><h3>4. Converting files to TypeScript</h3><p>Start renaming *.js files to *.ts and *.tsx (if they contain JSX).</p><p>We will need fixing the current type errors that TypeScript is screaming at us. I’m leaving the actual fixing of these errors for the follow-up blog post. For now, please bear with me as we set-up a linter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/0*MmePYkiBHaSQwkq3" /></figure><h3>5. Setting up ESLint and Prettier</h3><p>To set up ESLint with TypeScript, Prettier and some React best practices, we’ll need to add a bunch of devDependencies:</p><pre>npm add eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-prettier eslint-plugin-prettier eslint-plugin-react --save-dev</pre><p>And after all packages are installed, let’s add a .eslintrc.js file in the root of the project. Example of ESLint configuration:</p><pre>module.exports = {<br>  parser: &#39;@typescript-eslint/parser&#39;, // Specifies the ESLint parser<br>  extends: [<br>    &#39;eslint:recommended&#39;,<br>    &#39;plugin:react/recommended&#39;,<br>    &#39;plugin:@typescript-eslint/recommended&#39;,<br>    &#39;prettier/@typescript-eslint&#39;,<br>    &#39;plugin:prettier/recommended&#39;<br>  ],<br>  settings: {<br>    react: {<br>      version: &#39;detect&#39;<br>    }<br>  },<br>  env: {<br>    browser: true,<br>    node: true,<br>    es6: true<br>  },<br>  plugins: [&#39;@typescript-eslint&#39;, &#39;react&#39;],<br>  parserOptions: {<br>    ecmaFeatures: {<br>      jsx: true<br>    },<br>    ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features<br>    sourceType: &#39;module&#39; // Allows for the use of imports<br>  },<br>  rules: {<br>    &#39;react/prop-types&#39;: &#39;off&#39;, // Disable prop-types as we use TypeScript for type checking<br>    &#39;@typescript-eslint/explicit-function-return-type&#39;: &#39;off&#39;<br>  },<br>  overrides: [<br>    // Override some TypeScript rules just for .js files<br>    {<br>      files: [&#39;*.js&#39;],<br>      rules: {<br>        &#39;@typescript-eslint/no-var-requires&#39;: &#39;off&#39; //<br>      }<br>    }<br>  ]<br>};</pre><p><strong>Adding Lint Scripts</strong></p><p>To make life easier on ourselves we’ll add two lint scripts to our package.json</p><pre>&quot;scripts&quot;: {<br>  ...<br>  &quot;lint&quot;: &quot;eslint --ignore-path .gitignore . --ext ts --ext tsx --ext js --ext jsx&quot;,<br>}</pre><p>Once called it will run on every *.ts,*.js,*.tsx and *.jsx file and shows you the errors.</p><h3>6. Setting up the editor</h3><p>Add this</p><pre>&quot;eslint.validate&quot;: [<br>    {<br>      &quot;language&quot;: &quot;javascript&quot;,<br>      &quot;autoFix&quot;: true<br>    },<br>    {<br>      &quot;language&quot;: &quot;javascriptreact&quot;,<br>      &quot;autoFix&quot;: true<br>    },<br>    {<br>      &quot;language&quot;: &quot;typescript&quot;,<br>      &quot;autoFix&quot;: true<br>    },<br>    {<br>      &quot;language&quot;: &quot;typescriptreact&quot;,<br>      &quot;autoFix&quot;: true<br>    }<br>  ],</pre><p>To your general settings.json</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LQMWRMqAjMUCKBsc" /></figure><p>We also need to install type definitions for our packages but I will leave that for you, just google it and you will get the general idea.</p><p>I hope that this post gave you a basic idea on how to do the initial setup of GatsbyJS + Typescript + ESLint + Prettier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=269b1a0a812f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Hook inside initialize state function() in useReducer() Hook]]></title>
            <link>https://medium.com/@stojanpeshov/using-hook-inside-initialize-state-function-in-usereducer-hook-fe421f49846c?source=rss-d004b0aa04d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe421f49846c</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs-development]]></category>
            <category><![CDATA[react-hook]]></category>
            <dc:creator><![CDATA[Stojan Peshov]]></dc:creator>
            <pubDate>Tue, 22 Oct 2019 13:02:37 GMT</pubDate>
            <atom:updated>2019-10-22T13:02:37.387Z</atom:updated>
            <content:encoded><![CDATA[<p>So I had this issue with using Hook inside Initialize Function of react useReducer Hook, as a third argument to it.</p><p>And the problem is that I was getting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5BDp86EUJoK0ITFXRWZYCw.png" /></figure><pre>Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function.</pre><p>The problem is that i was using Hook inside of Initialize function of useReducer Hook</p><p>And it took me a while to find where I was getting this from.</p><p>As a solution I tried to pass that hook value that Im trying to get inside of Initialize function directly from the functional component where I use the useReducer hook but it turns out that init function only accepts only one argument so that was a bummer 🙃 .</p><p>My simple and time saving solution was just to get rid of the init function and set try to determine initial state directly in my functional component and that worked just fine</p><p><strong>Before</strong></p><pre>export const InitState = (initialState: ReviewPanelState) =&gt; {<br>  const hookMeUp = useMyHook(); // &lt;= PROBLEM</pre><pre>  return {<br>    ...initialState,<br>    yyy: hookMeUp.yyy,<br>  };<br>};</pre><pre>export const FunComp = ()=&gt;{<br>const initialState = {<br>    xxx: 1,<br>    yyy: 2,<br>  };</pre><pre>const [state, dispatch] = React.useReducer(MyReducerFun, initialState, InitState);</pre><pre>...aaand so onnn...<br>}</pre><p><strong>After</strong></p><pre>export const FunComp = ()=&gt; {</pre><pre>const hookMeUp = useMyHook();<br><br>const xxx =  hookMeUp.xxx;<br>const yyy =  hookMeUp.yyy;<br></pre><pre>const initialState = {<br>    xxx,<br>    yyy<br>};</pre><pre>const [state, dispatch] = React.useReducer(MyReducerFun, initialState);</pre><pre>...aaand so onnn...<br>}</pre><p>links:</p><ul><li><a href="https://reactjs.org/docs/hooks-reference.html">https://reactjs.org/docs/hooks-reference.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe421f49846c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Hooks: Component Will Mount]]></title>
            <link>https://medium.com/@stojanpeshov/react-hooks-component-will-mount-2c21ba2778a1?source=rss-d004b0aa04d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c21ba2778a1</guid>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[lifecycle-methods]]></category>
            <dc:creator><![CDATA[Stojan Peshov]]></dc:creator>
            <pubDate>Mon, 21 Oct 2019 21:23:11 GMT</pubDate>
            <atom:updated>2020-07-20T15:45:43.109Z</atom:updated>
            <content:encoded><![CDATA[<h3>C<strong>omponent Did Moun — React Hooks Way</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yl_vvNbl0rTVIZ11LaboVw.jpeg" /></figure><p>You can only use Hooks in functional components, and you can use lifecycle methods (<em>componentDidMount</em>, <em>componentDidUpdate</em>, <em>componentWillUnmount</em> etc.) in a class components.</p><p><strong>From the React doc:</strong></p><blockquote>If you’re familiar with React class lifecycle methods, you can think of useEffect Hook as componentDidMount, componentDidUpdate, and componentWillUnmount combined.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkn9Uxi99slfDII3gU113g.png" /></figure><p>So you will need to mimic lifecycle methods from<strong> class component</strong> in a <strong>functional components</strong>.</p><p>Code inside <strong>componentDidMount</strong> run once when the component is mounted. useEffect hook equivalent for this behavior is:</p><pre>useEffect(() =&gt; {<br>  // Your code here<br>}, []);</pre><p>Notice the second parameter here is empty array []. This means that it will run only once.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yPbVIfZwv9CxYobSrX5H-w.png" /></figure><p><strong>Without the second parameter</strong> the useEffect hook will be called on every render of the component which can be dangerous.</p><pre>useEffect(() =&gt; {<br>  // Your code here<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RS6XTln2ZDtuZ9fQcgrFJA.png" /></figure><p>componentWillUnmount is use for cleanup (like removing event listeners,.. etc). Say you are adding a event listener in componentDidMount and removing it in componentWillUnmount as below.</p><pre>componentDidMount() {<br>  window.addEventListener(&#39;mousemove&#39;, () =&gt; {})<br>}</pre><pre>componentWillUnmount() {<br>  window.removeEventListener(&#39;mousemove&#39;, () =&gt; {})<br>}</pre><p>Hook equivalent of above code will be something like this:</p><pre>useEffect(() =&gt; {<br>  //listener will be added on component mounted<br>  window.addEventListener(&#39;resize&#39;, () =&gt; {});</pre><pre>  //return function is called on component unmount <br>  return () =&gt; {<br>    window.removeEventListener(&#39;resize&#39;, () =&gt; {})<br>  }<br>}, [])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EFic8XJbclRbmpiOh-tPcA.png" /></figure><p>Custom hook that <strong>will run a function once before first render</strong>.</p><pre>import { useState, useEffect } from &#39;react&#39;</pre><pre>export useBeforeFirstRender (f) =&gt; {<br>  const [hasRendered, setHasRendered] = useState(false)</pre><pre>  useEffect(() =&gt; setHasRendered(true), [hasRendered])</pre><pre>  if (!hasRendered) {<br>    f()<br>  }<br>}</pre><p><strong>Usage:</strong></p><pre>import React, { useEffect } from &#39;react&#39;<br>import useBeforeFirstRender from &#39;../hooks/useBeforeFirstRender&#39;</pre><pre>export const MyComponent = () =&gt; { <br>  useBeforeFirstRender(() =&gt; {<br>    console.log(&#39;Do stuff here&#39;)<br>  })</pre><pre>  return (<br>    &lt;div&gt;<br>      My component<br>    &lt;/div&gt;<br>  )<br>}</pre><p><strong>UPDATE</strong></p><p>I found this good answer from <a href="https://mobile.twitter.com/dan_abramov">Dan Abramov</a> on his blog: <a href="https://overreacted.io/a-complete-guide-to-useeffect/#tldr">https://overreacted.io/a-complete-guide-to-useeffect/#tldr</a></p><blockquote><strong>🤔 Question: How do I replicate </strong><strong>componentDidMount with </strong><strong>useEffect?</strong></blockquote><blockquote>While you can useEffect(fn, []), it’s not an exact equivalent. Unlike componentDidMount, it will <em>capture</em> props and state. So even inside the callbacks, you’ll see the initial props and state. If you want to see “latest” something, you can write it to a ref. But there’s usually a simpler way to structure the code so that you don’t have to. Keep in mind that the mental model for effects is different from componentDidMount and other lifecycles, and trying to find their exact equivalents may confuse you more than help. To get productive, you need to “think in effects”, and their mental model is closer to implementing synchronization than to responding to lifecycle events.</blockquote><p>I like this part a lot, I think it makes sense and instead of trying to replace lifecycles with hooks we need to think in effects:</p><blockquote>Keep in mind that the mental model for effects is different from <em>componentDidMount</em> and other lifecycles, and trying to find their exact equivalents may confuse you more than help. To get productive, you need to “think in effects”, and their mental model is closer to implementing synchronization than to responding to lifecycle events</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c21ba2778a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript: Understanding the Fundamentals part 2 of xx | Name/Value pairs and Objects]]></title>
            <link>https://medium.com/@stojanpeshov/javascript-understanding-the-fundamentals-part-2-of-xx-name-value-pairs-and-objects-a252d31feaf2?source=rss-d004b0aa04d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/a252d31feaf2</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Stojan Peshov]]></dc:creator>
            <pubDate>Thu, 05 Jul 2018 21:45:26 GMT</pubDate>
            <atom:updated>2018-07-05T21:45:26.937Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*7sToR7rnQBhG4cokDEeIlg.png" /></figure><p>In JavaScript objects are incredibly important, and while developing you are going to spend a lot of time with them. Let’s first get on with name/value pairs.</p><blockquote><strong>Name/Value Pair:<br></strong>A name which maps to a unique value<br><em>The </em><strong><em>name </em></strong><em>may be defined more than once, but only can have one value in any given </em><strong><em>context</em></strong><em>.<br>The </em><strong><em>value</em></strong><em> may be more name/value pairs.</em></blockquote><p>As said the <strong>name </strong>can be defined more then once, but can have one value in any given <strong>context( </strong>and here by context we mean <strong>execution context </strong>see in part 1 of xx) that is a section of code that is running a <strong>name </strong>can only exist and be defined with one value. However, this value may be more <strong>Name/Value</strong> pairs.</p><p>It’s simple. All I’m trying to say here is that there’s a <strong>name</strong>, and that name is assigned a value, but that value can be other collection of <strong>Name/Values</strong></p><p><strong>Example: </strong>This is a <strong>Name/Value</strong> pair.</p><pre>country = &#39;Macedonia&#39;</pre><pre>//in this case country is the name and Macedonia is the value</pre><p>Now, when we’re talking about objects, we will use this <strong>Name/Value </strong>pair concept to define them.</p><blockquote><strong>Object:<br></strong>A collection of Name Value pairs<br><em>This is the simplest possible definition of JavaScript object</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jXN9CWwZuQSi4cW256Nczw.png" /></figure><p>For let’s have a name and collection of Name/Value pairs.</p><p>So, here we have a name and a value, and the first value is the list of names that have values. The second value has only one name/value.</p><p>Another more concrete example:</p><pre>Address:<br>{<br> Street: `Partizanska`<br> Number:  1020<br> Apartment: <br> { <br>  Floor: 7<br>  Number: 301<br> }<br>}</pre><p>Address is a collection of Name/Value pairs. Address is a name but the value is a collection.<br>Street: &#39;Partizanska&#39; is a Name/Value pair.<br>Number: 1020 is a Number/Value pair.<br>Apartment: is a name and it’s value is another list or of Name/Value pairs.</p><p>When we are talking of objects in JavaScript we’re talking about collection of Name/Value pairs, and that value might itself be another object.<br>At it’s core this is what an object is in JavaScript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5xG8DNKPO9QKyGfiQORg2Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a252d31feaf2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript: Understanding the Fundamentals part 1 of xx | Syntax Parsers, Execution Contexts, and…]]></title>
            <link>https://medium.com/@stojanpeshov/javascript-understanding-the-fundamentals-part-1-of-xx-syntax-parsers-execution-contexts-and-56a4c11c3d22?source=rss-d004b0aa04d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/56a4c11c3d22</guid>
            <category><![CDATA[vanilla-javascript]]></category>
            <category><![CDATA[fundamentals]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <dc:creator><![CDATA[Stojan Peshov]]></dc:creator>
            <pubDate>Tue, 03 Jul 2018 23:47:17 GMT</pubDate>
            <atom:updated>2018-07-03T23:47:17.881Z</atom:updated>
            <content:encoded><![CDATA[<h3>JavaScript: Understanding the Fundamentals part 1 of xx | Syntax Parsers, Execution Contexts, and Lexical Environments</h3><p>Syntax Parsers, Execution Contexts, and Lexical Environments are concepts and ideas that are fundamental in JavaScript and with time you will build upon them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/0*YvaHWYa5qbOZmk2Q.jpg" /></figure><p>They sound complicated but actually aren’t that difficult to understand.</p><p>Let’s break this big word:</p><blockquote><strong>Syntax Parsers</strong></blockquote><blockquote>That’s a program that reads your code and determines what it does and if it’s grammar is valid.<br><em>Your code isn’t magic. Someone else wrote a program that can translate it for the computer.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*MLi6vRsoVE7wlV4o.jpg" /></figure><p>When you write JavaScript it’s isn’t magically directly telling the computer what to do. We are abstracted away from this <strong>translation part</strong>, we are just writing code and then `something` else some program that was written from other people convert JavaScript into something that computer can understand.</p><p>Those programs are called compilers, interpreters. They read your code <strong>character </strong>by <strong>character </strong>and determining if the syntax is valid and then implementing that syntax in a way that computer can understand.</p><blockquote><strong>Lexical Environments</strong></blockquote><blockquote>Where something sits physically in the code you write.<br><em>`Lexical` means ‘having to do with words or grammar’. A lexical environment exist in programming languages in which </em><strong><em>where</em></strong><em> you write something is important.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/0*fkMynKlOSqNM8jAu.png" /></figure><p>Lexical environment exist in programming languages in which <strong>where </strong>you write something is important — meaning that where you see things written gives you an idea of where it will actually sit in the computer’s memory and <strong>how it will interact</strong> with other variables and functions and element of the program.</p><p>That syntax parses from before cares about where you put things.<br>So, when you will hear about lexical environment of something in the code it actually means about where it’s written and what surrounds it : )</p><blockquote><strong>Execution Contexts</strong></blockquote><blockquote>A wrapper to help manage the code that is running.</blockquote><figure><img alt="Image result for javascript code Execution Contexts" src="https://cdn-images-1.medium.com/proxy/1*_LacLIeET7asTTIKpHCawA.png" /></figure><p>There are lots of lexical environments areas of the code that you are looking at physically. <strong>But which one is currently actually running?</strong> Is managed by execution context. And an execution context contains your code and It can contain things beyond what you’ve written in your code<br> <br><strong><em>What do you mean things beyond my code!?</em></strong><br>Because remember our code is being translated by whole other set of programs that someone else wrote. And so, it’s executing our code and it can do other things as well and that’s what’s happening inside JavaScript.</p><blockquote>Just remember, It’s important for you to understand these terms if you want to understand fundamentals of JavaScript. They will give us a basis to understand what’s happening under the hood in JavaScript.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56a4c11c3d22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to configure the Windows Powershell to display only the current folder name]]></title>
            <link>https://medium.com/@stojanpeshov/how-to-configure-the-windows-powershell-to-display-only-the-current-folder-name-97a056f60c91?source=rss-d004b0aa04d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/97a056f60c91</guid>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[visual-studio-code]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[Stojan Peshov]]></dc:creator>
            <pubDate>Mon, 02 Jul 2018 19:12:30 GMT</pubDate>
            <atom:updated>2018-07-03T07:40:55.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LxDYdwtu8D1Z-yKw" /><figcaption>Hey there thanks for passing by.</figcaption></figure><p>For creating awesome new stuff (and maintaining old ones of course) every day I use <a href="https://code.visualstudio.com/">Visual Studio Code</a>.<br>Everything is well organized and I use it as my main tool for development.</p><p>I guess you already know how great this editor is so I won’t shoot you here with other things about VSC.</p><p>Anyway as I was using it everyday some projects would become pretty deep nested in directories, and paths to them would become long as hell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/0*uu5iyvHbj3S9MHS9.png" /></figure><p>I hate seeing that long path every time I write some command, there is no need for that.<br>In best interested is to keep things simple and focus on what is important, I already have a lot of code in front of me why bothering with long paths</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gqeMy2kFEbcElhd5" /><figcaption>Photo by <a href="https://unsplash.com/@brookanderson?utm_source=medium&amp;utm_medium=referral">Brook Anderson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>After seeing this “long path thing” as a problem and searching for some sort of solution to shorten windows powershell path I found pretty good easy and simple solution.<br><strong>It did not worked at first</strong> (of course) a lot of “how tos” are out of date and not all steps are correct(in my case file was missing wtf?! — it was not even mentioned as possible case).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zzh5OajCO6K_PHBs" /></figure><blockquote>Here is the solution:<br>1) open powershell (in VSC would be nisser) ctrl + `<br>2) $profile</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DnifGK4tgaNVdBcS" /></figure><p>And you will get your path on where that profile file is or should be located.<br>In my case it wasnt there so just follow that location, so create file in that location <br>With the same name as displayed in console — from the screenshot above <strong><em>“Microsoft.PowerShell_profile.ps1”</em></strong></p><p>Once create open it in VSC or any other editor (tip: if you click console link when holding ctrl it will open in VSC ; ) )</p><blockquote><strong>Add this code into this file:</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b0b79d8ab6ceb186e4d00297da518de/href">https://medium.com/media/2b0b79d8ab6ceb186e4d00297da518de/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/0*VJpgcQ7WfnNxYiM_" /></figure><p><strong>And the result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*kSaRXj8o84i3yfkG" /></figure><p>You can edit last line however you want just keep that $p variable there<br><strong>Test case for that:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/0*kSCxEnKW6p9LBZ2d" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97a056f60c91" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>