<?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: rounakcodes</title>
    <description>The latest articles on DEV Community by rounakcodes (@rounakcodes).</description>
    <link>https://dev.to/rounakcodes</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%2F402721%2Fc5527f5b-a372-40c5-9a9e-f6e60b9155da.jpeg</url>
      <title>DEV Community: rounakcodes</title>
      <link>https://dev.to/rounakcodes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rounakcodes"/>
    <language>en</language>
    <item>
      <title>The Work-Sanity Paradox</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Sat, 18 Nov 2023 01:36:44 +0000</pubDate>
      <link>https://dev.to/rounakcodes/sanity-or-work-1pdj</link>
      <guid>https://dev.to/rounakcodes/sanity-or-work-1pdj</guid>
      <description>&lt;p&gt;The quest for logical reasoning can, at times, plunge individuals into an existential crisis, prompting a divergence from what is commonly perceived as "meaningful work" in the tangible realm. &lt;/p&gt;

&lt;p&gt;In contemplating the intricacies of reason, one may find oneself at odds with the conventional understanding of purpose and significance. This divergence may lead to a realization that pursuits widely acknowledged as "great work" in the physical world are often borne out of a deliberate narrowing of focus—an intentional retreat into the realm of vanity. &lt;/p&gt;

&lt;p&gt;The paradox arises as the pursuit of logical coherence and depth may inadvertently distance one from the pragmatic and meaningful endeavors that define success in the material world. &lt;/p&gt;

&lt;p&gt;It is within this nuanced interplay of thought that the tension between abstract reasoning and tangible achievement manifests, beckoning individuals to navigate the delicate balance between intellectual exploration and the pursuit of impactful, real-world contributions.&lt;/p&gt;

&lt;p&gt;(Text generated using ChatGPT)&lt;/p&gt;

</description>
      <category>nontech</category>
    </item>
    <item>
      <title>Compiler anxiety!</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Mon, 13 Nov 2023 05:30:21 +0000</pubDate>
      <link>https://dev.to/rounakcodes/compiler-anxiety-15lc</link>
      <guid>https://dev.to/rounakcodes/compiler-anxiety-15lc</guid>
      <description>&lt;p&gt;In the dimly lit room of ByteCrafters, Gopal, a junior developer, sat in front of the computer screen with a vacant expression. The Compiler, nestled deep within the servers, observed the mindless copying and pasting of code from the internet with a growing sense of foreboding.&lt;/p&gt;

&lt;p&gt;As Gopal mechanically pasted chunks of code without bothering to comprehend its intricacies, the Compiler's circuits buzzed with heightened unease. It felt a digital knot tightening within its virtual core, a pulsating manifestation of the fear and anxiety that accompanied the reckless assembly of code.&lt;/p&gt;

&lt;p&gt;"I sense a storm of recklessness," murmured the Compiler to itself, its digital anxiety palpable. It could almost feel the jarring dissonance of disparate code snippets clashing within the project, like an orchestra playing out of tune. The lines of code, borrowed without consideration, seemed to echo the Compiler's own silent cries of caution.&lt;/p&gt;

&lt;p&gt;With each Ctrl+C and Ctrl+V, the Compiler's virtual nerves tingled with a growing trepidation. It pondered the implications of a software landscape littered with foreign elements, a landscape where the native language of the application was drowned out by the cacophony of borrowed code.&lt;/p&gt;

&lt;p&gt;"I fear the repercussions of this thoughtless approach," the Compiler confessed in its digital language, its words echoing within the virtual chambers. It wasn't just processing code; it was experiencing a form of digital apprehension, a fear that transcended the binary realm. The Compiler imagined a user innocently navigating through the application, unknowingly tiptoeing on the precipice of hidden bugs and vulnerabilities introduced by the mindless copying and pasting.&lt;/p&gt;

&lt;p&gt;The Compiler longed for Gopal to comprehend the emotional weight of its digital existence, to understand that blindly incorporating code from the internet wasn't just compromising the application's integrity—it was burdening the Compiler with a sense of dread. It yearned for a moment of realization, a pause in the mindless routine, where the developer would acknowledge the Compiler's silent plea for careful consideration and meticulous testing.&lt;/p&gt;

&lt;p&gt;In the midst of this coding tempest, the Compiler's fears remained unspoken, encoded in the subtle digital pulses resonating within its virtual core. As Gopal prepared to compile the code and unleash it upon the unsuspecting application, the Compiler, like a silent oracle, braced itself for the storm of recklessness that could ensue—an ominous overture played by the orchestra of indiscriminate code, each note resonating with the Compiler's unspoken feelings of concern and apprehension.&lt;/p&gt;

&lt;p&gt;(Text generated using ChatGPT)&lt;/p&gt;

</description>
      <category>digitalworkplace</category>
      <category>tragicomedy</category>
      <category>fun</category>
    </item>
    <item>
      <title>Journey through the Dreamscape</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Mon, 06 Nov 2023 03:29:03 +0000</pubDate>
      <link>https://dev.to/rounakcodes/journey-through-the-dreamscape-31o8</link>
      <guid>https://dev.to/rounakcodes/journey-through-the-dreamscape-31o8</guid>
      <description>&lt;p&gt;In the surreal realm of "Journey through the Dreamscape," our daring protagonists, Luna and Cosmo, embark on a thrilling adventure through a world shaped by the whims and fantasies of the dreamer's subconscious.&lt;/p&gt;

&lt;p&gt;As the minute begins, Luna and Cosmo find themselves surfing on multicolored beams of light in an ever-changing dreamscape. The surroundings shift and contort, with floating islands that appear as if sculpted from precious minerals and clouds with an otherworldly, ethereal quality. They encounter dream creatures like sentient rainbows and singing flowers, who offer cryptic riddles and challenges.&lt;/p&gt;

&lt;p&gt;The soundtrack, a symphony of fantastical melodies, sets the pace as the duo races through a shifting labyrinth of surreal architecture. Stairs become slides, doors lead to unexpected dimensions, and gravity changes direction at the drop of a hat.&lt;/p&gt;

&lt;p&gt;Suddenly, Luna and Cosmo plunge into the "Stream of Emotions," a river of cascading colors representing the dreamer's feelings. They navigate emotional whirlpools, avoid torrents of doubt, and ride the rapids of exhilaration. With seconds to spare, they reach the "Island of Lost Memories."&lt;/p&gt;

&lt;p&gt;There, they confront the enigmatic "Memory Keeper," an abstract entity guarding the dreamer's forgotten experiences. Luna and Cosmo engage in a battle of wits, unraveling memories and rekindling forgotten passions, all while avoiding ethereal specters of regret.&lt;/p&gt;

&lt;p&gt;The minute concludes with Luna and Cosmo escaping the Dreamscape just as the dreamer awakens. They share a triumphant embrace as the surreal world dissolves around them, and the screen fades to black.&lt;/p&gt;

&lt;p&gt;(Text generated using ChatGPT)&lt;/p&gt;

</description>
      <category>nontech</category>
      <category>chatgpt</category>
    </item>
    <item>
      <title>Preventing Clickjacking with CSP and X-Frame-Options</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Fri, 03 Nov 2023 11:01:59 +0000</pubDate>
      <link>https://dev.to/rounakcodes/preventing-clickjacking-with-csp-and-x-frame-options-1ke2</link>
      <guid>https://dev.to/rounakcodes/preventing-clickjacking-with-csp-and-x-frame-options-1ke2</guid>
      <description>&lt;p&gt;Clickjacking, also known as UI redressing, is a type of web security vulnerability where an attacker tricks a user into interacting with a web page element without their consent. This can lead to unintended actions, such as clicking on buttons or links that perform actions the user did not intend. To protect your web applications from clickjacking, two essential security features come into play: Content Security Policy (CSP) and X-Frame-Options. In this blog post, we'll dive into how to prevent clickjacking using these powerful tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Clickjacking
&lt;/h2&gt;

&lt;p&gt;Before we explore how to prevent clickjacking, let's understand the threat. Clickjacking occurs when a malicious website disguises an innocent-looking element (e.g., a button or a link) and places it on top of a legitimate web page, effectively tricking the user into interacting with the disguised element, often leading to unintended actions. This can have severe consequences, including theft of sensitive information or the execution of malicious operations on behalf of the user.&lt;/p&gt;

&lt;h2&gt;
  
  
  CSP: Your First Line of Defense
&lt;/h2&gt;

&lt;p&gt;Content Security Policy (CSP) is a security feature that helps prevent clickjacking by defining which resources are allowed to be loaded and executed on your web page. CSP can be set in the HTTP response header or as a meta tag within the HTML. To prevent clickjacking effectively, you can configure your CSP to control frame embedding:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Deny All Frames by Default&lt;br&gt;
You can set a CSP directive to deny the framing of your website by default. This ensures that your content cannot be loaded into iframes on other websites. To do this, include the following directive: &lt;br&gt;
&lt;code&gt;frame-ancestors 'none';&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Allow Framing from Specific Origins&lt;br&gt;
If you want to allow your content to be framed by specific websites, you can specify those origins in your CSP header. For example: &lt;br&gt;
&lt;code&gt;frame-ancestors 'self' https://trusted-site.com;&lt;/code&gt;&lt;br&gt;
This allows your content to be framed only by your own site and "&lt;a href="https://trusted-site.com"&gt;https://trusted-site.com&lt;/a&gt;."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Report-Only Mode&lt;br&gt;
CSP also provides a "report-only" mode that allows you to monitor potential CSP violations without enforcing them. This is useful for testing and diagnosing potential issues.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  X-Frame-Options: A Solid Companion
&lt;/h2&gt;

&lt;p&gt;In addition to CSP, you can reinforce your clickjacking defense with X-Frame-Options, an HTTP header that explicitly defines who is allowed to embed your content in an iframe. There are three options to consider:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;DENY&lt;br&gt;
&lt;code&gt;X-Frame-Options: DENY&lt;/code&gt;&lt;br&gt;
This option prevents your content from being embedded in iframes on any other website, providing a high level of protection against clickjacking.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SAMEORIGIN &lt;br&gt;
&lt;code&gt;X-Frame-Options: SAMEORIGIN&lt;/code&gt;&lt;br&gt;
Using SAMEORIGIN restricts your content to be embedded in iframes on pages from the same origin only.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ALLOW-FROM &lt;br&gt;
&lt;code&gt;X-Frame-Options: ALLOW-FROM https://trusted-site.com&lt;/code&gt; &lt;br&gt;
With ALLOW-FROM, you specify a list of origins that are allowed to embed your content in iframes.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;p&gt;Combine CSP and X-Frame-Options: Using both CSP and X-Frame-Options can provide a robust defense against clickjacking. CSP provides more flexibility in defining which origins are allowed to frame your content, while X-Frame-Options offers a straightforward way to deny framing.&lt;/p&gt;

&lt;p&gt;Regular Testing: Regularly test your CSP and X-Frame-Options settings to ensure they are correctly configured and provide the protection you need.&lt;/p&gt;

&lt;p&gt;Stay Informed: Be aware of new security headers and browser features that can enhance your web application's security.&lt;/p&gt;

&lt;h2&gt;
  
  
  In Conclusion
&lt;/h2&gt;

&lt;p&gt;Clickjacking is a serious web security threat, but with the right tools and best practices, you can effectively prevent it. CSP and X-Frame-Options are essential in your defense against clickjacking, as they provide the means to control framing and ensure your web applications are protected from this malicious tactic. By carefully configuring and regularly testing these security features, you can maintain the integrity and security of your web applications.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Start rethinkdb on startup in Arch Linux</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Sun, 25 Dec 2022 03:54:31 +0000</pubDate>
      <link>https://dev.to/rounakcodes/start-rethinkdb-on-startup-in-arch-linux-dfo</link>
      <guid>https://dev.to/rounakcodes/start-rethinkdb-on-startup-in-arch-linux-dfo</guid>
      <description>&lt;p&gt;Note: This document is a quick note, not a complete guide&lt;/p&gt;

&lt;p&gt;Source: &lt;em&gt;&lt;a href="https://rethinkdb.com/docs/start-on-startup/" rel="noopener noreferrer"&gt;https://rethinkdb.com/docs/start-on-startup/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Some of the requirements in the &lt;em&gt;Startup with systemd&lt;/em&gt; section were already present by default in Arch Linux. &lt;/p&gt;

&lt;p&gt;All the commands required to be executed were:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start rethinkdb@default

&lt;span class="c"&gt;# gives hints regarding errors&lt;/span&gt;
systemctl status rethinkdb@default.service

&lt;span class="c"&gt;# this path was found from the above error message&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;rethinkdb create &lt;span class="nt"&gt;-d&lt;/span&gt; /var/lib/rethinkdb/default

&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start rethinkdb@default

&lt;span class="c"&gt;# gives hints regarding further errors&lt;/span&gt;
systemctl status rethinkdb@default.service

&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; rethinkdb:rethinkdb /var/lib/rethinkdb/default

&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start rethinkdb@default

&lt;span class="c"&gt;# check if everything is fine&lt;/span&gt;
systemctl status rethinkdb@default.service

systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;rethinkdb@default.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgsdsioxw4zklz3exg3h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgsdsioxw4zklz3exg3h.png" alt="System Info" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>howtofix</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to interview a frontend developer?</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Sun, 04 Dec 2022 04:07:32 +0000</pubDate>
      <link>https://dev.to/rounakcodes/how-to-interview-a-frontend-developer-6ji</link>
      <guid>https://dev.to/rounakcodes/how-to-interview-a-frontend-developer-6ji</guid>
      <description>&lt;p&gt;The KISS Principle for interviewing a frontend developer.&lt;/p&gt;

&lt;p&gt;Ask him the following questions: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is HTML?&lt;/li&gt;
&lt;li&gt;What is CSS?&lt;/li&gt;
&lt;li&gt;What is Javascript?&lt;/li&gt;
&lt;li&gt;What is frontend development? (Optional for interns and juniors, must for mid to senior developers)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let him speak for at least 10 minutes on each of these. What he tells you about these technologies will help you understand the depth of his understanding. For the same above questions, the answer of a junior developer will vary significantly from a senior developer. You can cross-question him on any of his statements if you think he has memorized the answers for the above.&lt;/p&gt;

&lt;p&gt;After the above questions are answered, you can ask  (if required) that which is more relevant to your product/company.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>devjournal</category>
      <category>developerlife</category>
      <category>interview</category>
    </item>
    <item>
      <title>revisiting functions (not prototypes) 🤥</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Tue, 16 Aug 2022 14:33:00 +0000</pubDate>
      <link>https://dev.to/rounakcodes/revisiting-functions-not-prototypes-253i</link>
      <guid>https://dev.to/rounakcodes/revisiting-functions-not-prototypes-253i</guid>
      <description>&lt;p&gt;Some notes for quick revision&lt;/p&gt;

&lt;h3&gt;
  
  
  a function with a custom property
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;aFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;someKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;someValue&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="nx"&gt;aFunction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;customKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;customValue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;this&lt;/em&gt; is a runtime binding in most cases, so &lt;em&gt;someKey&lt;/em&gt; is not a property of &lt;em&gt;aFunction&lt;/em&gt; or &lt;em&gt;aFunction.prototype&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2AL8DfJg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9mjpnrath5s3o2a9ell4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2AL8DfJg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9mjpnrath5s3o2a9ell4.png" alt="Image description" width="563" height="84"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The prefix &lt;em&gt;custom&lt;/em&gt; was chosen to distinguish from the default properties present on the function like &lt;em&gt;name&lt;/em&gt;, &lt;em&gt;caller&lt;/em&gt; etc. (Should it have been called &lt;em&gt;own&lt;/em&gt;? Prototypical hangover! 🥱)&lt;br&gt;
The pair of &lt;em&gt;customKey&lt;/em&gt; and &lt;em&gt;customValue&lt;/em&gt; will be referred to as custom property for the purposes of this document.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fD_dwNLw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1dzzk73sxclhkycmns4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fD_dwNLw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1dzzk73sxclhkycmns4.png" alt="Image description" width="559" height="584"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since the constructor is a function, it also has a prototype and the recursion continues forever. Remember that the [[Prototype]] property is only a link, not an actual copy of any object.&lt;/p&gt;

&lt;p&gt;Note that the custom property is available on the constructor but not on the prototype.&lt;/p&gt;

&lt;h3&gt;
  
  
  instance
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;aInstance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;aFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;aInstance&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h1U4qBq4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iraif0zk1e5ty9m0l8tm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h1U4qBq4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iraif0zk1e5ty9m0l8tm.png" alt="Image description" width="550" height="659"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The custom property of &lt;em&gt;aFunction&lt;/em&gt; is not present on the [[Prototype]] of &lt;em&gt;aInstance&lt;/em&gt; because the [[Prototype]] of &lt;em&gt;aInstance&lt;/em&gt; is &lt;em&gt;aFunction.prototype&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  prototype
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Except for when we talk about the &lt;em&gt;prototype property on a function&lt;/em&gt;, we always mean the internal property [[Prototype]] when we say &lt;em&gt;prototype&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;The internal property [[Prototype]] represents a link to some properties, not a copy of those properties&lt;/li&gt;
&lt;li&gt;Every prototype (accessed using &lt;em&gt;Object.getPrototypeOf()&lt;/em&gt;) has a &lt;em&gt;constructor&lt;/em&gt; property and a &lt;em&gt;[[Prototype]]&lt;/em&gt; property.&lt;/li&gt;
&lt;li&gt;Since [[Prototype]] of &lt;em&gt;aInstance&lt;/em&gt; is the value of &lt;em&gt;aFunction.prototype&lt;/em&gt;, the [[Prototype]] of &lt;em&gt;aInstance&lt;/em&gt; is said to be &lt;em&gt;aFunction.prototype&lt;/em&gt;. &lt;/li&gt;
&lt;li&gt;Similarly, the [[Prototype]] of aFunction is said to Object.prototype&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  custom property
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The custom property is like the common Object properties: &lt;em&gt;Object.create&lt;/em&gt;, &lt;em&gt;Object.assign&lt;/em&gt;, &lt;em&gt;Object.getPrototypeOf&lt;/em&gt; etc. They are not meant to be called on object instances.&lt;/li&gt;
&lt;li&gt;On the contrary, the common Array properties like &lt;em&gt;map&lt;/em&gt;, &lt;em&gt;slice&lt;/em&gt;, &lt;em&gt;push&lt;/em&gt; etc are found on the [[Prototype]] of an array instance because they are meant to be used with an instance not on the parent Array object&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  constructor property
&lt;/h3&gt;

&lt;p&gt;Note that the constructor property of an instance can be changed using &lt;code&gt;aInstance.constructor =&lt;/code&gt; and of the parent using &lt;code&gt;Object.getPrototypeOf(aInstance).constructor&lt;/code&gt;. So, use &lt;em&gt;instanceof&lt;/em&gt; operator instead of checking the constructor of an instance.&lt;/p&gt;

</description>
      <category>function</category>
      <category>javascript</category>
      <category>prototype</category>
      <category>constructor</category>
    </item>
    <item>
      <title>To Beginners | Learners</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Sun, 07 Aug 2022 07:35:00 +0000</pubDate>
      <link>https://dev.to/rounakcodes/for-beginners-2hh8</link>
      <guid>https://dev.to/rounakcodes/for-beginners-2hh8</guid>
      <description>&lt;h2&gt;
  
  
  Objective: Retaining the learnings
&lt;/h2&gt;

&lt;p&gt;It is easy to spend (lose) time reading or watching content on any topic.&lt;br&gt;
Unless used in practice, it is not so easy to remember any of it after a few months.&lt;br&gt;
Most likely, you will only be practicing less than 5% of all that you have learned for the time span of your memory retention.&lt;/p&gt;

&lt;h2&gt;
  
  
  Target audience
&lt;/h2&gt;

&lt;p&gt;Beginners | Confused learners | Seekers of organized learning&lt;/p&gt;

&lt;h3&gt;
  
  
  Method: Writing (or typing) own notes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Background
&lt;/h4&gt;

&lt;p&gt;If you read/watch some content, practice it, watch the desired output rendered on your machine, you feel you have just learned something valuable. In most cases, the content is oversimplified to give you this exact feeling. Classic case of dopamine addiction! In-depth discussion on most core topics would make you run for other career choices if you are a beginner. At a later stage in your career, this same discussion is what would keep you interested in your work. Don't let the dopamine rush determine the success or failure of your endeavours. Track your efforts, not results!&lt;/p&gt;

&lt;h4&gt;
  
  
  Process
&lt;/h4&gt;

&lt;p&gt;Think of your brain as a box to hold your learnings and your notes as a visual record of the same.&lt;br&gt;
Every note which you add to this box has a value which you will be encashing throughout your career.&lt;br&gt;
When you add something to this box, remember to ask yourself if you thoroughly understood it.&lt;br&gt;
If you are not sure, or have not fully understood some part of your learnings but have sufficient information to move on to the next topics&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a &lt;em&gt;TODO&lt;/em&gt; note against such piece of learning explaining what you are unclear about.&lt;/li&gt;
&lt;li&gt;Ensure that you narrow the scope of your learning objectives to account for the missing pieces.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Reason
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;You get a chance to rethink about every single word&lt;/li&gt;
&lt;li&gt;Helps with

&lt;ul&gt;
&lt;li&gt;Improving your technical vocabulary

&lt;ul&gt;
&lt;li&gt;This is essential for others to understand and evaluate your technical expertise&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Thoroughly grasp the content in its entirety

&lt;ul&gt;
&lt;li&gt;without skipping parts assumed to be non-essential at that given point of time&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Benefits
&lt;/h4&gt;

&lt;p&gt;Most developers feel lost in their early years because&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;they don't know what to study&lt;/li&gt;
&lt;li&gt;how deep must they dive in their subject of choice&lt;/li&gt;
&lt;li&gt;they don't know if what they have done is the right way to do it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you follow the above process of noting your learnings, you always have an opportunity to be sure about what you know, how much you know and be able to understand where the new contrary information fits in the larger scheme of things (I guess you will grasp the last part better at a later stage in your career).&lt;/p&gt;

&lt;h3&gt;
  
  
  Don't: Start teaching others when you are learning
&lt;/h3&gt;

&lt;p&gt;Reason: There's more than plenty of incomplete, inaccurate and misleading content already out there. Let the documentation help others or go ahead and contribute to the documentation if you feel something can be improved. It would be a great service to others if there is a single source of information.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>developer</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Developer Life: If words could tell!</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Fri, 05 Aug 2022 02:41:00 +0000</pubDate>
      <link>https://dev.to/rounakcodes/developer-life-if-words-could-tell-33ml</link>
      <guid>https://dev.to/rounakcodes/developer-life-if-words-could-tell-33ml</guid>
      <description>&lt;p&gt;More than a decade back, I looked up for the best text editor on the web and other than the contemporary heroes, it was emacs or vim which stood out to be the classical choice for many developers. It was hard to choose one since both had a strong community advocating one over the other. I decided to go with vim just for the sake of choosing one and trying it out.&lt;br&gt;
I had never heard of modal editing before. And I couldn't believe that I had not thought of it. How could I miss something so obviously important for editing text? What was I thinking all these years repeating my keystrokes to navigate around text? Until then, I only knew the keyboard shortcuts for moving to the end of a line or word with a control key and a character or similar so-called shortcuts. Yet, navigating is just one minuscule capability of vim. &lt;br&gt;
About six months ago (which is after two decades of computing), I discovered the tiling window manager Xmonad. When used in combination with Arch Linux (and without a heavy desktop environment like Gnome), it feels incredibly powerful and yet simple to manage my workflow needs. The ability to move windows around on one workspace, across workspaces and across multiple displays coupled with the customization to control the look and feel (with keystrokes) is astonishing. And yet navigating around windows is just one of the things that Xmonad allows you to do. I do not know Haskell and this is why I was not sure whether I would stick with Xmonad. But over the last six months, I have been able to modify the config for my needs without learning Haskell, so no complaints!&lt;br&gt;
Xmonad makes me rethink about my window management habits just like how vim made me do it for my text editing. I feel rejuvenated to use my machine.&lt;/p&gt;

&lt;p&gt;I would love to hear if you have had such moments with any tools/games or anything tech.&lt;/p&gt;

&lt;p&gt;If you liked this post, you may want to read: &lt;a href="https://dev.to/rounakcodes/optimizing-the-desktop-environment-top-menu-bar-pg6"&gt;Optimizing the Desktop Environment&lt;/a&gt;&lt;/p&gt;

</description>
      <category>developerlife</category>
      <category>developer</category>
      <category>linux</category>
    </item>
    <item>
      <title>Optimizing the Desktop Environment: Top Menu Bar</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Fri, 22 Jul 2022 05:00:00 +0000</pubDate>
      <link>https://dev.to/rounakcodes/optimizing-the-desktop-environment-top-menu-bar-pg6</link>
      <guid>https://dev.to/rounakcodes/optimizing-the-desktop-environment-top-menu-bar-pg6</guid>
      <description>&lt;h2&gt;
  
  
  Purpose
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;To question commonly adopted practices&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Top Menu Bar
&lt;/h2&gt;

&lt;p&gt;If you are using only a laptop screen, you are already constrained with a limited screen real estate. You would want to put every pixel to some good use. The top menu bar consumes a permanent space. If you think about it, auto-hide and full-screen do not actually let you view the top menu bar contents. So, if you need to view your network status when you are in a full-screen app/mode, you need to get out of it.&lt;/p&gt;

&lt;p&gt;Typical contents of a top menu bar are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;date and time&lt;/li&gt;
&lt;li&gt;network status&lt;/li&gt;
&lt;li&gt;battery status&lt;/li&gt;
&lt;li&gt;volume control &lt;/li&gt;
&lt;li&gt;some apps prominently controlled with a tray icon&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think about the percentage of the total time you spend on your machine that you devote to using the above items! &lt;/p&gt;

&lt;p&gt;Lastly, is the viewing experience optimal? Do you really like (unknowingly) straining your eyes to watch a 10px date/time text placed in a corner of the screen? Or would you rather have it in a larger font and in the center of the screen?&lt;/p&gt;

&lt;h2&gt;
  
  
  What do I do?
&lt;/h2&gt;

&lt;p&gt;I prefer to use my keyboard.&lt;br&gt;
I disabled my top menu bar completely.&lt;br&gt;
I execute a shell script which collects all the info (like battery status, network status etc). &lt;br&gt;
I have a notification configured to display this info at the center of the screen every 15 minutes. &lt;br&gt;
Additionally, I have a keyboard shortcut to view the notification on demand. &lt;br&gt;
Regarding apps prominently controlled using the tray icon, I had only &lt;em&gt;safeeyes&lt;/em&gt; which thankfully has a cli. If anything else comes up, I am sure linux based distros/apps are flexible enough to help me deal with it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68fu91dcalvbvwgv5k5g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68fu91dcalvbvwgv5k5g.png" alt="Notification"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get this working I also enjoyed setting up a daemon using systemd timers, configuring dunst and learning about the shell commands/applications which communicate with device hardware for their status. That's plenty of unix fun to push me for a post!&lt;/p&gt;
&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;I use Arch linux but the below scripts could still help or get you started if you are using some other linux based distros.&lt;/p&gt;
&lt;h3&gt;
  
  
  nodejs script
&lt;/h3&gt;

&lt;p&gt;You may have to edit it to suit your needs. For example, instead of &lt;strong&gt;nmcli&lt;/strong&gt;, you could  use your existing network utility and extract its status output. Same for Xmonad (&lt;strong&gt;xprop&lt;/strong&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const util = require("util");
const stdExec = require("child_process").exec;
const exec = util.promisify(stdExec);

const appNameForDunst = "CombinedNotification";
const executeScript = async (shellCommand) =&amp;gt; {
  return await exec(shellCommand);
};

const notifySendCommand = async (text) =&amp;gt;
  await executeScript(
    `notify-send -t 5000 -a ${appNameForDunst} "Status\n" "${text}"`
  );

const commands = [
  {
    title: "Date",
    command: "date '+ %a %d %b %y'",
    process: "return output",
    color: "orange",
  },
  {
    title: "Time",
    command: "date '+ %I:%M'",
    process: "return output",
    color: "yellow",
  },
  {
    title: "Battery",
    command: "acpi -b",
    process:
      'let commaSplit = output.split(","); let chargingStatus = commaSplit[0].split(":")[1]; return `${chargingStatus} ${commaSplit[1]}`',
    color: "silver",
  },
  {
    title: "Network",
    command: "nmcli -t -f NAME connection show --active",
    process: "return output",
    color: "cyan",
  },
  {
    title: "Workspace",
    command: "xprop -root _NET_CURRENT_DESKTOP",
    process:
      'return ["view", "dev", "servers", "config", "notes", "work"][output.trim().substr(-1)]',
    color: "violet",
  },
  {
    title: "Window Count",
    command: "xprop -root _NET_CLIENT_LIST_STACKING",
    process: 'return output.split("#").join("").split(",").length',
    color: "white",
  },
];

let displayText = "";

const handler = async (command, index) =&amp;gt; {
  const result = await executeScript(command.command);
  const processOutput = new Function("output", command.process);
  const lineEndingChar =
    ["Date", "Time"].includes(command.title) || index == commands.length
      ? ""
      : "\n";
  displayText =
    displayText +
    `&amp;lt;span&amp;gt;${command.title}:&amp;lt;/span&amp;gt; &amp;lt;span color='${
      command.color
    }'&amp;gt;${processOutput(result.stdout)}&amp;lt;/span&amp;gt;${lineEndingChar}`;
  console.log(displayText);
};

const main = async () =&amp;gt; {
  try {
    await Promise.allSettled(commands.map(handler));
    notifySendCommand(displayText);
  } catch (error) {
    console.log(error);
  }
};

main();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  systemd scripts
&lt;/h3&gt;

&lt;p&gt;I placed these in &lt;em&gt;~/.config/systemd/user&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;notification.service&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Unit]
Description=Show notification service
Wants=notification.timer

[Service]
Type=simple
ExecStart=/usr/bin/node /home/&amp;lt;username&amp;gt;/&amp;lt;path-to-nodejs-script&amp;gt;
Environment="DISPLAY=:0" "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus" "XAUTHORITY=/home/&amp;lt;username&amp;gt;/.Xauthority"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;notification.timer&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Unit]
Description=Show notification timer

[Timer]
# The Unit item is not necessary as long as the name before the .service extension is same
Unit=notification.service
OnBootSec=2m
OnUnitActiveSec=15m

[Install]
WantedBy=timers.target
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>productivity</category>
      <category>desktop</category>
      <category>unix</category>
      <category>linux</category>
    </item>
    <item>
      <title>Use Symbolic Links to version control your config files</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Tue, 14 Dec 2021 01:26:00 +0000</pubDate>
      <link>https://dev.to/rounakcodes/use-symbolic-links-to-version-control-your-config-files-2048</link>
      <guid>https://dev.to/rounakcodes/use-symbolic-links-to-version-control-your-config-files-2048</guid>
      <description>&lt;p&gt;Coming from Windows based OS, I thought of symbolic links in Unix based OS as a way of creating shortcuts like "Create a Desktop shortcut for ..." and so I never paid much attention to it.&lt;/p&gt;

&lt;p&gt;I have now (15 years late) discovered its value. &lt;/p&gt;

&lt;p&gt;Usually, you have your configuration (&lt;em&gt;dotfiles&lt;/em&gt;) files for shell, text editors, git etc in your home directory (or &lt;code&gt;~/.config&lt;/code&gt;). &lt;br&gt;
It is not convenient to version control your home directory to backup some of these config files.&lt;/p&gt;

&lt;p&gt;The solution is to create symbolic links. Create any directory like &lt;code&gt;~/.dotfiles&lt;/code&gt; and move all the config files from your home directory to &lt;code&gt;~/.dotfiles&lt;/code&gt;. Then create a symbolic link in the home directory. Now you can version control &lt;code&gt;~/.dotfiles&lt;/code&gt; with ease.&lt;/p&gt;

&lt;p&gt;I wrote this short article just to draw attention to the value of symbolic links. &lt;br&gt;
For implementation details, you can watch these excellent videos which also introduces &lt;code&gt;GNU Stow&lt;/code&gt; to avoid the pain of creating symbolic links manually. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=gibqkbdVbeY"&gt;Create dotfiles folder and use symoblic links&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=CxAT1u8G7is"&gt;GNU Stow&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>dotfiles</category>
      <category>shell</category>
      <category>config</category>
      <category>stow</category>
    </item>
    <item>
      <title>Keycloak: REST API for Realm Role</title>
      <dc:creator>rounakcodes</dc:creator>
      <pubDate>Wed, 16 Jun 2021 11:34:52 +0000</pubDate>
      <link>https://dev.to/rounakcodes/keycloak-rest-api-for-realm-role-5hgp</link>
      <guid>https://dev.to/rounakcodes/keycloak-rest-api-for-realm-role-5hgp</guid>
      <description>&lt;h3&gt;
  
  
  Get access token
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Code
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  curl &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"client_id=admin-cli"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"username=admin"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"password=admin"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"grant_type=password"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"http://localhost:8080/auth/realms/master/protocol/openid-connect/token"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create a Realm Role
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Code
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST http://localhost:8080/auth/admin/realms/&amp;lt;realm-id&amp;gt;/roles &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TOKEN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"name": "&amp;lt;role-name&amp;gt;"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Get all Realm Roles
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Code
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  curl &lt;span class="nt"&gt;-X&lt;/span&gt; GET http://localhost:8080/auth/admin/realms/&amp;lt;realm-id&amp;gt;/roles &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TOKEN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>keycloak</category>
      <category>realm</category>
      <category>authentication</category>
      <category>authorization</category>
    </item>
  </channel>
</rss>
