<?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>Forem: Kapil Gorve</title>
    <description>The latest articles on Forem by Kapil Gorve (@kapilgorve).</description>
    <link>https://forem.com/kapilgorve</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%2F52023%2Fe9081e21-97ad-4129-b2ba-23f3898d8732.jpg</url>
      <title>Forem: Kapil Gorve</title>
      <link>https://forem.com/kapilgorve</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kapilgorve"/>
    <language>en</language>
    <item>
      <title>Create bootstrap like columns using css grid</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Wed, 27 May 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/create-bootstrap-like-columns-using-css-grid-1a13</link>
      <guid>https://forem.com/kapilgorve/create-bootstrap-like-columns-using-css-grid-1a13</guid>
      <description>&lt;h2&gt;
  
  
  Create responsive columns
&lt;/h2&gt;

&lt;p&gt;Create a container and three children. These three children each will occupy 33% available width. We are going to use css grid to create this columns like structure. We are adding background and height to make better visual comparison.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;div class="container"&amp;gt;
      &amp;lt;div class="item"&amp;gt;1&amp;lt;/div&amp;gt;
      &amp;lt;div class="item"&amp;gt;2&amp;lt;/div&amp;gt;
      &amp;lt;div class="item"&amp;gt;3&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;

&amp;lt;style&amp;gt;
.item {
    height: 100px;
    background: yellow;
}
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;So it will look like this. &lt;a href="///static/f7b276b20678876bf39e134b005dcbed/7d013/html.jpg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eGzcLAvb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.jskap.com/static/f7b276b20678876bf39e134b005dcbed/7d013/html.jpg" alt="html"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's add &lt;code&gt;display:grid&lt;/code&gt; property to the container. We will use &lt;code&gt;grid-template-columns&lt;/code&gt; property to specify children responsive widths.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    display: grid;
    grid-template-columns: auto auto auto;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now three-item children each should take 33% width available on the screen. Make sure to match the number of children and their width in &lt;code&gt;grid-template-columns&lt;/code&gt;. The width taken by children is responsive. So it will be relative to their parent width. It will take the respective % width available to their parent element.&lt;/p&gt;

&lt;p&gt;Now it will look like this -&lt;/p&gt;

&lt;p&gt;&lt;a href="///static/7fd03cbeb7d98cce78e67666ec0a59dc/7b510/columns.jpg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jBsh4y2j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.jskap.com/static/7fd03cbeb7d98cce78e67666ec0a59dc/7b510/columns.jpg" alt="columns"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using &lt;code&gt;grid-template-columns&lt;/code&gt; you can specify number of columns and their widths for a grid container element. What if you want to add some gap between those columns without specifying external margin ? We can use &lt;code&gt;grid-gap&lt;/code&gt; for that. Let's add 20px gap between these columns.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    display: grid;
    grid-template-columns: auto auto auto;
    grid-gap: 20px;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now it will look like this -&lt;/p&gt;

&lt;p&gt;&lt;a href="///static/b0bd2ccebcb012d91700411fabc1c7fa/b768e/gap.jpg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iEJQHrui--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.jskap.com/static/b0bd2ccebcb012d91700411fabc1c7fa/b768e/gap.jpg" alt="gap"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CSS grid is a powerful feature to create complex responsive layouts. We don't need special library to create responsive layouts if we take advantage of features like CSS grid and flexbox.&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>aws cli s3 commands</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Thu, 30 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/aws-cli-s3-commands-39bc</link>
      <guid>https://forem.com/kapilgorve/aws-cli-s3-commands-39bc</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qDmOHC-S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3Daws%2520cli%2520s3%2520commands%26tags%3DProgramming%2Caws" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qDmOHC-S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3Daws%2520cli%2520s3%2520commands%26tags%3DProgramming%2Caws" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  List buckets
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws s3 ls

Output:
Microsoft Windows [Version 10.0.19041.207]
(c) 2020 Microsoft Corporation. All rights reserved.

D:\work&amp;gt;aws s3 ls
2018-11-22 12:23:27 kapilgorve
2020-01-08 10:36:12 macosimage

D:\work&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  List files and folders inside a bucket.
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws s3 ls kapilgorve/

Output:
D:\work&amp;gt;aws s3 ls kapilgorve/
                           PRE all/
                           PRE covers/
                           PRE push-notification-react-native/
2019-04-28 14:03:03 0

D:\work&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Copy single file to s3
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws s3 cp test.jpg s3://kapilgorve/blog/covers/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Copy single file to s3 and make public
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws s3 cp test.jpg s3://kapilgorve/blog/covers/ --acl public-read
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Copy complete folder to s3
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws s3 cp myfolder s3://kapilgorve/ --recursive
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>aws</category>
    </item>
    <item>
      <title>How to move WSL2 distro</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Wed, 29 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/how-to-move-wsl2-distro-1d24</link>
      <guid>https://forem.com/kapilgorve/how-to-move-wsl2-distro-1d24</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gHrq3O5s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DHow%2520to%2520move%2520WSL2%2520distro%26tags%3DWindows10%2Cwsl%2CLinux%2CProgramming" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gHrq3O5s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DHow%2520to%2520move%2520WSL2%2520distro%26tags%3DWindows10%2Cwsl%2CLinux%2CProgramming" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Edit -
&lt;/h2&gt;

&lt;p&gt;As pointed out by &lt;code&gt;lxrunoffline&lt;/code&gt; &lt;a href="https://github.com/DDoSolitary/LxRunOffline/issues/90"&gt;author&lt;/a&gt;, it is supported to move WSL2 distro. No conversion needed. This post is applicable for older &lt;code&gt;lxrunoffline&lt;/code&gt; versions. If you are on latest version follow this post - &lt;a href="https://dev.to/blog/install-move-wsl-distro-from-c-drive-to-another-drive/"&gt;/blog/install-move-wsl-distro-from-c-drive-to-another-drive/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use &lt;code&gt;LxRunOffline&lt;/code&gt; tool to move WSL 1 distros. I faced errors for moving wsl2 distro. You need to convert your distro to v1 and then move. Then convert again to v2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Move WSL2 distro from C drive
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install &lt;code&gt;LxRunOffline&lt;/code&gt; tool. &lt;code&gt;choco install lxrunoffline&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - Stop your distro.
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;wsl --list --verbose&lt;/code&gt; List all the installed distros on your system. I get output like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;D:\work&amp;gt;wsl --list --verbose
NAME STATE VERSION
docker-desktop Stopped 2
Ubuntu-18.04 Stopped 2
docker-desktop-data Stopped 2
D:\work&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;wsl --set-version Ubuntu-18.04 1&lt;/code&gt; This will convert your distro from v2 to v1.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lxrunoffline move -n Ubuntu-18.04 -d G:\wsl\&lt;/code&gt;. Move your distro to another drive. My distro name here is &lt;code&gt;Ubuntu-18.04&lt;/code&gt;. I am moving it to &lt;code&gt;G drive&lt;/code&gt; and &lt;code&gt;wsl&lt;/code&gt; folder inside it. It would take some time to finish moving.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;wsl --set-version Ubuntu-18.04 2&lt;/code&gt; This will convert your distro from v1 to v2 again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it. You can start to use your distro again.&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>windows10</category>
      <category>wsl</category>
      <category>linux</category>
      <category>programming</category>
    </item>
    <item>
      <title>What are the things you found difficult while working with ReactJs ?</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Tue, 28 Apr 2020 11:37:49 +0000</pubDate>
      <link>https://forem.com/kapilgorve/what-are-the-things-you-found-difficult-while-working-with-reactjs-2125</link>
      <guid>https://forem.com/kapilgorve/what-are-the-things-you-found-difficult-while-working-with-reactjs-2125</guid>
      <description>&lt;p&gt;Context - Like getting a job with React. Writing React Code. OSS solutions in React. Experience with the community. Available resources. Working as a Team with React codebase. &lt;/p&gt;

&lt;p&gt;For me - Not learning Redux prevented me from lot of jobs. I had a difficult time learning Redux. &lt;/p&gt;

</description>
      <category>discuss</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Move/Install WSl distro from C drive to another drive</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Sun, 26 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/move-install-wsl-distro-from-c-drive-to-another-drive-19g9</link>
      <guid>https://forem.com/kapilgorve/move-install-wsl-distro-from-c-drive-to-another-drive-19g9</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0ec02qDV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kapilgorve.s3.ap-south-1.amazonaws.com/blog/covers/wsl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0ec02qDV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kapilgorve.s3.ap-south-1.amazonaws.com/blog/covers/wsl.jpg" alt="'cover'"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have a small 128GB SSD. I run out of space when I install ReactNative related dev tools. So I wanted to find a way to install/move my existing distro to different location than C drive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Move WSL to another drive
&lt;/h2&gt;

&lt;h2&gt;
  
  
  - Install &lt;code&gt;LxRunOffline&lt;/code&gt; tool. &lt;code&gt;choco install lxrunoffline&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;lxrunoffline list&lt;/code&gt; List all the installed distros on your system. I get output like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Microsoft Windows [Version 10.0.19041.207]
(c) 2020 Microsoft Corporation. All rights reserved.
D:\work&amp;gt;lxrunoffline list
Ubuntu-18.04
docker-desktop
docker-desktop-data
D:\work&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;lxrunoffline move -n Ubuntu-18.04 -d G:\wsl\&lt;/code&gt; . Move your distro to another drive. My distro name here is &lt;code&gt;Ubuntu-18.04&lt;/code&gt;. I am moving it to &lt;code&gt;G drive&lt;/code&gt; and &lt;code&gt;wsl&lt;/code&gt; folder inside it. It would take some time to finish moving.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can use the same move command to move your distro from default location to a different location inside C Drive.&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>windows10</category>
      <category>wsl</category>
      <category>linux</category>
      <category>programming</category>
    </item>
    <item>
      <title>Set environment variable in Windows and WSL Linux in terminal</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Tue, 21 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/set-environment-variable-in-windows-and-wsl-linux-in-terminal-3mg4</link>
      <guid>https://forem.com/kapilgorve/set-environment-variable-in-windows-and-wsl-linux-in-terminal-3mg4</guid>
      <description>&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%2Fkapilgorve.s3.ap-south-1.amazonaws.com%2Fblog%2Fcovers%2Fwsl.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%2Fkapilgorve.s3.ap-south-1.amazonaws.com%2Fblog%2Fcovers%2Fwsl.jpg" alt="'cover'"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Windows set env variable from the command line
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Open command line. &lt;code&gt;set API_KEY=123&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;echo %API_KEY%&lt;/code&gt; should print your &lt;code&gt;API_KEY&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;This env variable is set for the context of the current cmd line.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Windows set env variable permanently using the command line
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Open the command line as admin. &lt;code&gt;setx API_KEY "123" /M&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Close the current shell. Open a new shell.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;echo %API_KEY%&lt;/code&gt; should print your &lt;code&gt;API_KEY&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;This env variable is set for all future shell instances permanently for your system.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  WSL Linux set env variable from a bash terminal
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Launch your wsl instance.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$ API_KEY=123&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$ echo $API_KEY&lt;/code&gt; should print your &lt;code&gt;API_KEY&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  WSL Linux set env variable permanently from a bash terminal
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Launch your wsl instance.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$ sudo vim ~/.bashrc&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Enter your password.&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;i&lt;/code&gt; to go into edit mode. Go to the end of the file using arrow key.&lt;/li&gt;
&lt;li&gt;Add your variable as &lt;code&gt;API_KEY=123&lt;/code&gt; at the end of the file. If your variable has spaces, use quotes.Example - &lt;code&gt;API_KEY= 'My Key'&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;esc&lt;/code&gt; key to get out of edit mode.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;:wq&lt;/code&gt; and press enter . This will save and close the file.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$ source ~/.bashrc&lt;/code&gt; will load your recent changes into your current shell.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$ echo $API_KEY&lt;/code&gt; should print your &lt;code&gt;API_KEY&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post was originally published at &lt;a href="https://www.jskap.com/blog/set-environment-variables-windows-wsl-linux/" rel="noopener noreferrer"&gt;https://www.jskap.com/blog/set-environment-variables-windows-wsl-linux/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve" rel="noopener noreferrer"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>windows10</category>
      <category>wsl</category>
      <category>programming</category>
    </item>
    <item>
      <title>GatsbyJs - Add environment variables</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Mon, 20 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/gatsbyjs-add-environment-variables-1io5</link>
      <guid>https://forem.com/kapilgorve/gatsbyjs-add-environment-variables-1io5</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--99_61i_V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DGatsbyJs%2520-%2520Add%2520environment%2520variables%26tags%3DGatsbyJs%2CWindows10%2CLinux" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--99_61i_V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DGatsbyJs%2520-%2520Add%2520environment%2520variables%26tags%3DGatsbyJs%2CWindows10%2CLinux" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Development Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create a new file named as &lt;code&gt;.env.development&lt;/code&gt; at the root of your project.&lt;/li&gt;
&lt;li&gt;Add your variable to the newly created file. Example - &lt;code&gt;TEST_KEY=123&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Change your &lt;code&gt;npm run develop&lt;/code&gt; command to set environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Windows -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    "develop": "set GATSBY_ENV=development &amp;amp;&amp;amp; gatsby develop"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;For Linux -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    "develop": "GATSBY_ENV=development gatsby develop"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Restart your dev environment. So Gatsby will load your new env file.&lt;/li&gt;
&lt;li&gt;You should be able to access your env variables using &lt;code&gt;process.env.TEST_KEY&lt;/code&gt; in any js file.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Production Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create a new file named as &lt;code&gt;.env.production&lt;/code&gt; at the root of your project.&lt;/li&gt;
&lt;li&gt;Add your variable to the newly created file. Example - &lt;code&gt;TEST_KEY=123&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Change your &lt;code&gt;npm run build&lt;/code&gt; command to set environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Windows -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    "develop": "set GATSBY_ENV=production &amp;amp;&amp;amp; gatsby develop"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;For Linux -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    "build": "GATSBY_ENV=production gatsby build",
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is only if you want to build on local.&lt;/p&gt;

&lt;p&gt;If you are using any providers like Netlify use the Linux version. You will also need to add environment variables in the service provider.&lt;/p&gt;

&lt;p&gt;For Netlify it is in &lt;code&gt;Site Settings &amp;gt; Build&amp;amp;Deploy &amp;gt; Environment&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This post was originally published at &lt;a href="https://www.jskap.com/blog/gatsby-add-environment-variables/"&gt;https://www.jskap.com/blog/gatsby-add-environment-variables/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>windows10</category>
      <category>linux</category>
    </item>
    <item>
      <title>Gatsby Error - Do not use quotes and apostrophe in frontmatter properties</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Sun, 19 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/gatsby-error-do-not-use-quotes-and-apostrophe-in-frontmatter-properties-bkk</link>
      <guid>https://forem.com/kapilgorve/gatsby-error-do-not-use-quotes-and-apostrophe-in-frontmatter-properties-bkk</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OI7p7nSP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DGatsby%2520Error%2520-%2520Do%2520not%2520use%2520quotes%2520and%2520apostrophe%2520in%2520frontmatter%2520properties%26tags%3DGatsbyJs" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OI7p7nSP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DGatsby%2520Error%2520-%2520Do%2520not%2520use%2520quotes%2520and%2520apostrophe%2520in%2520frontmatter%2520properties%26tags%3DGatsbyJs" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Error Message - &lt;code&gt;can not read a block mapping entry; a multiline key may not be an implicit key at line&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I was using Apostrophe in the title. This is a parsing error. Remove quotes or apostrophe from your markdown frontmatter properties.&lt;/p&gt;

&lt;p&gt;This post was originally published at &lt;a href="https://www.jskap.com/notes/gatsby-error-cannot-read-block-mapping-entry/"&gt;https://www.jskap.com/notes/gatsby-error-cannot-read-block-mapping-entry/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gatsby</category>
    </item>
    <item>
      <title>Create React App Error - Template not provided</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Mon, 13 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/create-react-app-error-template-not-provided-pk</link>
      <guid>https://forem.com/kapilgorve/create-react-app-error-template-not-provided-pk</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eKQgYPEf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kapilgorve.s3.ap-south-1.amazonaws.com/blog/covers/cra.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eKQgYPEf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kapilgorve.s3.ap-south-1.amazonaws.com/blog/covers/cra.jpg" alt="''"&gt;&lt;/a&gt;&lt;sup&gt;Photo from &lt;a href="https://create-react-app.dev//"&gt;CRA Docs&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create React App Error
&lt;/h2&gt;

&lt;p&gt;Error Message - &lt;code&gt;A template was not provided. This is likely because you're using an outdated version of create-react-app.&lt;br&gt;
Please note that global installs of create-react-app are no longer supported.&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;New versions of Create React App doesn't support global installs. Remove it globally.Try &lt;code&gt;npm uninstall -g create-react-app&lt;/code&gt;. Then try again. Didn't work for me. Even after removing &lt;code&gt;create-react-app&lt;/code&gt; globally. If your system has any projects using CRA in parent directory npm will pick up that version.&lt;/p&gt;

&lt;p&gt;Try &lt;code&gt;npx --ignore-existing create-react-app my-app&lt;/code&gt;. This will ignore any installs you have in your system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Solution
&lt;/h2&gt;

&lt;p&gt;I had to manually remove CRA from global installs.Windows path - &lt;code&gt;C:\Users\your_username\AppData\Roaming\npm&lt;/code&gt; .Delete file named &lt;code&gt;create-react-app&lt;/code&gt; and &lt;code&gt;create-react-app.cmd&lt;/code&gt;.On Unix systems it should be located in - &lt;code&gt;/usr/local/bin&lt;/code&gt;. Don' forget to remove executable file. For windows it was &lt;code&gt;.cmd&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;CRA - &lt;code&gt;create-react-app&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This post was originally published at &lt;a href="https://www.jskap.com/notes/create-react-app-template-not-provided/"&gt;https://www.jskap.com/notes/create-react-app-template-not-provided/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
    </item>
    <item>
      <title>React Testing Library fireEvent.change example</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Thu, 09 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/react-testing-library-fireevent-change-example-25jk</link>
      <guid>https://forem.com/kapilgorve/react-testing-library-fireevent-change-example-25jk</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BEUuVvwu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DReact%2520Testing%2520Library%2520fireEvent.change%2520example%26tags%3DReact%2CTesting" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BEUuVvwu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DReact%2520Testing%2520Library%2520fireEvent.change%2520example%26tags%3DReact%2CTesting" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import { cleanup, render, fireEvent } from '@testing-library/react';

import App from './App';

afterEach(cleanup);

it('Enter principal amount', async () =&amp;gt; {
  const { getByTestId } = render(&amp;lt;App /&amp;gt;);
  const principalInputElement = getByTestId('principalInput') as HTMLInputElement;
  fireEvent.change(principalInputElement, {target: {value: '20000'}});
  expect(getByTestId('emititle')).toHaveTextContent('1758');
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This post was originally published at &lt;a href="https://www.jskap.com/notes/react-testing-library-fireevent-change/"&gt;https://www.jskap.com/notes/react-testing-library-fireevent-change/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>testing</category>
    </item>
    <item>
      <title>How to exit Vim</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Wed, 08 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/how-to-exit-vim-2chk</link>
      <guid>https://forem.com/kapilgorve/how-to-exit-vim-2chk</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nua2PeKH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DHow%2520to%2520exit%2520Vim%26tags%3DLinux" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nua2PeKH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DHow%2520to%2520exit%2520Vim%26tags%3DLinux" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Press &lt;code&gt;esc&lt;/code&gt; key.&lt;/li&gt;
&lt;li&gt;Type, &lt;code&gt;:q&lt;/code&gt;, press return.&lt;/li&gt;
&lt;li&gt;Type, &lt;code&gt;:wq&lt;/code&gt;, press return (If you wanna save)OR&lt;/li&gt;
&lt;li&gt;Type, &lt;code&gt;:q!&lt;/code&gt;, press return (If you don't wanna save)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This post was originally published at &lt;a href="https://www.jskap.com/notes/how-to-exit-vim/"&gt;https://www.jskap.com/notes/how-to-exit-vim/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>Newsletter lesson learned -Dont use free emails like Gmail</title>
      <dc:creator>Kapil Gorve</dc:creator>
      <pubDate>Wed, 08 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/kapilgorve/newsletter-lesson-learned-dont-use-free-emails-like-gmail-2h8a</link>
      <guid>https://forem.com/kapilgorve/newsletter-lesson-learned-dont-use-free-emails-like-gmail-2h8a</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TmcZjdMs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DNewsletter%2520lesson%2520learned%2520-Dont%2520use%2520free%2520emails%2520like%2520Gmail%26tags%3DNewsletter" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TmcZjdMs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://friendly-heyrovsky-86d9f9.netlify.app/opengraph%3F%26author%3Dkapilgorve%26title%3DNewsletter%2520lesson%2520learned%2520-Dont%2520use%2520free%2520emails%2520like%2520Gmail%26tags%3DNewsletter" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Always use professional email ex- &lt;a href="mailto:john@snow.com"&gt;john@snow.com&lt;/a&gt; rather than free email ex &lt;a href="mailto:john@gmail.com"&gt;john@gmail.com&lt;/a&gt; for sending mass emails/newsletters.&lt;/p&gt;

&lt;p&gt;Free email providers like Gmail, Yahoo etc will mark your sender email as spam by default. This is the official policy from these email providers. They are meant for personal use.&lt;/p&gt;

&lt;p&gt;My delivery rate jumped from 20% to 80% just by making a switch in email sender.&lt;/p&gt;

&lt;p&gt;This post was originally published at &lt;a href="https://www.jskap.com/notes/newsletter-lesson-leared-dont-use-free-emails/"&gt;https://www.jskap.com/notes/newsletter-lesson-leared-dont-use-free-emails/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at &lt;a href="https://twitter.com/kapilgorve"&gt;https://twitter.com/kapilgorve&lt;/a&gt;&lt;/p&gt;

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