<?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: Nitin Sijwali</title>
    <description>The latest articles on DEV Community by Nitin Sijwali (@nsijwali).</description>
    <link>https://dev.to/nsijwali</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F861271%2F5bfb2e15-e293-480c-a077-34eab6e0869c.jpeg</url>
      <title>DEV Community: Nitin Sijwali</title>
      <link>https://dev.to/nsijwali</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nsijwali"/>
    <language>en</language>
    <item>
      <title>I built a tool that turns a YAML file into a video</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Sun, 08 Nov 2026 14:30:00 +0000</pubDate>
      <link>https://dev.to/nsijwali/i-built-a-tool-that-turns-a-yaml-file-into-a-video-3pp3</link>
      <guid>https://dev.to/nsijwali/i-built-a-tool-that-turns-a-yaml-file-into-a-video-3pp3</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj4wp7ak3hbek462vzbfi.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj4wp7ak3hbek462vzbfi.gif" alt="yamlreel demo: a diagram building itself from one YAML file" width="720" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Most short videos about code are a few text scenes and a diagram. So I wanted to write those as data, not drag them around in an editor.&lt;/p&gt;

&lt;p&gt;With yamlreel you write a short YAML file with the scenes, and it renders the video:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="s2"&gt;"yamlreel[ffmpeg]"&lt;/span&gt;
yamlreel init system-design my-video.yaml
yamlreel render my-video.yaml &lt;span class="nt"&gt;--preview&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each render gives you a folder per format (landscape, vertical, square) with the video, a poster frame for the thumbnail, a contact sheet of stills to check before you publish, and a share-copy.txt with a title, description and hashtags.&lt;/p&gt;

&lt;p&gt;It draws animated diagrams and typed code, scans in tables and arrays, adds word-by-word subtitles and can add a voiceover. The background music is generated on your machine, so there's nothing to license.&lt;/p&gt;

&lt;p&gt;The demo video on the release page was made by yamlreel from one YAML file, with no video editor. It's MIT licensed and needs Python 3.10+ and ffmpeg.&lt;/p&gt;

&lt;p&gt;If you try it, tell me what's awkward in the YAML format. That's the part I most want feedback on.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/nsijwali/yamlreel" rel="noopener noreferrer"&gt;https://github.com/nsijwali/yamlreel&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>video</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Your tests pass today. Will they pass on Feb 29?</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Fri, 06 Nov 2026 14:30:00 +0000</pubDate>
      <link>https://dev.to/nsijwali/your-tests-pass-today-will-they-pass-on-feb-29-j0d</link>
      <guid>https://dev.to/nsijwali/your-tests-pass-today-will-they-pass-on-feb-29-j0d</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx0c27osw4vq8kwc3kusi.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx0c27osw4vq8kwc3kusi.gif" alt="pytest-calendar-chaos catching a month-end bug" width="720" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some date bugs only show up on specific days: Feb 29, the last day of a month, New Year's Eve, a DST change. You can't wait for those dates to test them, so the bugs ship.&lt;/p&gt;

&lt;p&gt;pytest-calendar-chaos runs a marked test once for each of those moments, with the clock frozen using time-machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@pytest.mark.calendar_chaos&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;cases&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;leap_day&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;month_end&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dst&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;zones&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;UTC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;America/New_York&lt;/span&gt;&lt;span class="sh"&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;def&lt;/span&gt; &lt;span class="nf"&gt;test_subscription_renewal&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="bp"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The presets cover leap day, month end, year end, midnight, ISO week 53, the 2038 limit and DST changes. When a case fails, the report shows the exact mocked time and a command that reruns only that scenario. It's opt-in, so unmarked tests don't change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;pytest-calendar-chaos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It needs Python 3.10+ and pytest 8+. It's MIT licensed and at version 0.3.0 on PyPI. It's a small project, so bug reports are the most useful thing you can send me.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/nsijwali/pytest-calendar-chaos" rel="noopener noreferrer"&gt;https://github.com/nsijwali/pytest-calendar-chaos&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>testing</category>
      <category>opensource</category>
      <category>pytest</category>
    </item>
    <item>
      <title>Fenceline: a pixel territory game in one HTML file, with a flood fill and no audio files</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Thu, 05 Nov 2026 19:12:42 +0000</pubDate>
      <link>https://dev.to/nsijwali/fenceline-a-pixel-territory-game-in-one-html-file-with-a-flood-fill-and-no-audio-files-53hh</link>
      <guid>https://dev.to/nsijwali/fenceline-a-pixel-territory-game-in-one-html-file-with-a-flood-fill-and-no-audio-files-53hh</guid>
      <description>&lt;p&gt;built a free Qix-style browser game with canvas, vanilla JS and WebAudio. No dependencies, no network calls, works offline."&lt;br&gt;
tags: webdev, javascript, gamedev, showdev&lt;/p&gt;
&lt;h2&gt;
  
  
  cover_image: &lt;a href="https://fenceline.nitinsijwali.com/og-image.png" rel="noopener noreferrer"&gt;https://fenceline.nitinsijwali.com/og-image.png&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;I wanted to see how far plain HTML and canvas could go, so I built &lt;strong&gt;Fenceline&lt;/strong&gt;: a free pixel territory game for the browser. No login, no ads, and it works offline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Play it:&lt;/strong&gt; &lt;a href="https://fenceline.nitinsijwali.com" rel="noopener noreferrer"&gt;https://fenceline.nitinsijwali.com&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Source (MIT):&lt;/strong&gt; &lt;a href="https://github.com/nsijwali/fenceline" rel="noopener noreferrer"&gt;https://github.com/nsijwali/fenceline&lt;/a&gt;&lt;/p&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6bukhl6yqn7pxlvadc0g.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6bukhl6yqn7pxlvadc0g.png" alt="Fenceline gameplay, Day look" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The game
&lt;/h2&gt;

&lt;p&gt;You walk along the walls. Step into open ground to start drawing a fence, and reach a wall again to close it. Whatever the pterodactyl can't reach becomes yours. Claim enough land to clear the level, and the target rises each level. It's the Qix idea, dressed like the offline dino page.&lt;/p&gt;
&lt;h2&gt;
  
  
  Constraints I set
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One file.&lt;/strong&gt; Markup, CSS, JS and the pixel font are all in &lt;code&gt;index.html&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No dependencies and no network calls.&lt;/strong&gt; The font is embedded as base64.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No audio files.&lt;/strong&gt; The music is generated live.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Claiming land is a flood fill
&lt;/h2&gt;

&lt;p&gt;The playfield is a grid (96 by 64, or 64 by 96 in portrait). When you close a fence, the game doesn't try to work out which region is "inside". It does the reverse: it floods outward from the enemy and claims everything the flood couldn't reach.&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;closeTrail&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;n0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;trail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for &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;i&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;trail&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;          &lt;span class="c1"&gt;// the fence becomes wall&lt;/span&gt;
  &lt;span class="nx"&gt;trail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt; &lt;span class="nx"&gt;drawing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&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;vis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;N&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Int32Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;N&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for &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;w&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;wisps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;                      &lt;span class="c1"&gt;// seed from every enemy&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;s&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;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;h&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;                               &lt;span class="c1"&gt;// breadth-first fill&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;     &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;     &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;H&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;q&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;W&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;filled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;N&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;vis&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;filled&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// ...score, percentage, level clear&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two details I like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It works with any number of enemies.&lt;/strong&gt; More pterodactyls just means more seeds, with no extra cases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;There's no allocation worth worrying about.&lt;/strong&gt; The visited array and queue are typed arrays sized to the grid, and a closed fence runs one pass over a few thousand cells.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Music without samples
&lt;/h2&gt;

&lt;p&gt;The soundtrack is built around a two-note whistled call and played by a small WebAudio scheduler. A timer runs every 25 ms and schedules every note that falls inside the next 0.18 seconds:&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;musicTick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;AC&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;TRACKS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;track&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;sp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bpm&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;nextT&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;AC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTime&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;musicStep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;step&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;nextT&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;nextT&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;sp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;step&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;step&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bars&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;16&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;The timer can wobble, but the audio clock doesn't, so notes land on time. Each look has its own tempo and lead sound:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Look&lt;/th&gt;
&lt;th&gt;Tempo&lt;/th&gt;
&lt;th&gt;Lead&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Day&lt;/td&gt;
&lt;td&gt;92 BPM&lt;/td&gt;
&lt;td&gt;Soft triangle with echo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Night&lt;/td&gt;
&lt;td&gt;72 BPM&lt;/td&gt;
&lt;td&gt;Sine with echo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Handheld&lt;/td&gt;
&lt;td&gt;104 BPM&lt;/td&gt;
&lt;td&gt;Pulse wave, no echo&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Three looks from CSS variables
&lt;/h2&gt;

&lt;p&gt;The look changes every level. Each one is a set of CSS custom properties on &lt;code&gt;[data-theme]&lt;/code&gt;, read once into the canvas palette. Sprites are small string maps drawn with image smoothing off, so the pixels stay sharp at any size.&lt;/p&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk8yvq0krubwxv5x0f1e5.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk8yvq0krubwxv5x0f1e5.png" alt="Night look" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Shipping it
&lt;/h2&gt;

&lt;p&gt;It's the &lt;code&gt;public/&lt;/code&gt; folder served as Cloudflare Workers static assets, with a strict Content Security Policy (&lt;code&gt;default-src 'none'&lt;/code&gt;). Since the page has no network calls, the policy can allow almost nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd like feedback on
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Does the difficulty feel fair around level 2?&lt;/li&gt;
&lt;li&gt;Does it play well on your phone?&lt;/li&gt;
&lt;li&gt;What should the next enemy do?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you try it, tell me how far you got.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>gamedev</category>
      <category>opensource</category>
    </item>
    <item>
      <title>But it works on my machine...</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Wed, 04 Nov 2026 15:54:44 +0000</pubDate>
      <link>https://dev.to/nsijwali/but-it-works-on-my-machine-2989</link>
      <guid>https://dev.to/nsijwali/but-it-works-on-my-machine-2989</guid>
      <description>&lt;p&gt;“It works on my machine.”&lt;/p&gt;

&lt;p&gt;A reassuring sentence… until you’re the person deploying it. 😄&lt;/p&gt;

&lt;p&gt;That’s where the 12-Factor App principles come in. They help teams avoid some very familiar headaches.&lt;/p&gt;

&lt;p&gt;Settings buried in code.&lt;br&gt;
A dependency installed on someone’s laptop.&lt;br&gt;
Sessions disappearing when a new instance starts.&lt;/p&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4do3uqwkt618dx8za6nh.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4do3uqwkt618dx8za6nh.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The name sounds academic. The ideas are pretty practical:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Codebase&lt;br&gt;
One codebase in version control, deployed across environments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dependencies&lt;br&gt;
Declare what your app needs. “Ask Dave to install it” doesn’t count.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Config&lt;br&gt;
Keep environment-specific settings outside your code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backing services&lt;br&gt;
Treat databases, caches, and queues as attached resources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build, release, run&lt;br&gt;
Separate these stages so you know exactly what you’re deploying.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Processes&lt;br&gt;
Keep processes stateless. A user’s session shouldn’t depend on which instance answers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Port binding&lt;br&gt;
Expose your service through a port.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Concurrency&lt;br&gt;
Scale by adding process instances.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Disposability&lt;br&gt;
Start quickly. Shut down gracefully. Finish or safely hand off work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dev/prod parity&lt;br&gt;
Keep environments similar. Fewer “but it worked locally” surprises.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Logs&lt;br&gt;
Emit logs as event streams so your platform can collect and route them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Admin processes&lt;br&gt;
Run migrations and maintenance tasks using the same code and configuration as your app.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You don’t need to tackle all 12 at once.&lt;/p&gt;

&lt;p&gt;Start with the one that keeps causing trouble. Maybe it’s config. Maybe it’s shutdown behavior. Maybe only one person knows how deployments work, and they’re going on holiday. 😅&lt;/p&gt;

&lt;p&gt;Which factor has been hardest to get right on your team?&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>systemdesign</category>
      <category>12factorapp</category>
    </item>
    <item>
      <title>I built a world history map where every ruler links to a source</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Tue, 03 Nov 2026 19:22:08 +0000</pubDate>
      <link>https://dev.to/nsijwali/i-built-a-world-history-map-where-every-ruler-links-to-a-source-2i3b</link>
      <guid>https://dev.to/nsijwali/i-built-a-world-history-map-where-every-ruler-links-to-a-source-2i3b</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0y3oxk1205s1ujz17x98.jpg" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0y3oxk1205s1ujz17x98.jpg" alt="WhoRuled: drag a year slider and see who ruled each state" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Most history maps show the borders. I wanted one that also says who was in charge, and where that claim came from.&lt;/p&gt;

&lt;p&gt;You drag a year slider from 1000 BC to today, the borders move, and you can click any state to see who ruled it and what government sat below them.&lt;/p&gt;

&lt;p&gt;Every ruler, office and event links to its source. This is enforced in code, not by trust. The fact schema rejects any entry without a source URL and a quote, so a claim that can't be backed up doesn't get in.&lt;/p&gt;

&lt;p&gt;A few things that might help if you build something similar:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's fully static. There's no server. The map geometry and facts are built ahead of time, and the browser fetches one TopoJSON file per year, so moving back and forth costs little.&lt;/li&gt;
&lt;li&gt;The map is one Canvas 2D element using d3-geo, inside a single React island. The rest of the site is plain Astro pages.&lt;/li&gt;
&lt;li&gt;Each state has its own page for search, like "who ruled France in 1960". The geometry and facts come from open datasets, and the licences are on the About page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It isn't finished. Some regions still have gaps where I haven't found a sourced ruler, and I'd rather leave them blank than guess. Every page has a link to report a correction.&lt;/p&gt;

&lt;p&gt;Live: &lt;a href="https://whoruled.nitinsijwali.com" rel="noopener noreferrer"&gt;https://whoruled.nitinsijwali.com&lt;/a&gt;&lt;br&gt;
Code: &lt;a href="https://github.com/nsijwali/WhoRuled" rel="noopener noreferrer"&gt;https://github.com/nsijwali/WhoRuled&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>opensource</category>
      <category>history</category>
    </item>
    <item>
      <title>Convert number to string in JS</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Fri, 03 Jun 2022 13:35:58 +0000</pubDate>
      <link>https://dev.to/nsijwali/convert-number-to-string-in-js-822</link>
      <guid>https://dev.to/nsijwali/convert-number-to-string-in-js-822</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Looking at the title, you might think it's a simple task that any noob can complete. right??&lt;/em&gt;&lt;br&gt;
&lt;em&gt;However, the actual question was, write a function that accepts an args as a number and returns the string version of the same number, given that you cannot use string methods like function toString(), or initialise a variable with an empty string, or use any other tricks.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;So we will approach this problem by keeping two points in mind&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every number is formed from digits 0-9;&lt;/li&gt;
&lt;li&gt;Divide and conquer rule&lt;/li&gt;
&lt;li&gt;Recursion
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let stringNum;
const arr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
let temp;
function convertToString(num) {
  if (num &amp;gt; 0) { // condition will give the string but in reverse order.
    const dividend = num % 10;
    if (temp) {
      temp += arr[dividend];
    } else {
      temp = arr[dividend];
    }
    convertToString(Math.floor(num / 10)); // recursion
  } else {
// here we will reverse the string to get the actual number in string format.
    for (let i = temp.length - 1; i &amp;gt;= 0; i--) {
      if (stringNum) {
        stringNum += temp.charAt(i);
      } else {
        stringNum = temp.charAt(i);
      }
    }

  }
  return stringNum;
}

const result = convertToString(125)
console.log(result) // "125"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Please give it a shot and let me know what you think.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Please ❤️ it and share it your with friends or colleagues. Spread the knowledge.&lt;/p&gt;




&lt;p&gt;Thats all for now. Keep learning and have faith in Javascript❤️&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>programming</category>
    </item>
    <item>
      <title>Javascript: Sum diagonal and counter diagonal elements of n * n matrix</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Tue, 31 May 2022 14:09:50 +0000</pubDate>
      <link>https://dev.to/nsijwali/javascript-sum-diagonal-and-counter-diagonal-elements-of-n-n-matrix-ghc</link>
      <guid>https://dev.to/nsijwali/javascript-sum-diagonal-and-counter-diagonal-elements-of-n-n-matrix-ghc</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Given a square matrix of size n, calculate the sum of diagonal and counter diagonal elements.&lt;br&gt;
where n &amp;gt; 1&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Example:
[
  [1, 8, 7],
  [2, 9, 6],
  [3, 4, 5]
]
diagonal = positions [0][0] + [1][1]+ [2][2] =&amp;gt; 1+9+5 =15,
counterDiagonal = positions [0][2] + [1][1]+ [3][0] =&amp;gt; 7+9+3 =19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Let's try first with brute force method then will optimise it.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sumOfDiagonals(matrix) {
  const len = matrix.length;
  let diagonalSum = 0;
  let counterDiagonalSum = 0;
  for (let i = 0; i &amp;lt; len; i++) {
    for (let k = 0; k &amp;lt; len; k++) {
      if (i === k) {
        diagonalSum += matrix[i][k];
      }
      if (i + k == len - 1) {
        counterDiagonalSum += matrix[i][k];
      }

    }
  }

  console.log("sum of diagonal elements --- ", diagonalSum)
  console.log("sum of counter diagonal elements ---", counterDiagonalSum)
}
sumOfDiagonals([
  [1, 8, 7],
  [2, 9, 6],
  [3, 4, 5]
]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The solution above works well but the time and space complexity are O(n^2) time and O(1) where n is the number of elements our loop iterated and power 2 is for the two loops that we used.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Let's try the optimised solution:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sumOfDiagonals(matrix) {
  const len = matrix.length;
  let diagonalSum = 0;
  let counterDiagonalSum = 0;
  for (let i = 0; i &amp;lt; len; i++) {
    diagonalSum += matrix[i][i];
    counterDiagonalSum += matrix[i][len - i - 1];
  }

  console.log("sum of diagonal elements --- ", diagonalSum)
  console.log("sum of counter diagonal elements ---", counterDiagonalSum)
}
sumOfDiagonals([
  [1, 8, 7],
  [2, 9, 6],
  [3, 4, 5]
]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Now the time complexity has been reduced to  O(n).&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Please ❤️ it and share it your with friends or colleagues. Spread the knowledge.&lt;/p&gt;




&lt;p&gt;Thats all for now. Keep learning and have faith in Javascript❤️&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>dsa</category>
      <category>algorithms</category>
      <category>webdev</category>
    </item>
    <item>
      <title>FizzBuzz program in javascript</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Mon, 16 May 2022 14:13:16 +0000</pubDate>
      <link>https://dev.to/nsijwali/fizzbuzz-program-in-javascript-51bo</link>
      <guid>https://dev.to/nsijwali/fizzbuzz-program-in-javascript-51bo</guid>
      <description>&lt;p&gt;&lt;em&gt;In javascript interviews, the most frequently asked question is "FizzBuzz." The goal of asking this question is to see how you approach solving the problem rather than the solution itself.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The following is an example of a question. Print the numbers 1 to 100 that meet the following conditions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Print "Fizz" if a number is divisible by 3.&lt;/li&gt;
&lt;li&gt;Print "Buzz" if a number is divisible by 5.&lt;/li&gt;
&lt;li&gt;Print "FizzBuzz" if the number is divisible by both 3 and 5.&lt;/li&gt;
&lt;li&gt;else print the number itself.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;The solution is straightforward, but the approach is critical.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A newcomer would do it like this:&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;function fizzBuzz(){
   for(let i = 1; i &amp;lt;= 100; i++){
     if(i % 3 === 0 &amp;amp;&amp;amp; i % 5 === 0){
        console.log('FizzBuzz');
     }else if(i % 3 === 0){
        console.log('Fizz');
     }else if(i % 5 === 0){
        console.log('Buzz');
     }else{
        console.log(i);
     }
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;This is how people with some experience would do it:&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; function fizzBuzz(){
   for(let i = 1; i &amp;lt;= 100; i++){
// instead of checking if divisible by both 3 and 5 check with 15.
     if(i % 15 === 0){ 
        console.log('FizzBuzz');
     }else if(i % 3 === 0){
        console.log('Fizz');
     }else if(i % 5 === 0){
        console.log('Buzz');
     }else{
        console.log(i);
     }
   }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;However, a pro developer🚀 would do it as follows:&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;function fizzBuzz() {
 for(let i = 1; i &amp;lt;= 100; i++){
  console.log(((i%3  === 0 ?  "fizz": '') + (i% 5 === 0 ? "buzz" : ''))|| i)
 }
}
fizzBuzz()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope this helps you guys solve it like a pro. Any additional pro solutions are welcome.&lt;/p&gt;

&lt;p&gt;Please ❤️ it and share it your with friends or colleagues. Spread the knowledge.&lt;/p&gt;




&lt;p&gt;Thats all for now. Keep learning and have faith in Javascript❤️&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>dsa</category>
      <category>algorithms</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Function Composition in Javascript</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Fri, 13 May 2022 17:41:29 +0000</pubDate>
      <link>https://dev.to/nsijwali/function-composition-in-javascript-158e</link>
      <guid>https://dev.to/nsijwali/function-composition-in-javascript-158e</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Function composition is an approach where the result of one function is passed on to the next function, which is passed to another until the final function is executed for the final result&lt;/em&gt;.&lt;/p&gt;
&lt;/blockquote&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%2Ff4d9ae59r9as8a8v68nr.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%2Ff4d9ae59r9as8a8v68nr.png" alt="Function Composition" width="799" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const square = x =&amp;gt; x*x;

const addTen = x =&amp;gt; x + 10;

const result = compose(square, addTen)(20);
result: 410;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lets write the &lt;strong&gt;compose&lt;/strong&gt; function for the above question..&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function compose(f1, f2){
  return function(value){
      return f2(f1(value));
  }
}
const result = compose(square, addTen)(20);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if we console log the &lt;strong&gt;result&lt;/strong&gt;, the answer would be 410.&lt;/p&gt;

&lt;p&gt;However, the solution above is only valid if compose accepts no more than two functions. So, to make it work for an n-number of functions, we need to make a few changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function compose(...args){
  return function(value){
      return args.reduce((pre, current) =&amp;gt; current(pre), value);
  }
}
const result = compose(square, addTen, addTen, addTen)(20);
answer: 430.

// here were are using rest operator ...args to accept n-number of arguments in an array.
args.reduce() will iterate over each element/function with the previously computed value, returning the final computed value.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function above can be shortened as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const compose =(...args) =&amp;gt; value =&amp;gt; args.reduce((pre, current) =&amp;gt; current(pre), value);
const result = compose(square, addTen, addTen, addTen)(20);
answer: 430.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope this helps you solve such a problem during your interview.&lt;/p&gt;

&lt;p&gt;Thats all for now. Keep learning and have faith in Javascript❤️&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>dsa</category>
      <category>algorithms</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Merging two arrays and sort the resultant without sort functions using recursion in Javascript</title>
      <dc:creator>Nitin Sijwali</dc:creator>
      <pubDate>Thu, 12 May 2022 05:32:50 +0000</pubDate>
      <link>https://dev.to/nsijwali/merging-two-arrays-and-sort-the-resultant-without-sort-functions-using-recursion-in-javascript-37f8</link>
      <guid>https://dev.to/nsijwali/merging-two-arrays-and-sort-the-resultant-without-sort-functions-using-recursion-in-javascript-37f8</guid>
      <description>&lt;p&gt;&lt;em&gt;Long ago, during an interview for one of the product-based companies, the interviewer asked me a DSA question, which triggered my sixth sense.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So the question was to merge two arrays and sort the resultant array in ascending order.&lt;/strong&gt; &lt;br&gt;
Example:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr1 = [2,4,8,7, 10, 25, 17, 13, 12 ];
const arr2 = [1,4,6,9,8, 11, 13, 3, 0];
So I used spread operator to merge two arrays and  Array.sort() function to sort the values.
const resultant = [...arr1, ...arr2].sort((a, b) =&amp;gt; a-b);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will give the desired result.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The interviewer then asked me not to use the sort function and to create one on my own, explaining that it would require two loops.&lt;br&gt;
So I had to demonstrate the power of javascript to him, and I used recursion instead of two loops.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const result = [...arr1, ...arr2];
let count = 0;
function sorting(){
// to break the recursion when sorting is done.
if(count ===result.length) return true; 

//else do
for(let i = 0; i&amp;lt; result.length; i++){
  if(result[i] &amp;gt; result[i+1]){

//used array destructing to swap values
   [ result[i+1],  result[i]]= [result[i],result[i+1]]; 
  }
}
count++;
sorting();
}
sorting();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;In javascript, recursion is the most underappreciated concept. When DSA is used with javascript, this becomes quite strong. It can flatten arrays, objects, and construct tree structures like UI, among other things.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;That's all for now, folks. Continue to learn and have faith in Javascript.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>dsa</category>
      <category>algorithms</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
