<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>Ajit Panigrahi</title>
	<subtitle>Ajit Panigrahi: My thoughts, tips and insights on software engineering.</subtitle>
	
	<link href="https://ajitpanigrahi.com/feed/feed.xml" rel="self"/>
	<link href="https://ajitpanigrahi.com"/>
	<updated>2020-08-01T00:00:00Z</updated>
	<id>https://ajitpanigrahi.com</id>
	<author>
		<name>Ajit Panigrahi</name>
		<email>hello@ajitpanigrahi.com</email>
	</author>
	
	<entry>
		<title>Uses</title>
		<link href="https://ajitpanigrahi.com/uses/"/>
		<updated>2020-08-01T00:00:00Z</updated>
		<id>https://ajitpanigrahi.com/uses/</id>
		<content type="html">&lt;blockquote&gt;
&lt;p&gt;Visit &lt;a href=&quot;https://uses.tech/&quot;&gt;uses.tech&lt;/a&gt; to see what&#39;s all the fuss about.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;table-of-contents&quot;&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://ajitpanigrahi.com/uses/#hardware&quot;&gt;Hardware &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://ajitpanigrahi.com/uses/#software&quot;&gt;Software &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://ajitpanigrahi.com/uses/#bonus:-neofetch&quot;&gt;Bonus: neofetch &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;hardware&quot; tabindex=&quot;-1&quot;&gt;Hardware &lt;a class=&quot;direct-link&quot; href=&quot;https://ajitpanigrahi.com/uses/#hardware&quot; aria-hidden=&quot;true&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Computer:&lt;/strong&gt; 2018 MacBook Pro 15&amp;quot; - i7 (8th Gen) 16GB RAM, Radeon Pro 555X 4GB.
&lt;blockquote&gt;
&lt;p&gt;Switched from Windows, to Ubuntu, to MacOS. Still Windows for gaming.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Phone:&lt;/strong&gt; Moto Edge 20 Fusion (6GB).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tablet:&lt;/strong&gt; iPad Mini 5 (2019) 64GB.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;External Monitor:&lt;/strong&gt; &lt;a href=&quot;https://www.rtings.com/monitor/reviews/lg/32gk650f-b&quot;&gt;LG 32GK650F-B&lt;/a&gt;. 1440p, 144Hz.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keyboard:&lt;/strong&gt; Ducky One 2SF, Black, Year of the Rat, with Cherry MX Speed Silver switches.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Audio:&lt;/strong&gt; Jabra Elite Active 65t. First go with &lt;abbr title=&quot;True Wireless&quot;&gt;TWS&lt;/abbr&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mouse:&lt;/strong&gt; RedGear Thor, previously using RedGear Leviathon.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Game Controller:&lt;/strong&gt; RedGear Elite Wireless.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;software&quot; tabindex=&quot;-1&quot;&gt;Software &lt;a class=&quot;direct-link&quot; href=&quot;https://ajitpanigrahi.com/uses/#software&quot; aria-hidden=&quot;true&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Editors:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;VSCode, as a sort of IDE.&lt;/li&gt;
&lt;li&gt;Sublime Text 3 for competitive programming or small edits.&lt;/li&gt;
&lt;li&gt;Vim (!) for short &amp;amp; sweet edits. I&#39;ve dare say I&#39;ve gotten better at it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Terminal:&lt;/strong&gt; iTerm2 with &lt;a href=&quot;https://github.com/ohmyzsh/ohmyzsh&quot;&gt;Oh My Zsh&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Themes:&lt;/strong&gt; Alternating between 👇
&lt;ul&gt;
&lt;li&gt;Shades of Purple: &lt;a href=&quot;https://github.com/ahmadawais/shades-of-purple-vscode&quot;&gt;VS Code&lt;/a&gt; | &lt;a href=&quot;https://github.com/ahmadawais/Shades-of-Purple-iTerm2&quot;&gt;iTerm2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SynthWave &#39;84: &lt;a href=&quot;https://github.com/robb0wen/synthwave-vscode&quot;&gt;VS Code&lt;/a&gt; | &lt;a href=&quot;https://github.com/robb0wen/synthwave-vscode/issues/66&quot;&gt;iTerm2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Winter is Coming: &lt;a href=&quot;https://github.com/johnpapa/vscode-winteriscoming&quot;&gt;VS Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Font:&lt;/strong&gt; &lt;a href=&quot;https://github.com/tonsky/FiraCode&quot;&gt;Fira Code&lt;/a&gt; with ligatures enabled, of course.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Browsers:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Primary: Safari. Yes, really.&lt;/li&gt;
&lt;li&gt;Secondary: Edge, Brave.&lt;/li&gt;
&lt;li&gt;Testing: Chrome Dev. Firefox Dev.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Designing:&lt;/strong&gt; Adobe XD. A little bit of Figma just so that I can join the cool gang.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Apps:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;s&gt;LastPass&lt;/s&gt; Dashlane (password manager) + Twilio Authy (2FA).&lt;/li&gt;
&lt;li&gt;Google Keep &amp;amp; Trello for notes. Google Docs for long-form stuff. Notion is too much for me.&lt;/li&gt;
&lt;li&gt;Pocket, mainly for hoarding but also occasionally reading articles.&lt;/li&gt;
&lt;li&gt;Amazon Kindle, for reading novels. Also, for hoarding.&lt;/li&gt;
&lt;li&gt;Procreate (iPad), for casual drawing. I&#39;m not good at it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;bonus:-neofetch&quot; tabindex=&quot;-1&quot;&gt;Bonus: &lt;code&gt;neofetch&lt;/code&gt; &lt;a class=&quot;direct-link&quot; href=&quot;https://ajitpanigrahi.com/uses/#bonus:-neofetch&quot; aria-hidden=&quot;true&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://ajitpanigrahi.com/images/uses-neofetch.png&quot; alt=&quot;Screenshot of neofetch details&quot; /&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Sorting out JavaScript</title>
		<link href="https://ajitpanigrahi.com/blog/sorting-out-javascript/"/>
		<updated>2020-06-05T00:00:00Z</updated>
		<id>https://ajitpanigrahi.com/blog/sorting-out-javascript/</id>
		<content type="html">&lt;p&gt;JavaScript, with its dynamic typing, cannot presume a consistent input for any function. This is pretty much the biggest hold-up with anything to do with this language.&lt;/p&gt;
&lt;p&gt;Sorting a list in JavaScript is a common pitfall for beginners, especially for impatient folks ready to skip the docs. Or perhaps &amp;quot;impatient&amp;quot; is unfair to everyone who misunderstood this in-built function, as it &lt;em&gt;is&lt;/em&gt; an easy thing to overlook.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort&quot; title=&quot;MDN Link&quot;&gt;&lt;code&gt;Array.prototype.sort()&lt;/code&gt;&lt;/a&gt;, by default, can be used an array of any kind of elements. So for an array with numbers and strings we can&#39;t assume a numeric comparison. In such a case, it sort of makes sense to compare all elements by the lexicographic order instead.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; mixed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;zero&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;45&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;555&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;444&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;ajit&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mixed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// -&gt; [3, 36, 444, 45, 555, &quot;ajit&quot;, &quot;zero&quot;]&lt;/span&gt;&lt;/mark&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See what happened there?&lt;/p&gt;
&lt;p&gt;But now if you were quick to assume this behaviour occurs just because we included strings into the mix, then you would be wrong.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; mixed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;45&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;555&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;444&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mixed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// -&gt; [3, 36, 444, 45, 555]&lt;/span&gt;&lt;/mark&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default, comparisons occur by coercing the type of the element to string.&lt;/p&gt;
&lt;p&gt;So if you want a numeric comparison (for obvious reasons), we can pass a comparator function like so:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; mixed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;45&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;555&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;444&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;comparatorFn&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;previousValue&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; currentValue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; previousValue &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt; currentValue&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// hacky magic, expects negative/positive stuff, idk/idc&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mixed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;comparatorFn&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// -&gt; [3, 36, 45, 444, 555]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Another catch: Your list of numbers shouldn&#39;t contain &lt;code&gt;Infinity&lt;/code&gt; or &lt;code&gt;NaN&lt;/code&gt; with this particular comparator. That should be an entire different article, but in short &lt;code&gt;previousValue - currentValue&lt;/code&gt; for anything involving these values will always result in the same value.&lt;/p&gt;
&lt;p&gt;This is just me writing notes for myself at this point. Hope this helps someone.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Replacing substrings with JavaScript</title>
		<link href="https://ajitpanigrahi.com/blog/replacing-substrings-with-javascript/"/>
		<updated>2020-06-01T00:00:00Z</updated>
		<id>https://ajitpanigrahi.com/blog/replacing-substrings-with-javascript/</id>
		<content type="html">&lt;p&gt;If you&#39;ve ever had to quickly look up how to replace all occurences of a word or pattern within a string, you&#39;ve probably come across &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace&quot; title=&quot;MDN Link&quot;&gt;&lt;code&gt;String.prototype.replace()&lt;/code&gt;&lt;/a&gt;. It&#39;s easy to assume that it&#39;ll work as advertised, except that we&#39;ve all skipped reading the docs and just copied the syntax.&lt;/p&gt;
&lt;p&gt;The catch: this method only changes the &lt;em&gt;first&lt;/em&gt; occurence of the pattern.&lt;/p&gt;
&lt;p&gt;The method expects two parameters: the substring to be replaced (say, &lt;code&gt;target&lt;/code&gt;), and the substring to replace it with (say, &lt;code&gt;replacement&lt;/code&gt;). What often passes unnoticed during development or during code reviews is the &lt;code&gt;target&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Here, &lt;code&gt;target&lt;/code&gt; can either be a string or a regular expression.&lt;/p&gt;
&lt;p&gt;If we want to replace all occurences of the pattern, we need to pass a &lt;em&gt;regular expression&lt;/em&gt; with the global flag enabled. This flag matches with all occurences of that pattern. All standard regex rules still apply, so always &lt;a href=&quot;https://regex101.com/&quot;&gt;cross-check&lt;/a&gt; &lt;a href=&quot;https://regextester.com/&quot;&gt;your&lt;/a&gt; &lt;a href=&quot;https://regexr.com/&quot;&gt;pattern&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Example:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; phrase &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;some cool words and some not so cool ones&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;del class=&quot;highlight-line highlight-line-remove&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; newPhrase &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; phrase&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;cool&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;nice&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/del&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;newPhrase&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// -&gt; &#39;some nice words and some not so cool ones&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; regexp &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;cool&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ins class=&quot;highlight-line highlight-line-add&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; newPhrase &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; phrase&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;regexp&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;nice&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/ins&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;newPhrase&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// -&gt; &#39;some nice words and some not so nice ones&#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But this is still prone to mistakes.&lt;/p&gt;
&lt;p&gt;With a cursory glance, it is not immediately clear whether we are replacing all occurences or not. A simple change (or lack there of) from &lt;code&gt;target&lt;/code&gt; to &lt;code&gt;/target/g&lt;/code&gt; is not immediately apparent to a team member unfamiliar with the exact specification or those who jump in between cross-functional teams &amp;amp; various languages.&lt;/p&gt;
&lt;p&gt;The better alternative with modern JavaScript is to use &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll&quot; title=&quot;MDN Link&quot;&gt;&lt;code&gt;String.prototype.replaceAll()&lt;/code&gt;&lt;/a&gt;. While &lt;code&gt;replace()&lt;/code&gt; has been supported from the beginning, &lt;code&gt;replaceAll()&lt;/code&gt; is a &lt;a href=&quot;https://v8.dev/features/string-replaceall&quot;&gt;recent addition&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It has the exact same API as &lt;code&gt;replace()&lt;/code&gt;, with some minor changes like requiring the RegExp (if used) to have the global flag enabled.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Example:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; phrase &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;some cool words and some not so cool ones&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; newPhrase &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; phrase&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;cool&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;nice&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;newPhrase&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// -&gt; &#39;some nice words and some not so nice ones&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; newPhrase &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; phrase&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replaceAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;cool&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;nice&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;newPhrase&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// -&gt; &#39;some nice words and some not so nice ones&#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Readability improves with a simple addition of three characters.&lt;/p&gt;
&lt;p&gt;No support for IE11 though. &lt;a href=&quot;https://caniuse.com/?search=replaceAll&quot; title=&quot;Can I Use for replaceAll&quot;&gt;Naturally&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>How bright is the sun?</title>
		<link href="https://ajitpanigrahi.com/blog/how-bright-is-the-sun/"/>
		<updated>2019-12-28T00:00:00Z</updated>
		<id>https://ajitpanigrahi.com/blog/how-bright-is-the-sun/</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;https://youtu.be/m9AT7H4GGrA?t=406&quot;&gt;Twenty&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Hello World</title>
		<link href="https://ajitpanigrahi.com/blog/hello-world/"/>
		<updated>2019-12-14T00:00:00Z</updated>
		<id>https://ajitpanigrahi.com/blog/hello-world/</id>
		<content type="html">&lt;p&gt;As I set out to design my website, I ended up spending most of my time exploring countless beautifully designed websites for inspiration. With how creative people can get, it was quite easy to forget the original reason why I wanted a website in the first place.&lt;/p&gt;
&lt;p&gt;Each portfolio and blog I went through displayed the &lt;a href=&quot;https://whimsical.club/&quot;&gt;unique tastes&lt;/a&gt; of the creator, with a subtle charm which brought life to their work. They brought with them their quirky twists to the expected, painting their imagination within a virtual space.&lt;/p&gt;
&lt;p&gt;Me? I wanted to explore writing a technical blog, which could also showcase my experience, something akin to a portfolio. What did I end up with? 3 months of running behind a mistaken target.&lt;/p&gt;
&lt;p&gt;After seeing all these lovely websites, I could only comfort myself by hiding behind a label of facing a &amp;quot;Designer&#39;s Block&amp;quot;, one that made an existing Writer&#39;s Block even more uncomfortable.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;The process of moulding disparate thoughts into a well-crafted &amp;quot;product&amp;quot; is not a straight-forward task, nor does it have a scientific approach. Sure, there are guidelines, but there is no single &lt;strong&gt;correct&lt;/strong&gt; way of doing things.&lt;/p&gt;
&lt;p&gt;The so-called &amp;quot;creative process&amp;quot; is, at best, an unorthodox – and often unclear – path in collecting our thoughts in a presentable manner. For my website, the standard way to approaching this would have been to just take the next best framework you can find and get started with a template.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This blog is my solution to disrupting the standard process. To moving forward.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here&#39;s what I plan to do instead: With a minimal &lt;a href=&quot;https://gohugo.io/&quot;&gt;Hugo&lt;/a&gt; setup using the &lt;a href=&quot;https://github.com/yihui/hugo-xmin&quot;&gt;XMin&lt;/a&gt; theme, I&#39;m going to update this blog regularly while updating the styling for better aesthetics and accessibility.&lt;/p&gt;
&lt;p&gt;What I realised in these past few months, is that my initial motivations for wanting a personal website had changed. Last year just before applying for internships, I had created my first version of this website on GitHub in just under 30 minutes, some from scratch, some from stitching together some of my code from different places. It was &lt;a href=&quot;https://2018.ajitpanigrahi.com/&quot;&gt;&lt;em&gt;okay&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This year, I&#39;ve joined a Hyderabad-based company, &lt;a href=&quot;https://www.keka.com/&quot;&gt;Keka HR&lt;/a&gt;, as an intern and I&#39;m planning to blog more often as I learn more things. I&#39;ve been regularly trying to write more articles and drafting my ideas over the weekend. This little space, so to speak, is my place to collect my writings and to showcase a few trinkets that I&#39;m building.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Thoughful design begins with content; when the content changes over time, the design needs to follow. This is my attempt at creating a hopefully creative, functional website.&lt;/p&gt;
&lt;p&gt;I dare say the benchmarks will call this a pretty fast website.&lt;/p&gt;
</content>
	</entry>
</feed>
