<?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: Arihant Verma</title>
    <description>The latest articles on DEV Community by Arihant Verma (@arihantverma).</description>
    <link>https://dev.to/arihantverma</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%2F32846%2F4deaed2b-7487-4625-9d3c-cb80b72000e7.jpeg</url>
      <title>DEV Community: Arihant Verma</title>
      <link>https://dev.to/arihantverma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arihantverma"/>
    <language>en</language>
    <item>
      <title>Interfaces, Polymorphism, Symbols and Iterators in JavaScript</title>
      <dc:creator>Arihant Verma</dc:creator>
      <pubDate>Thu, 22 Aug 2024 11:40:00 +0000</pubDate>
      <link>https://dev.to/arihantverma/interfaces-polymorphism-symbols-and-iterators-in-javascript-4j74</link>
      <guid>https://dev.to/arihantverma/interfaces-polymorphism-symbols-and-iterators-in-javascript-4j74</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/eW6nVCb9MQ8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>interface</category>
      <category>symbol</category>
      <category>iterator</category>
    </item>
    <item>
      <title>Workaround for _next/data URLs throwing 404, for multiple Next.js Apps Running On Same Domain</title>
      <dc:creator>Arihant Verma</dc:creator>
      <pubDate>Mon, 19 Jul 2021 12:49:37 +0000</pubDate>
      <link>https://dev.to/arihantverma/workaround-for-next-data-urls-throwing-404-for-multiple-next-js-apps-running-on-same-domain-3pok</link>
      <guid>https://dev.to/arihantverma/workaround-for-next-data-urls-throwing-404-for-multiple-next-js-apps-running-on-same-domain-3pok</guid>
      <description>&lt;p&gt;If you have to use multiple Next.js apps on a simple domain, the only straightforward way for you to do that is to have &lt;a href="https://nextjs.org/docs/api-reference/next.config.js/basepath"&gt;&lt;code&gt;baseUrl&lt;/code&gt;&lt;/a&gt; option set in &lt;code&gt;next.config.js&lt;/code&gt;. But the problem with that is, you'll have different URLs for different apps on your domain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;example.com/app-1/some-route
example.com/app-2/some-other-route
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to do have them as so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;example.com/some-route ( from app-1 )
example.com/some-other-route ( from app-2 )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you're a little out of luck. My first hunch was that it'd be possible to use the &lt;code&gt;baseUrl&lt;/code&gt; but change the anchor links from&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;/app-1/some-route-on-some-page
/app-2/some-route-on-some-page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;some-route-on-some-page
some-route-on-some-page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;by using the &lt;a href="https://nextjs.org/docs/api-reference/next/link"&gt;&lt;code&gt;as&lt;/code&gt;&lt;/a&gt; property of &lt;code&gt;next/link&lt;/code&gt; by masking the URLs that users will see, while still being able to request the correct base-path-added url from next server. As much as I could google, it's not possible. If you've made it work, please tell me on the &lt;a href="https://twitter.com/gdadsriver"&gt;twitter&lt;/a&gt;, I'd be very grateful 🌻.&lt;/p&gt;

&lt;p&gt;I ended up making it work at my job by doing a bunch of things.&lt;/p&gt;

&lt;p&gt;Using &lt;a href="https://nextjs.org/docs/api-reference/next.config.js/cdn-support-with-asset-prefix"&gt;asset prefix&lt;/a&gt; to make a distinguishing factor between assets of different next.js apps, along with a &lt;a href="https://nextjs.org/docs/api-reference/next.config.js/rewrites"&gt;next.js re write rule&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// next.config.js&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;assetPrefix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BASE_PREFIX_FOR_APP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;rewrites&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="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;BASE_PREFIX_FOR_APP&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/_next/:path*`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;_next/:path*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this, the client will request assets from &lt;code&gt;${BASE_PREFIX_FOR_APP}/_next/:path*&lt;/code&gt;, but it'll reach your app at a path that it serves assets from &lt;code&gt;/_next/:path*&lt;/code&gt; ( &lt;code&gt;/_next/static/*&lt;/code&gt; to be more precise ).&lt;/p&gt;

&lt;p&gt;In a similar fashion, you'd handle images and api request paths&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// next.config.js&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;assetPrefix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BASE_PREFIX_FOR_APP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;rewrites&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="p"&gt;{&lt;/span&gt;
        &lt;span class="cm"&gt;/** ASSET PREFIX */&lt;/span&gt;
        &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;BASE_PREFIX_FOR_APP&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/_next/:path*`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/_next/:path*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="cm"&gt;/** IMAGE PREFIX */&lt;/span&gt;
        &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;BASE_PREFIX_FOR_APP&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/images/:query*`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/_next/image/:query*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="cm"&gt;/** API PREFIX */&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;BASE_PREFIX_FOR_APP&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/api/:path*`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api/:path*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For images you'll have to wrap &lt;code&gt;next/image&lt;/code&gt; component in your own component, to request your images with the prefix &lt;code&gt;BASE_PREFIX_FOR_APP&lt;/code&gt;, using a &lt;a href="https://nextjs.org/docs/api-reference/next/image#loader"&gt;custom Next.js image loader&lt;/a&gt;&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="c1"&gt;// CustomImage.tsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Image&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;next/image&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CustomImage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;Image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;finalProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;quality&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;urlQuery&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`?url=/images&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;BASE_PREFIX_FOR_APP&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/images&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;urlQuery&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;amp;w=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;amp;q=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;quality&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;CustomImage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All was well and good, and the apps were running fine with the requirements that we had: not having to change our links with app specific base path prefix. But there was still a problem.&lt;/p&gt;

&lt;p&gt;When you use a &lt;code&gt;next/link&lt;/code&gt; to navigate to another route, and that upcoming route has a &lt;code&gt;getServerSideProps&lt;/code&gt; method implemented, Next.js will send an API request to the server, which will run &lt;code&gt;getServerSideProps&lt;/code&gt; and return a JSON containing the result. You can read about this in &lt;a href="https://nextjs.org/docs/basic-features/data-fetching#only-runs-on-server-side"&gt;Next.js docs here&lt;/a&gt;. That resulted JSON fetch request data is used to render the upcoming route. Those data fetch requests have a path that looks like this: &lt;code&gt;_next/data/&amp;lt;build-id&amp;gt;/&amp;lt;route-slug&amp;gt;.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The problem with that for our context — to be able to run multiple Next.js apps on same domain without base url prefix — is that Next.js doesn't give us a way to control this path. Which is to say there's no &lt;strong&gt;&lt;em&gt;data fetch request path URL prefix&lt;/em&gt;&lt;/strong&gt; which Next.js gives as a configuration option. Because of that we have a hard time finding a distinguishing factor for data URLs for multiple apps.&lt;/p&gt;

&lt;p&gt;The fix we ended up using is as follows:&lt;/p&gt;

&lt;p&gt;Remember that the data fetch url looks like &lt;code&gt;_next/data/&amp;lt;build-id&amp;gt;/&amp;lt;route_slug&amp;gt;.json&lt;/code&gt;. If we could have a way generate unique &lt;code&gt;&amp;lt;build-id&amp;gt;&lt;/code&gt; for all our apps, we could use that and write a re write rule at load balancer level to distinguish the request between multiple Next.js apps. By default the &lt;code&gt;&amp;lt;build-id&amp;gt;&lt;/code&gt; is a random id generated by Next.js build process for each build. &lt;a href="https://nextjs.org/docs/api-reference/next.config.js/configuring-the-build-id"&gt;Thankfully they give us a way to control the build id&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We ended up using a package called &lt;a href="https://github.com/nexdrew/next-build-id#readme"&gt;&lt;code&gt;next-build-id&lt;/code&gt;&lt;/a&gt; to configure a custom build id where we gave a &lt;code&gt;app-1-&amp;lt;git-commitSHA&amp;gt;&lt;/code&gt; signature and added a re write rule in our load balancer for incoming request host name having &lt;code&gt;app-1&lt;/code&gt; for first app, &lt;code&gt;app-2&lt;/code&gt; for second app and so on and so forth, to solve this.&lt;/p&gt;

&lt;p&gt;Hope this was helpful.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>tech</category>
      <category>code</category>
      <category>javascript</category>
    </item>
    <item>
      <title>The Problem With Rockstar Culture In Tech</title>
      <dc:creator>Arihant Verma</dc:creator>
      <pubDate>Fri, 02 Jul 2021 19:05:34 +0000</pubDate>
      <link>https://dev.to/arihantverma/the-problem-with-rockstar-culture-in-tech-4onb</link>
      <guid>https://dev.to/arihantverma/the-problem-with-rockstar-culture-in-tech-4onb</guid>
      <description>&lt;h2&gt;
  
  
  Disclaimer
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;These points are made out of observation and experience and in no way attempts to generalise.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Let's Talk Rockstar Culture In Tech
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;It's draining, impersonal and segregating but monetarily rewarding.&lt;/li&gt;
&lt;li&gt;Values only outputs rather than processes that enable tech innovations and helps multiple people reach results. In this process, the silent hard workers, who might have tremendous potential to make tech that makes business product development extremely easy are seldom recognized.&lt;/li&gt;
&lt;li&gt;It's doesn't necessarily lead to collaboration.&lt;/li&gt;
&lt;li&gt;It isn't a good motivator.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;It's tightly coupled with performance based appraisal. It feels like school and college exams all over again.&lt;/p&gt;

&lt;p&gt;Imagine being able to choose between two motivators&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Having the privilege to work with the people who are much smarter than you.&lt;/li&gt;
&lt;li&gt;Chasing a variable pay based on performance, &lt;a href="web.archive.org/web/20210628231425/https://kyleshevlin.com/whats-going-on-mid-2021"&gt;where most of the work demands that you sit alone and code&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Which one would you choose? It's surprising – the amount of work that a company can get done if they hire top of the skill developers, &lt;a href="https://www.goodreads.com/book/show/49099937-no-rules-rules"&gt;drop the appraisal system altogether&lt;/a&gt; and &lt;a href="https://www.goodreads.com/book/show/36417234-powerful?ac=1&amp;amp;from_search=true&amp;amp;qid=PAnPc88Y2l&amp;amp;rank=1"&gt;just pay them properly instead, while leaving them to do wonderful things together.&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It doesn't aid learning. But then again, most of the tech jobs are a tradeoff — making things just work, rather than doing things properly in the best way possible, because of course, the company doesn't have time to slow down the pace. If they do they tend to suffer. Maybe there's a middle ground? ( Hint: It's hiring people smarter than each other ).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It values hustling culture: late night working, celebrating achieving things quickly at the cost of mental and physical health. Of course HR and leadership in such companies would ask their employees to value their health first. But the stature in doing so silently slips through the back door, because in doing so, one wouldn't be able to perform as much as over working would help achieve.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It leaves people, especially programmers in this weird mental space where when once in a blue moon they get free time before their late bed time, they feel restless, jittery, not being able to rest, because they've gotten so used to working that they don't know what to do otherwise, anymore.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>culture</category>
      <category>tech</category>
      <category>work</category>
    </item>
    <item>
      <title>Observations and Experiences Earning Money Through Codementor</title>
      <dc:creator>Arihant Verma</dc:creator>
      <pubDate>Tue, 04 May 2021 22:05:29 +0000</pubDate>
      <link>https://dev.to/arihantverma/observations-and-experiences-earning-money-through-codementor-141l</link>
      <guid>https://dev.to/arihantverma/observations-and-experiences-earning-money-through-codementor-141l</guid>
      <description>&lt;p&gt;I don't remember when I started following &lt;a href="https://twitter.com/sunilc_"&gt;Sunil&lt;/a&gt; on Twitter. He's a developer who — apart from his day job — invests a lot of time in curating development resources in Twitter threads. He has a significantly large Twitter following. He spends a lot of free time freelancing. He also writes ebooks about developer platforms, passive income generation, freelancing, his developer experiences, how to become a better developer, &lt;a href="https://gumroad.com/l/joCkt"&gt;which he sells&lt;/a&gt;. Once, I saw him tweet about a platform called &lt;a href="https://codementor.io"&gt;codementor.io&lt;/a&gt;. After that tweet I repeatedly saw him tweet about how easy it was and how nice it felt to just help someone out with their doubts or help debug somebody's code and make easy money out of it.&lt;/p&gt;

&lt;p&gt;So I decided to try it out. And he was right. It really is easy pocket money coming in on the side. I earned a little over my rent's money in about a month, helping people with their doubts about JavaScript, React, Redux, Typescript and CSS styling in my free time.&lt;/p&gt;

&lt;p&gt;I got to talk to a lot of people, ranging from different behaviours, cultures, hailing from different countries, with varied experience levels.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;A couple of super humble and eager to learn university students. What I learnt observing how they learnt was how aggresive they were towards getting their code working, not minding if they were doing things properly, or if they were handling edge cases or doing error handling upfront.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A person who had taken a project from someone and was seeking out help on it. Kinda like subletting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A person in his mid 30s or early 40s. A mobile app developer, who had just inherited a React Redux web app code in a Create React App setup. He took notes by hand old school. I was able to help him get a general understanding of React and JavaScript ecosystem at large, and give him detailed suggestions as we walked through the codebase – surprisingly well written and commented. The amount of research, learning and follow up that he conveyed through chat messages afterwards was inspiring. He came up with smart doubts and questions and I loved resolving them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A bootcamp student, a woman, who was doing her last project assignment. React on frontend with a Ruby on Rails backend. She had trouble making sense of React state across components and React Router usage. She sounded polite but panicked. She had a southern US accent. It was the first time I'd talked and listened to someone with one, outside of Hollywood movies. It was inspiring that she was seeking help. But by the sound of her voice I sensed that nobody until then had been able to explain to her some of the concepts that I did. When I asked her if I could help her run VS Code live share session because zoom's remote control was excruciatingly slow, she got worried that the live session will be live for anybody to see, which was sweet. But by the amount of tension she seemed to be was evident, even though she did a good job to cover it up with her naturally calming and polite voice. She asked me if I'd be willing to help her learn JavaScript in a better way, since things got rushed, as they often do, in the bootcamp.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A machine learning veteran. Having sold a couple of technology companies in the US, he had decided to not start a new one and instead work with an existing company. Hailing from Malleshwaram in Bangalore, we bonded over having lived in the same city. He told me that he had gone to Kendra Vidyalaya there. He then went onto study in the US and eventually settled there. He was trying UI development with React for the first time, working on a personal project. Being the experienced person he is, he had already found a couple of hackish solutions, albeit wrong, to the problem he had approached on the platform for. When I helped him learn to resolve the problem in the most correct 'React-y' way, he was elated. He gave me his number and email id and asked me to talk with him in case I'd need a job in Bangalore anytime, with possibly the double income that I'd have in mind. I was humbled and felt a little shy. I told him, I'd definitely let him know when need be. I helped him once again with some layouting.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From this experience I observed a very alarming fact – I had come across with all the people who had either started themselves out, or somebody else had started them out to learn web development in a way that might be misleading. I say that because I was started with learning web development the same way — through focussing too much on frameworks and not stressing more on the underlying foundations.&lt;/p&gt;

&lt;p&gt;The coming of a new bare bones React framework called &lt;a href="https://www.youtube.com/watch?v=4dOAFJUOi-s&amp;amp;ab_channel=Remix"&gt;Remix&lt;/a&gt; felt surprisingly liberating, because using it, one would actually be forced to code in a way that takes care of progressive enhancement (an app would work fine end to end even without JavaScript with all the forms and things and what have you). Inspired by remix and Sarah Drasner's Github tagline&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Comprehension Over Configuration&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Over the next several weeks I'm going to embark on the journey to read through the &lt;a href="https://github.com/GoogleChrome/web.dev"&gt;web.dev&lt;/a&gt; codebase and share my learnings from there.&lt;/p&gt;

&lt;p&gt;Stay tuned!&lt;/p&gt;

</description>
      <category>secondincome</category>
      <category>mentoring</category>
      <category>foundation</category>
      <category>tech</category>
    </item>
    <item>
      <title>When I Woke Up To ₹ 28,000 Bill From Google Cloud Not Knowing Why</title>
      <dc:creator>Arihant Verma</dc:creator>
      <pubDate>Sat, 13 Feb 2021 07:00:30 +0000</pubDate>
      <link>https://dev.to/arihantverma/when-i-woke-up-to-28-000-bill-from-google-cloud-not-knowing-why-1852</link>
      <guid>https://dev.to/arihantverma/when-i-woke-up-to-28-000-bill-from-google-cloud-not-knowing-why-1852</guid>
      <description>&lt;p&gt;Until recently, like many of us, the first thing I used to do in the morning would be to check my mobile phone. I realised that it was taking about 20 mins to half an hour of my morning time. So I stopped doing it and replaced it with keeping my eyes closed and meditating instead for 15-20 mins. But the incident I'm going to tell you about happened when I still used to look up for my mobile phone first thing in the morning, in half asleep state, with one eye open and the other closed, hid behind the pillow contour.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZBK6l0ye--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1517898717281-8e4385a41802%3Fixid%3DMXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%253D%26ixlib%3Drb-1.2.1%26auto%3Dformat%26fit%3Dcrop%26w%3D1500%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZBK6l0ye--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1517898717281-8e4385a41802%3Fixid%3DMXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%253D%26ixlib%3Drb-1.2.1%26auto%3Dformat%26fit%3Dcrop%26w%3D1500%26q%3D80" alt="a woman half awake on bed with one eye open"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On 3rd September, 2020, I woke up to an automated email from Google Cloud Platform. First response – shock. It was a bill of $377. That amount meant a lot because I didn't earn much in INR, and it was a significant portion of my salary. Without even opening my Google Cloud console, I started a chat with Google Cloud support. In about a couple of hours, they told me in detail what I was billed for.&lt;/p&gt;

&lt;p&gt;I was billed for a Google Cloud project which had used Google Maps JavaScript APIs for over 2 months. I was so sure that I had done nothing wrong that I started telling this to the customer support over emails and chat messages. But they kept reiterating that my project had infact used Google Maps JavaScript APIs, for which I was charged.&lt;/p&gt;

&lt;p&gt;I worked for &lt;a href="https://goibibo.com/"&gt;Goibibo&lt;/a&gt; at the time. Goibibo is one of the largest online travel agencies in India. Two months before this happened, I was working on the &lt;a href="https://www.goibibo.com/hotels/taj-bangalore-bengaluru-hotel-in-bengaluru-1045137713186360887/?hquery=%7B%22ci%22:%2220210212%22,%22co%22:%2220210213%22,%22r%22:%221-2-0%22,%22ibp%22:%22%22%7D&amp;amp;cc=IN"&gt;hotels details page&lt;/a&gt;'s Google Maps project — you know — to show the location of the hotel in the map, and all the points of interest around that hotel, and the ability to search for any location in reference to the hotel.&lt;/p&gt;

&lt;p&gt;I read a partiular line in one of the Google Cloud support communication emails:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Just a quick disclaimer, we cannot reveal domain information if the usage is from a domain outside of your authorized ones due to our privacy and security policy.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And then it hit me.&lt;/p&gt;

&lt;p&gt;Goibibo's google cloud account didn't have &lt;code&gt;localhost&lt;/code&gt; added to their whitelist of allowed domains. So it was impossible to for me to develop locally. To avoid the round trip of having to find the required person, and request them to add localhost to the whitelist, and then start developing, I created a google cloud project from my personal account and started developing locally. I created an API key and enabled Google Maps JavaScript APIs against that key in my project. Here's how I kept both of the Goibibo's and my API keys in the code while developing:&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="cm"&gt;/* Only use this key for production, comment the one below */&lt;/span&gt;
&lt;span class="c1"&gt;// export const googleMapsApiKey = `&amp;lt;goibibo account's api key&amp;gt;`;&lt;/span&gt;

&lt;span class="cm"&gt;/*
 * WARNING: Do not push the key to production. Is only meant
 * for development purposes only
*/&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;googleMapsApiKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;my personal account's api key&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I frantically checked the code in the main branch to see if I had accidetally forgotten to follow my own advice. That was in fact the case, and I did a big: 🤦🏽‍♂️&lt;/p&gt;

&lt;p&gt;I git blamed the file to find the pull request which had enabled this blunder. Then I sent its screenshot to both the google cloud support, apologizing for an honest mistaken, and to my team's slack channel to blare loudly at them for not having done a decent code review.&lt;/p&gt;

&lt;p&gt;I had also &lt;a href="https://www.youtube.com/watch?v=2_HZObVbe-g&amp;amp;feature=emb_title&amp;amp;ab_channel=GoogleMapsPlatform"&gt;forgotten to restrict&lt;/a&gt; my personal account's API key to allow requests to Google Maps APIs from only &lt;code&gt;localhost&lt;/code&gt; domain.&lt;/p&gt;

&lt;p&gt;That meant that&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;2 months worth of Goibibo's Details Page traffic was charged against my personal account's project. Good thing that we had lazy loaded map, which meant that all the JavaScript and other files necessary to render google maps was loaded only when the user had scrolled down to the location section. It'd have cost a lot more, if the resources loaded as soon as the details page loaded.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Had someone extracted that API key by watching the API request from browser developer tools, they could have potentially bombarded requests to Google Maps APIs billed against my personal account from any domain.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I didn't detect this blunder for a month, because for the first month, google had used the $100 free credit that I had gotten from somewhere. So in the first month's billed it showed &lt;code&gt;$0&lt;/code&gt;. It was only a month later that that month's $277 showed as amount charged on my credit card.&lt;/p&gt;

&lt;p&gt;On multiple requests the Google Cloud team refunded that amount after taking confirmations from me that I had read and now understood all the ways to restrict access of api keys, and to set billing alerts on google cloud projects. After giving multiple assurances and acknowledgements that I had indeed read up all the docs that taught how to do all these things, I found peace. 🕊✌🏼☮️&lt;/p&gt;

</description>
      <category>essay</category>
      <category>github</category>
      <category>pullrequest</category>
      <category>mistake</category>
    </item>
    <item>
      <title>Thinking About Writing As A Means Of Livelihood</title>
      <dc:creator>Arihant Verma</dc:creator>
      <pubDate>Sat, 13 Feb 2021 06:48:39 +0000</pubDate>
      <link>https://dev.to/arihantverma/thinking-about-writing-as-a-means-of-livelihood-34dj</link>
      <guid>https://dev.to/arihantverma/thinking-about-writing-as-a-means-of-livelihood-34dj</guid>
      <description>&lt;h2&gt;
  
  
  History
&lt;/h2&gt;

&lt;p&gt;In May 2015, during the last days of college,  I kept expressing a wish which no body cared to reply or attend to. They had no reason to. I casually wished to my friends &lt;em&gt;I wish we had something of our own, some of us, so that we wouldn't have to go away from each other and these memories and friendship&lt;/em&gt;. Some of my batchmates ended up &lt;a href="http://fossbytes.com"&gt;doing their things&lt;/a&gt;. None of my close friends did. Ever since, I've been dreaming to start something of my own.&lt;/p&gt;

&lt;p&gt;Thinking about starting something of one's own, &lt;a href="https://www.instagram.com/arjitraj_/"&gt;Arjit Raj&lt;/a&gt; comes to mind. We were neighbours in final year of college in 2014-15. I remember our constant brain storming sessions. He was fondly called Andaman ( where his folks lived back then ). He was the topper of mechanical engineering batch. Always dreamt big. Right from the first year, he set targets, achievable goals. He'd sleep at 9pm, get up at 4am, and work towards whatever he wanted to do.&lt;/p&gt;

&lt;p&gt;I remember in 2014, early on, as we entered our final year of engineering, he set a target to become a &lt;a href="https://www.quora.com/profile/Raj-Arjit"&gt;Quora top writer&lt;/a&gt; by December. He did it by September. In 2nd year, he had a bad internship experience. He decided to do something about it so that no Indian student would ever have to face what he did. He started curating internship experiences on &lt;a href="http://internfeel.com"&gt;internfeel&lt;/a&gt;. He included me in his endeavour and for some time I edited and posted internship experiences on the wordpress website.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://udemy.com/user/arjit/"&gt;He made udemy courses&lt;/a&gt; before it was cool and earned from them. He quit his first job out of college in about a couple of years and just started &lt;a href="https://www.instagram.com/spacetechie/"&gt;making&lt;/a&gt; &lt;a href="https://www.kickstarter.com/projects/rajarjit/the-rocket-deck?ref=5bugvs"&gt;stuff&lt;/a&gt;. Arjit always pampered me. I knew I didn't deserve his praise, but he still kept at it. I don't know what he initially saw in me. But he eventually decided to stop.&lt;/p&gt;

&lt;p&gt;We had a fallout when I promised re making internfeel.com from scratch but never did. He was the first person to call me out on my tendency to over commit and not deliver at a consistent rate. After that I never promised anybody anything I couldn't do for them. In fact, I almost stopped committing. I haven't talked with him in years. Now that I've quit my job and have actively started a thought process to figure out ways of making a good living without being employed, only Arjit comes to the mind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scratch To Quit Job
&lt;/h2&gt;

&lt;p&gt;I'm not special to have urges to quit job. I'm not even one of those people who have it hard with their bosses. Yet, I've constantly felt the urge to quit. In the last 2.4 years, I've had to have a staggering amount of commitment to not quit. I'm glad I did, and I learnt a lot along the way. Most of all, I learnt a very important skill in life – how to keep at something you do not particularly enjoy doing, with a sense of responsibility, ownership and gratefulness.&lt;/p&gt;

&lt;p&gt;Though lesser salary has been a reason to constantly mull over if all the work that I was putting up was worth it, something bigger drove the urges to quit, more than getting paid less. To feel free is the simplest I can put it. If I can find ways to monetize the things I love to do, what better than that? That's what started to make me think a couple of months ago. Even if there'd be an initial struggle, wouldn't long term benefits come more quickly?&lt;/p&gt;

&lt;p&gt;Ever since December last year, I've established one thing – whatever I do, if I don't find ways to earn an income on my own by the side, I'm going to keep having constant urges to quit. So this year I decided to start.&lt;/p&gt;

&lt;h2&gt;
  
  
  Taking A Serious Look At Writing
&lt;/h2&gt;

&lt;p&gt;I love to write. I write &lt;a href="https://dev.to/posts/2021/01/14/changing-narration-voices-and-tenses/"&gt;short stories&lt;/a&gt;, &lt;a href="https://dev.to/writing"&gt;poetry&lt;/a&gt;, &lt;a href="https://dev.to/tags"&gt;essays&lt;/a&gt; and technical articles about code gymnastics. But I never wrote consistently. So I made two goals for myself. I want to get paid writing two kinds of articles.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Writing for news / literary magazines.&lt;/li&gt;
&lt;li&gt;Writing for tech / coding magazines.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I want to write about stories and books that I read and hear. This way I'll get to read and listen more, and possibly get paid. Sounds really cool, doesn't it? I'm going to make it possible, and document everything – failures and successes, as I do so.&lt;/p&gt;

&lt;p&gt;I want to write about the code that I read, because I want to read more code. So basically I'm just playing deals with myself.&lt;/p&gt;

&lt;p&gt;I recently pitched an article to &lt;a href="https://www.smashingmagazine.com"&gt;Smashing Magazine&lt;/a&gt; and got accepted. They pay for each article you write. Getting paid to do something of my own is the best incentive for me there has ever been.&lt;/p&gt;

&lt;p&gt;Meanwhile, I'm working hard to bring to life an idea I've had for quite a while. That'll be the first ever end to end product I'd have worked on :) In all honestly, apart from all the reasons for trying to make this product — having a sustainable passive income while I sleep being one of them — I'm doing this to show it to Arjit, so that we could collaborate like we used to, but with me putting as much effort, life and vigour as he does.&lt;/p&gt;

&lt;p&gt;This year I only have one resolution — establish this cycle:&lt;/p&gt;

&lt;p&gt;make something self sustaining ➡️ earn through it ➡️ invest it back in learning ➡️ make something else with that learning ➡️ ∞&lt;/p&gt;

</description>
      <category>writing</category>
      <category>passingincome</category>
      <category>stories</category>
      <category>essay</category>
    </item>
  </channel>
</rss>
