<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Saurabh Raj on Medium]]></title>
        <description><![CDATA[Stories by Saurabh Raj on Medium]]></description>
        <link>https://medium.com/@me4saurabh4u?source=rss-ce1ec0301cda------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3TsKMUzXtsWT4l8R227sHQ.jpeg</url>
            <title>Stories by Saurabh Raj on Medium</title>
            <link>https://medium.com/@me4saurabh4u?source=rss-ce1ec0301cda------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 15:33:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@me4saurabh4u/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Best Udemy Courses I’ve Taken in 2026]]></title>
            <link>https://medium.com/@me4saurabh4u/the-best-udemy-courses-ive-taken-in-2026-c49fbc17502d?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/c49fbc17502d</guid>
            <category><![CDATA[make-money-online]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[udemy]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Sun, 24 May 2026 16:09:29 GMT</pubDate>
            <atom:updated>2026-06-15T12:35:08.074Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b82aHt_olpL-bz-suw-F5w.png" /></figure><p>I initially bought Udemy’s yearly subscription because there was a good offer going on, and I got it for around ₹4200. At the time, I was hesitant because subscriptions often sound exciting in theory, but end up becoming another thing you barely use after a few weeks.</p><p>But this one turned out differently.</p><p>The special thing was not just the amount of content available, but the sheer diversity of subjects I suddenly had access to. In the last few weeks alone, I’ve explored courses on AI agents, system design, full-stack web development, neuroplasticity, communication skills, confidence building, voice training, violin, fitness, memory improvement, and even barbering.</p><p>Let me walk you through some of the ones that stood out.</p><h4><strong>The tech side of things</strong></h4><p>The one I’ve put the most time into is <a href="http://udemy.com/course/openclaw-run-powerful-autonomous-ai-agents-securely"><strong>OpenClaw: Run Powerful &amp; Autonomous AI Agents Securely</strong></a> by Arnold Oberleiter. I’m at 72%, and it’s been genuinely eye-opening — not just about how AI agents work, but about the security layer that most tutorials completely skip over. If you’re building anything agentic, this one is worth your time.</p><p>For system design, <a href="https://www.udemy.com/course/software-architecture-design-of-modern-large-scale-systems/?couponCode=CP260518SUMMXIN"><strong>Software Architecture &amp; Design of Modern Large Scale Systems</strong></a> by Michael Pogrebinsky has been a standout. It tackles the kind of real-world decisions that engineers at scale actually face — scalability, fault tolerance, distributed systems — without making it feel overwhelming. Pogrebinsky has a knack for making complex architecture decisions feel logical. If you’re thinking beyond just “making things work” and starting to wonder about “making things work at scale,” this one is worth your time.</p><p>There were a few more on the tech side — full-stack web dev, Arduino, even a couple of electronics engineering courses — but these two are the ones I kept coming back to.</p><h4><strong>The soft skills rabbit hole</strong></h4><p>This is the category I didn’t expect to spend so much time in.</p><p><a href="https://www.udemy.com/course/neuroplasticity/"><strong>Neuroplasticity: How To Rewire Your Brain</strong></a> by Gregory Caremans has been one of the more grounding courses in the mix. It’s changed how I think about habits, learning, and why some things stick while others don’t. Paired with <a href="https://www.udemy.com/course/how-to-remember-everything"><strong>How To Remember Everything With Tom Weber</strong></a>, it’s given me a more intentional approach to the learning itself — not just the content.</p><p>The <a href="https://www.udemy.com/course/voice-training-for-a-confident-and-powerful-voice"><strong>Voice Training for a Confident and Powerful Voice</strong></a> by GB Voice Academy has been a quiet favourite. The exercises feel practical, and the improvements are noticeable faster than you’d expect.</p><p>The <a href="https://www.udemy.com/course/master-the-violin-from-beginner-zero-level-to-advanced-level"><strong>Beginner Violin Course from Zero (2026)</strong></a> by Rimma Agbo is purely for the joy of it. My violin sounds less like a distressed animal than it did a month ago, so I’ll call that progress.</p><p>The <a href="https://www.udemy.com/course/learn-english-grammar-online"><strong>English Master Course: English Grammar, English Speaking</strong></a> by Scott Mendoza was another one I picked up. It’s surprisingly engaging — not dry or textbook-like at all, and useful whether you’re brushing up or building fluency from scratch.</p><p>And then there’s <a href="https://www.udemy.com/course/become-a-barber-with-the-one-minute-barber/"><strong>Become a Barber with the One Minute Barber</strong></a> by Michael Holm — one I enrolled in half-jokingly and then found myself genuinely watching. Whether I ever pick up a pair of scissors professionally is beside the point. It’s a reminder that learning something completely outside your world is its own kind of refreshing.</p><p>Earlier, whenever I wanted to learn something outside my domain, there was always a small mental barrier: <strong>Should I really spend money on this?</strong><br><strong>What if I lose interest after two hours?</strong></p><p>But with a subscription model, that friction disappears completely. You become much more willing to explore random curiosity.</p><p>And that has probably been the most valuable part.</p><p>Not every course becomes life-changing. Many of you leave halfway. Some are average. But occasionally, you come across a course, an idea, or even a single sentence that unexpectedly shifts your perspective.</p><p>I genuinely think more people should spend time learning outside their primary field, especially early in their careers. Broad exposure to different domains compounds in unexpected ways over time.</p><p><strong>Curious to know:</strong><br>What are some of the best online courses you’ve taken recently? Comments are open.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c49fbc17502d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OpenAI built ChatGPT. I Built the Feature They Missed]]></title>
            <link>https://medium.com/@me4saurabh4u/openai-built-chatgpt-i-built-the-feature-they-missed-268b063b8652?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/268b063b8652</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[chrome]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Wed, 20 May 2026 16:07:17 GMT</pubDate>
            <atom:updated>2026-05-20T16:07:17.760Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MRQTZYi74VPk-hus91zaIA.png" /></figure><p>I have a graveyard of conversations.</p><p>Thousands of them. Sitting in a sidebar, organized by nothing, remembered by no one. Brilliant explanations of system design. A perfect analogy for how closures work. A rewrite of my bio that was genuinely better than anything I’d written myself.</p><p>At some point, I stopped thinking of this as a ChatGPT problem and started thinking of it as <em>my</em> problem. Maybe I should be copy-pasting things into Notion. Maybe I should be more disciplined. Maybe I should take better notes.</p><p>Then one day it hit me: I <em>was</em> taking notes. That’s exactly what I was doing inside ChatGPT — learning, refining, thinking out loud. The notes just had nowhere to live.</p><p>So I built them a home.</p><h3>Notebook for ChatGPT — Highlight, Notes &amp; PDF Export</h3><p>It is a Chrome extension that does something deceptively simple: it makes ChatGPT feel like a place worth returning to.</p><p>The first feature I added was <strong><em>highlighting</em></strong> — and I almost didn’t build it because it felt too small and obvious. But combined with everything that came after, it’s what makes the whole thing click.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M-w0H08zBmf9-H-x9-op8Q.png" /></figure><h3>The Features That Followed</h3><h4><strong>1. Comment</strong></h4><p>You know how Medium lets you highlight a line and leave a note right on it? Same idea. Select any text inside a ChatGPT response, drop a comment, and it sits anchored to that exact line. Your reaction, your doubt, your “come back to this” — attached right where it belongs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5sAjwRDhZLk52c7I8PL7ww.png" /></figure><h4><strong>2. Message bookmarking with a tag</strong></h4><p>Some responses aren’t worth annotating. They’re just worth keeping. So I added message bookmarking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*irrS3HMBJN40b3d-SIdeZA.png" /></figure><p>All these notes are in the side panel whenever you need them. Search by tag or text and get to it instantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*glv2alm-GMyKOWIGiIVarg.png" /></figure><h4><strong>3. Follow-up questions</strong></h4><p>It often happens that I would get deep in a long explanation — really following it — and a question would pop into my head. Not a distraction, a <em>genuine</em> follow-up. But if I asked it immediately, I’d break the flow. The conversation would fork. I’d lose the thread I was holding.</p><p>So I built a small fix: <strong><em>select any text, save the question it triggered, and keep reading.</em></strong> When you’re done, send all your follow-ups at once.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L7g4HETpb2OqER761DWU2w.png" /></figure><h4><strong>4. Conversation-level tagging</strong></h4><p>One more thing I added — tagging entire conversations. Because some conversations are too good to lose in a sidebar of a hundred untitled chats. Tag it and find it later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YqwFSZKuvu1rUv7izQ5JRA.png" /></figure><h4><strong>5. Custom prompt shortcuts.</strong></h4><p>After a while, you notice you type the same things constantly. <em>Explain this simply. Summarize. Rewrite this more clearly.</em> Typing # now opens a list of your personal shortcuts. One click, injected. It stops feeling like a feature and starts feeling like muscle memory. You can add, edit, or remove these prompts as per your needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BwD1Nnnr3Rsj91OXv1p0iw.png" /></figure><h4><strong>6. Edit AI responses</strong></h4><p>ChatGPT often gives good answers inside bloated packaging — the right idea wrapped in three unnecessary paragraphs. I added the ability to edit responses directly. Trim the fluff. Rewrite in your own voice. Keep what matters. This will also be useful when you export it to PDF, as the final edited version will be used for export.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7k8yksAZgnUqdeAQPsNhmg.png" /></figure><h4><strong>7. Export chat to PDF or Markdown</strong></h4><p>Most AI exports are bleak. Raw text. Cold formatting. The kind of thing you open once and never look at again. I designed export themes that look like notebook pages — the kind you might actually print, revisit, or share.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwpKl0uMPV1tyQxPFOjcbw.png" /></figure><p>Check out the extension here: <a href="https://chromewebstore.google.com/detail/gdkookocbeohhfjjpiekdkmconjeehkj?utm_source=item-share-cb">https://chromewebstore.google.com/detail/gdkookocbeohhfjjpiekdkmconjeehkj?utm_source=item-share-cb</a></p><p><strong>Demo video:</strong></p><p><a href="https://www.youtube.com/watch?v=3dwz-h4Q5z4&amp;t=29s">https://www.youtube.com/watch?v=3dwz-h4Q5z4</a></p><h4>Your thoughts 💭</h4><p>If the gaps that I filled with these features bothered you, too, I’d love for you to try out the extension. And if something feels off, missing, or could be better — tell me. This whole thing started because I noticed something nobody else had built. The next version starts the same way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=268b063b8652" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Loophole That Gives You Infinite OpenAI Codex Tokens]]></title>
            <link>https://medium.com/@me4saurabh4u/the-loophole-that-gives-you-infinite-openai-codex-tokens-3e268d9fab97?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e268d9fab97</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Sat, 16 May 2026 18:26:26 GMT</pubDate>
            <atom:updated>2026-05-16T18:26:26.440Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aqiE_Jqg2_49BF1Vy1-jiA.png" /></figure><p>There’s a quiet war going on between power users and AI subscription limits. And right now, someone has found a way to win it — at least against OpenAI Codex.</p><h3>First, How Codex Tokens Actually Work</h3><p>Like most AI coding tools, Codex gives you a pool of tokens on a rolling basis — some every 5 hours, a larger bucket every week. Once you hit the limit, you’re cut off.</p><p>But <em>how</em> do you get cut off? That’s where things get interesting.</p><p><strong>Claude Code</strong> is ruthless about it. Mid-refactor, mid-function, mid-thought — doesn’t matter. Tokens gone, session over. Full stop.</p><p><strong>OpenAI Codex</strong> plays it differently. Call it the gentleman’s rule: it lets the AI finish whatever job it’s currently working on before pulling the plug. A small, polite design choice.</p><p>And a surprisingly exploitable one.</p><h3>The Infinite Token Exploit</h3><p>Codex has a feature called Goals — a high-level objective you hand the agent instead of prompting it task by task. You point it at a mission, and it works autonomously until the mission is complete.</p><p>The keyword being <em>complete</em>.</p><blockquote><strong><em>Set your Goal to “complete all open GitHub issues.” Then never let the issues run out.</em></strong></blockquote><p>As long as there are open issues in the queue, the agent keeps working. Codex won’t cut off the session because the goal technically hasn’t been completed. The job is still in progress. And by its own rules, Codex won’t interrupt an in-progress job.</p><p>So you just… keep adding issues.</p><h3>The Only Rule: Don’t Hit Escape</h3><p>There’s one way to kill the magic, and it’s too easy to do by accident.</p><p><strong>Don’t hit Escape.</strong></p><p>Hitting Escape tells Codex to stop pursuing the active goal. The moment it does, the session ends — and if your tokens are depleted, you’re locked out.</p><h3>How Far Can You Push It?</h3><p>According to the developer who first shared this, pretty far. He was 18 hours into a continuous run when he posted about it — and the agent was still going.</p><p>Enjoy it while it lasts. Now that the trick is out, a patch is probably coming.</p><p><em>Have you found creative ways to work around AI tool limits? Drop it in the comments — I’d love to know what else is out there.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e268d9fab97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Free App That Turns macOS Into a Programmable Toy]]></title>
            <link>https://medium.com/@me4saurabh4u/the-free-app-that-turns-macos-into-a-programmable-toy-96dc5447163f?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/96dc5447163f</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[tricks]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Sat, 25 Apr 2026 17:37:25 GMT</pubDate>
            <atom:updated>2026-04-25T17:37:58.399Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9lecxuGVx_KiWyMnclkGzg.png" /></figure><p>Most apps do what their developers decided they should do.</p><p>Hammerspoon does whatever you tell it to.</p><p>It’s a free macOS app that cracks open your operating system and hands you the controls — through a tiny scripting language called Lua. Window focus. Mouse position. Keyboard shortcuts. System settings. App launching. All of it becomes programmable, in plain text files you can read, share, and tweak in five minutes.</p><p>No subscription. No GUI. No waiting for a feature request. Just you, a text editor, and a Mac that finally behaves like <em>yours</em>.</p><h3>What Hammerspoon Actually Lets You Do</h3><p>Before the code, the concept. Hammerspoon works by letting you write small scripts that react to things happening on your Mac:</p><ul><li>A window gets focused → move the cursor</li><li>A key is pressed → launch an app</li><li>A hotkey fires → open a specific Settings pane</li><li>The config reloads → show a toast notification</li></ul><p>Each of these is a few lines of Lua. You don’t need to know Lua. You need to know what’s annoying you.</p><p>That’s the whole game.</p><h3>Setting Up: 60 Seconds Flat</h3><pre>brew install --cask hammerspoon</pre><p>Open it. Grant Accessibility permissions when prompted (System Settings → Privacy &amp; Security → Accessibility). Done.</p><p>Hammerspoon now watches one folder: ~/.hammerspoon/. You need to create an init.lua file inside it.</p><p>To do so, open Terminal and run the following commands in order.</p><pre>mkdir -p ~/.hammerspoon<br>cat &gt; ~/.hammerspoon/init.lua &lt;&lt; &#39;EOF&#39;<br>hs.alert.show(&quot;Hello from your operating system&quot;)<br>EOF</pre><p>Now click the Hammerspoon menu bar icon → <strong>Reload Config</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*-BN0Rm0HkQ6I9BWAb3MYZw.png" /></figure><p>A grey toast slides in from the corner of your screen:</p><blockquote>Hello from your operating system.</blockquote><p>That’s it. You just sent a message from your operating system to yourself. Everything else is the same trick — scaled up.</p><h3>#1: A Cursor That Teleports</h3><p>Here’s the one that hooks people. <strong>If you use two monitors</strong>, you know the pain: you Cmd+Tab to a window on the other screen, start typing, and nothing happens — because your cursor is still on the wrong display. You have to hunt for the pointer before your Mac will listen physically.</p><p>This script fixes that forever.</p><p>Drop this in ~/.hammerspoon/cursor-warp.lua:</p><pre>local function warpMouseToFocusedWindow()<br>  local win = hs.window.focusedWindow()<br>  if not win then return end<br>  local screen = win:screen()<br>  if not screen then return end<br><br>  local mouseScreen = hs.mouse.getCurrentScreen()<br>  if mouseScreen and mouseScreen:id() == screen:id() then return end<br><br>  local f = win:frame()<br>  hs.mouse.absolutePosition({ x = f.x + f.w / 2, y = f.y + f.h / 2 })<br>end<br><br>cursorWarpWindowFilter = hs.window.filter.new()<br>cursorWarpWindowFilter:subscribe(<br>  hs.window.filter.windowFocused,<br>  warpMouseToFocusedWindow<br>)  local mouseScreen = hs.mouse.getCurrentScreen()<br>  if mouseScreen and mouseScreen:id() == screen:id() then return end</pre><p>Add this to init.lua and then reload config:</p><pre>require(&quot;cursor-warp&quot;)</pre><p>Cmd+Tabto a window on your other monitor.</p><p>Your cursor just teleported to it.</p><p>The script is smart about it, too — it only jumps when the focused window is on a <em>different</em> screen. During normal single-display work, it stays out of the way completely. But the moment your attention crosses monitors, your hand is already there.</p><h3>#2: Set shortcuts for anything</h3><p>Think about how you switch between apps right now. You either Cmd+Tab and cycle through every open window until you land on the right one — or you swipe through Mission Control hoping to spot it — or you reach for Spotlight and type the name.</p><p>All of that is work. Small work, but constant work. Five, ten, twenty times an hour.</p><p>The problem isn’t launching apps. It’s <em>switching</em> to them when they’re already open, buried somewhere behind three other windows. launchOrFocus solves both in one function: if the app isn&#39;t running, it opens it. If it is running, it brings it to the front. One shortcut. Either situation.</p><p>Drop this in ~/.hammerspoon/app-shortcuts.lua:</p><pre>local appShortcuts = {<br>  v = &quot;Visual Studio Code&quot;,<br>  s = &quot;Slack&quot;,<br>  c = &quot;Google Chrome&quot;,<br>  g = &quot;Ghostty&quot;,<br>}<br><br>for key, appName in pairs(appShortcuts) do<br>  hs.hotkey.bind({ &quot;cmd&quot;, &quot;shift&quot; }, key, function()<br>    hs.application.launchOrFocus(appName)<br>  end)<br>end</pre><p>Add to init.lua:</p><pre>require(&quot;app-shortcuts&quot;)</pre><p>Reload. Now press .</p><p>VS Code is in front of you — no typing, no scanning a list. Cmd+Shift+S is Slack. Cmd+Shift+C is Chrome. One chord, one destination, zero friction.</p><p>The interface is just that Lua table. Add an app, map a letter, reload. That’s it. I bound Cmd+Shift+M to a minimized Spotify window so I can mute music mid-thought without my eyes ever leaving the screen. You’ll find your own version of that within the first hour.</p><h3>#3: Deep-Link Into System Settings</h3><p>Every macOS Settings pane has a secret URL. Hammerspoon can open any of them in one line.</p><pre>-- Open System Settings<br>hs.hotkey.bind({ &quot;cmd&quot;, &quot;shift&quot; }, &quot;,&quot;, function()<br>  hs.application.launchOrFocus(&quot;System Settings&quot;)<br>end)<br><br>-- Open directly to the Trackpad pane<br>hs.hotkey.bind({ &quot;cmd&quot;, &quot;shift&quot; }, &quot;.&quot;, function()<br>  hs.execute(&quot;open &#39;x-apple.systempreferences:com.apple.Trackpad-Settings.extension&#39;&quot;)<br>end)</pre><p><strong>Cmd+Shift+,</strong> opens System Settings. Normal enough.</p><p>But Cmd+Shift+. skips straight to Trackpad — bypassing the entire scrollable grid. The same trick works for Wi-Fi, Display, Sound, Login Items, or any pane you open more than once a week. Anything you navigate to repeatedly deserves its own key.</p><p>This is the kind of thing that sounds minor until you use it. Then it feels like a cheat code.</p><h3>But Wait — You Don’t Even Have to Write It Yourself</h3><p>Everything above has been custom scripts. But Hammerspoon has a whole ecosystem of pre-built plugins called <strong>Spoons</strong> — drop-in Lua modules the community has already written, tested, and shared. You install one, load it in init.lua, configure it with two lines, and you&#39;re done.</p><p>A few worth knowing about:</p><p><a href="https://www.hammerspoon.org/Spoons/ReloadConfiguration.html"><strong>ReloadConfiguration</strong></a> — Watches your ~/.hammerspoon/ folder and auto-reloads whenever you save a file. No more manual Cmd+Alt+R. Just save and it&#39;s live.</p><p><a href="https://www.hammerspoon.org/Spoons/Seal.html"><strong>Seal</strong></a> — A fully customizable launcher. Think Spotlight, but you define exactly what it can do: open URLs, run scripts, calculate, look things up. Keyboard-driven, no mouse needed.</p><p><a href="https://www.hammerspoon.org/Spoons/Caffeine.html"><strong>Caffeine</strong></a> — Keeps your Mac from sleeping on demand. Same as the app, but now it’s a hotkey you set, not another menu bar icon to click.</p><p><a href="https://www.hammerspoon.org/Spoons/MiroWindowsManager.html"><strong>MiroWindowsManager</strong></a> — Snap windows to halves, thirds, quarters, or custom grid positions with keyboard shortcuts. Like Magnet or Rectangle, except free and configurable down to the pixel.</p><p><a href="https://www.hammerspoon.org/Spoons/ClipboardTool.html"><strong>ClipboardTool</strong></a> — A clipboard history manager. Everything you’ve copied, accessible by hotkey. Searchable. No app purchase required.</p><p><a href="https://www.hammerspoon.org/Spoons/HSKeybindings.html"><strong>HSKeybindings</strong></a> — Shows a cheat sheet of all your active Hammerspoon hotkeys. Useful once your config grows and you forget what you’ve bound to what.</p><p>Installing any Spoon is the same three steps:</p><pre>-- 1. Load the Spoon<br>hs.loadSpoon(&quot;ReloadConfiguration&quot;)<br><br>-- 2. Configure it (each Spoon has its own options)<br>spoon.ReloadConfiguration.watchPaths = { os.getenv(&quot;HOME&quot;) .. &quot;/.hammerspoon&quot; }<br><br>-- 3. Start it<br>spoon.ReloadConfiguration:start()</pre><p>The full list lives at <a href="https://www.hammerspoon.org/Spoons/">hammerspoon.org/Spoons</a> — there are over 60 of them.</p><h3>And Beyond Spoons — the Built-in APIs Go Deep</h3><p>The three toys in this article barely scratch what Hammerspoon exposes natively. A few things people build that might surprise you:</p><ul><li><strong>Wi-Fi-based automation</strong> — run a script when you connect to your home network (mount a drive, launch apps, change your wallpaper)</li><li><strong>USB triggers</strong> — do something when a specific device is plugged in or unplugged</li><li><strong>Time-based scripts</strong> — mute notifications after 9 pm, dim your display at sunset using your actual location</li><li><strong>Battery alerts</strong> — custom warnings when your battery hits a threshold, not Apple’s generic one</li><li><strong>URL routing</strong> — intercept every link click on your Mac and decide which browser or profile opens it</li><li><strong>Drawing on screen</strong> — overlay grids, guides, or custom UI elements directly on your display</li><li><strong>Audio device switching</strong> — swap input/output devices with a hotkey when you plug in headphones</li></ul><p>None of these requires external libraries. It’s all hs.wifi, hs.usb, hs.timer, hs.battery, hs.urlevent, hs.canvas, hs.audiodevice — built right in, fully documented at <a href="https://www.hammerspoon.org/docs/">hammerspoon.org/docs</a>.</p><p>We started with a cursor that teleports. That’s three toys and a taste. But the honest truth is: if something on your Mac happens, Hammerspoon can probably react to it. And if something on your Mac repeats, Hammerspoon can probably automate it.</p><p>The possibilities aren’t endless in a vague, marketing-speak way. They’re endless in the sense that the API surface is genuinely massive — and you’re only limited by what’s annoying enough to fix.</p><h3>Your First Five Minutes</h3><ol><li>brew install --cask hammerspoon</li><li>Paste the cursor-warp script into ~/.hammerspoon/cursor-warp.lua</li><li>Add require(&quot;cursor-warp&quot;) to init.lua</li><li>Reload</li><li>Cmd+Tab to your other monitor and watch your cursor follow</li></ol><p>The rest — the app shortcuts, the Settings deep-links, the weird personal tweaks — comes naturally once you feel how responsive the toy is.</p><p>The day you stop accepting your computer’s defaults is the day it actually becomes yours.</p><p><em>If your cursor just teleported, give this a clap. If you wrote your own script in the next 24 hours, drop it in the comments — I want to steal it.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96dc5447163f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VSCode Features You Probably Missed (Even After Years of Use)]]></title>
            <link>https://medium.com/@me4saurabh4u/vscode-beyond-the-basics-advanced-shortcuts-features-worth-learning-78c1c917d02f?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/78c1c917d02f</guid>
            <category><![CDATA[saurabh-raj]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Sat, 21 Mar 2026 16:04:48 GMT</pubDate>
            <atom:updated>2026-03-22T03:51:16.302Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uZ9qIosecAy_rC0SEAjURA.png" /></figure><p>This article skips the obvious stuff. No Ctrl+C, no &quot;use the Command Palette,&quot; no multi-cursor introduction. If you&#39;ve been using VSCode for a while, you already know those.</p><p>Instead, this covers the features that tend to come up months or years into using the editor — the search modifiers most people ignore, the file history that works without Git, and the Git workflows that don’t require a terminal. Practical stuff that saves real time once you know it’s there.</p><p>All shortcuts listed as <strong>Windows/Linux</strong> first, <strong>Mac</strong> in parentheses.</p><h3>1. Search Is More Capable Than Most People Realize</h3><p>Everyone knows Ctrl+F for find and Ctrl+Shift+F for project-wide search. But the search bar has a row of small toggle icons next to the input field that most people never touch. They&#39;re worth learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rYm3wpwgiI0w6l6UZXAcDQ.png" /></figure><h4>1.1 Match Case — Alt+C (Cmd+Option+C)</h4><p>Toggling this on means searching for User won&#39;t pick up user or USER(exact case-matching). Useful when you&#39;re looking for a specific class name in a file full of similarly named variables and don&#39;t want 40 irrelevant matches cluttering the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3lSM376FiRxB6zujBBUq0w.png" /></figure><h4>1.2 Match Whole Word — Alt+W (Cmd+Option+W)</h4><p>Without this, searching for the word app also matches application, appendChild, appSettings, and everything else that contains those three letters. Whole word matching respects word boundaries, so you only get exact matches. Oftentimes, it is useful in combination with Match case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QMP76Nx9vmXR9rPZy9hmlA.png" /></figure><h4>1.3 Use Regex — Alt+R (Cmd+Option+R)</h4><p>Regular expressions let you search for patterns instead of fixed text. Finding every console.log regardless of what&#39;s inside the parentheses: console\.log\(.*\). Finding hex color codes: #[0-9a-fA-F]{6}. There&#39;s a learning curve to regex, but even basic patterns make search significantly more useful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E12ltR6at70tPWn8ZfPuvw.png" /></figure><h4>1.4 Find in Selection — Alt+L (Cmd+Option+L)</h4><p>When you have the find dialog open (Ctrl+F), there&#39;s a small icon that restricts search and replace to only the currently selected text. This is useful when you want to rename a variable inside one function without affecting the same name used elsewhere in the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-klrvGsNCkPD4DNR6SX75Q.png" /></figure><h4>1.5 Open Search Results in a Full Editor Tab</h4><p>After running a project-wide search (Ctrl/Cmd+Shift+F), click on <strong>&quot;Open in Editor.&quot;</strong> This moves your results out of the narrow sidebar panel and into a proper editor tab. You can scroll through them more easily, copy relevant sections, and view them side-by-side with source files.</p><p>This is particularly helpful when reviewing a large codebase or auditing usage of a specific function across many files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vAIJ-T_ySPV7cn7QD4nCLg.png" /></figure><h3>2. File History</h3><p>Here’s a common situation: you’ve been editing a file for an hour without committing. Something breaks, and you want to see what the file looked like 20 minutes ago.</p><p>VSCode has a built-in feature for this that most people don’t know about.</p><h4>2.1 Timeline View</h4><p>At the bottom of the Explorer sidebar, there’s a collapsible panel called <strong>TIMELINE</strong>. With a file open, expand it, and you’ll see a chronological list of changes — both Git commits and <strong>local saves</strong>. Every time you save a file, VSCode creates a local history entry. Even projects without Git get this.</p><p>Click any entry to open a side-by-side diff showing what changed between that version and the current one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nHTCd04JOoDaCfCrlVNAzA.png" /></figure><p><strong>Restoring Previous Versions</strong></p><p>Right-click any Timeline entry → <strong>“Restore Contents”</strong> to revert the file to that state.</p><p>For deleted files: open the Command Palette → <strong>“Local History: Find Entry to Restore.”</strong> This lists all files you’ve worked on, including deleted ones. You can select and restore them.</p><p>Worth noting: the Timeline panel can be filtered to show only Git commits, only local changes, or both. Use the filter icon at the top of the panel to control this.</p><h4>2.2 Git Features You Might Not Be Using</h4><p>The built-in Source Control panel (Ctrl/Cmd+Shift+G) covers the basics. But there are a few deeper features worth knowing about.</p><h4>2.2.1 Stage Individual Lines</h4><p>When you click a changed file in the Source Control panel, VSCode opens a diff view. Most people stage the entire file. But you can select specific lines in the diff, right-click, and choose <strong>“Stage Selected Ranges.”</strong> This lets you break your work into smaller, more focused commits without using the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*LqZEPcOhJ7erYBzNMjkYHA.png" /></figure><h4>2.2.2 Compare Active File with Clipboard</h4><p>Command Palette → <strong>“Compare Active File with Clipboard.”</strong> This takes whatever text is in your clipboard and diffs it against the file you’re currently editing. Handy when someone sends you a code snippet and you want to see exactly how it differs from your version.</p><h4>2.2.3 Compare Two Files Directly</h4><p>Select two files in the Explorer sidebar (Ctrl-click or Cmd-click both), right-click → <strong>“Compare Selected.”</strong> This opens a side-by-side diff with no Git involved — just a direct comparison of two files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kGq5uMXmev6hfUFpnwWMyw.png" /></figure><h3>3. GitLens — What It Actually Does Beyond Blame</h3><p>GitLens is one of the most installed VSCode extensions, and most people use about 10% of it. Here’s the rest.</p><h4>3.1 Inline Blame Annotations</h4><p>After installing, every line shows a subtle gray annotation at the end — the author and timestamp of the last change. Hover over it for the full commit message, the specific changes made, and shortcuts to view the complete diff or open the commit on GitHub/GitLab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9DpJggGXCWSHibfgQuBogA.png" /></figure><h4>3.2 File History and Line History</h4><p>Right-click a file → <strong>GitLens: Open File History</strong> to see every commit that touched it, with diffs. But you can go more granular: select a specific line (or lines), right-click → <strong>GitLens: Open Line History</strong>. This shows the complete history of just that line across every commit. When you need to understand why a particular value was changed months ago, this is the most direct path to an answer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sd-SsByYXQtNX4_xSm82Ww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCPK1Q1S4eByFVJ6Mkkq1A.png" /></figure><h4>3.3 Visual Stash Management</h4><p>GitLens adds a stash manager to the sidebar where you can create, apply, pop, and delete stashes visually. Each entry shows a description and timestamp, which helps when you’ve accumulated multiple stashes and can’t remember which is which.</p><p>It also adds a stash button to the Source Control panel, making it quicker and more intuitive to manage stashes without leaving your workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CRpjIsfTgcF6JXx38snC7Q.png" /></figure><h4>3.4 Branches and Commits</h4><p>GitLens lets you view and manage your branches and commits visually within the Source Control tab. You can create pull requests directly, publish branches to the remote, and even commit or undo (uncommit) changes — all from one place without switching context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQkusd_ap5ilrVqLCxgLXQ.png" /></figure><h3>4. Command Palette Commands Worth Remembering</h3><p>These aren’t keyboard shortcuts — they’re commands you type into the Command Palette (Ctrl+Shift+P). Knowing they exist matters more than memorizing them.</p><h4>4.1 Reload Window</h4><p><strong>“Developer: Reload Window”</strong></p><p>Restarts the editor window without closing VSCode. When IntelliSense stops working, an extension isn’t loading, or something just feels off, this is the first thing to try. Fixes the issue more often than not without stopping your server.</p><h4>4.2 Restart TS Server</h4><p><strong>“TypeScript: Restart TS Server”</strong></p><p>If you work with TypeScript (or JavaScript with type checking), you’ll encounter moments where IntelliSense shows incorrect errors, autocomplete goes stale, or red squiggles appear on valid code. This restarts just the TypeScript language server — faster and more targeted than reloading the entire window. This is often faster than doing “Reload Window,” and fixes IntelliSense nearly all the times.</p><h4>4.3 Format Document Without Saving</h4><p>Shift+Alt+F (Shift+Option+F)</p><p>Many people rely on “format on save” and forget that this exists independently. It’s useful when you want to clean up indentation mid-edit without saving, or when you want to format a text you copied from the web without saving it. It can also be triggered through the command panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dsoWZF1WEIYdYIMjaMz-Lg.png" /></figure><h3>5. A Few More Worth Knowing</h3><p><strong>Sticky Scroll</strong> — In recent VSCode versions, as you scroll through deeply nested code, parent scopes (function names, class declarations, if/for blocks) stick to the top of the editor so you always know where you are. If it’s not enabled: editor.stickyScroll.enabled: true.</p><p><strong>Toggle Word Wrap</strong> — Alt+Z (Option+Z). Long lines disappearing off-screen? This wraps them visually. Useful for markdown, log files, or working on a smaller display.</p><p><strong>Screencast Mode</strong> — Command Palette → <strong>“Toggle Screencast Mode.”</strong> Displays every keystroke as an overlay on screen. Useful during pair programming sessions, presentations, or when recording tutorials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2g4iCObCH_dHa_x7BfCAUg.png" /></figure><p><strong>Close All Open Editors</strong> — Ctrl+K Ctrl+W (Cmd+K Cmd+W). Closes every open tab at once when you need a clean slate. Ctrl+K W (without the second Ctrl) closes only the current editor group.</p><p>Most of these features have been in VSCode for a while. They just don’t get much attention because they’re not the kind of thing you stumble into by accident — you either see someone use them or you read about them somewhere. Hopefully, this was that somewhere.</p><p>If you found this useful, give it a 👏, drop a comment with your favorite shortcut, or share it with someone who still clicks everything manually 🙂</p><p>Happy coding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78c1c917d02f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laptop Specs Explained: What You Actually Need to Know Before Buying]]></title>
            <link>https://medium.com/@me4saurabh4u/laptop-specs-explained-what-you-actually-need-to-know-before-buying-1ece2c6886c4?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ece2c6886c4</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[computers]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Sun, 15 Mar 2026 17:31:44 GMT</pubDate>
            <atom:updated>2026-03-15T17:31:44.461Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*txsDOGl3tuz0SvrVzycmUA.png" /></figure><p>You’re at a store. Or maybe you’re on Amazon at 1 AM, buying a laptop with the same frantic energy people use to adopt puppies. A sales rep (or an Amazon listing) fires a list of specs at you:</p><blockquote>“Intel Core i7–13700H, 32GB DDR5 RAM, 1TB NVMe SSD, RTX 4060 GPU, 15.6-inch IPS display at 144Hz…”</blockquote><p>You nod. You say “nice.” You have absolutely no idea what any of that means.</p><p>Don’t worry. By the end of this guide, you will. And you’ll have fun getting there.</p><p>Let’s build a computer — in our heads — from the ground up.</p><h3>Table of Contents</h3><p><strong>1. The CPU: Your Computer’s Brain 🧠</strong></p><ul><li>1.1 Clock Speed: How Fast the Brain Thinks</li><li>1.1.1 Base Clock vs Boost (Max) Clock</li><li>1.2 Cores and Threads: How Many Brains Does the Brain Have?</li><li>1.2.1 Cores</li><li>1.2.2 Threads</li><li>1.3 CPU Generation / Architecture</li></ul><p><strong>2. GPU (Graphics Processing Unit) 🖥️</strong></p><ul><li>2.1 Integrated GPU (iGPU)</li><li>2.2 Dedicated GPU (dGPU)</li><li>2.3 Reading a GPU Name</li><li>2.4 VRAM (Video RAM)</li></ul><p><strong>3. RAM (Random Access Memory) 💾</strong></p><ul><li>3.1 How Much RAM Do You Need?</li><li>3.2 RAM Speed (MHz)</li><li>3.3 DDR Generations</li><li>3.4 Single vs Dual Channel</li><li>3.5 Upgradeable vs Soldered RAM</li></ul><p><strong>4. Storage 🗄️</strong></p><ul><li>4.1 HDD vs SSD</li><li>4.2 SSD Types: SATA vs NVMe</li><li>4.3 NVMe Generations (Gen 3 vs Gen 4)</li><li>4.4 What is M.2?</li><li>4.5 How Much Storage Do You Need?</li></ul><p><strong>5. Display 🖥️</strong></p><ul><li>5.1 Resolution</li><li>5.2 Panel Types (TN, IPS, VA, OLED)</li><li>5.3 Refresh Rate</li><li>5.4 Brightness &amp; Color Accuracy</li><li>5.5 Aspect Ratio</li></ul><p><strong>6. Conclusion</strong></p><h3>1. The CPU: Your Computer’s Brain 🧠</h3><p>The <strong>CPU</strong> — Central Processing Unit — is the brain of your computer. It handles calculations, runs your programs, and processes instructions. Without it, your computer is just an expensive paperweight with a glowing logo.</p><h4>1.1 Clock Speed: How Fast the Brain Thinks</h4><p><strong>Clock speed</strong> is the rate at which a CPU’s internal <a href="https://www.youtube.com/watch?v=PVNAPWUxZ0g">clock</a> generates cycles. It is measured in <strong>hertz (Hz)</strong>, typically <strong>gigahertz (GHz)</strong> for modern processors.</p><p>One <strong>clock cycle</strong> represents a basic unit of time during which the processor can perform operations such as <strong>fetching instructions</strong>, <strong>decoding them</strong>, or <strong>executing calculations</strong>.</p><p><strong>Example: </strong>A <strong>3.5 GHz processor</strong> runs at <strong>3.5 billion clock cycles per second</strong>.</p><h4>Understanding Clock Speed Ranges</h4><ul><li><strong>Below 2.0 GHz</strong> → Suitable for very basic tasks like web browsing, email, and document editing, but may struggle with demanding applications.</li><li><strong>2.0–3.5 GHz</strong> → Comfortable for everyday computing such as multitasking, office work, and typical applications.</li><li><strong>3.5 GHz and above</strong> → Strong performance, well-suited for gaming, software development, and creative workloads.</li><li><strong>5.0 GHz and above</strong> → Very high clock speeds typically found in high-end processors designed for intensive workloads and maximum responsiveness.</li></ul><p>But here’s the twist: <strong>higher GHz doesn’t always mean faster</strong>. A newer processor at 3.0 GHz can easily outperform an older one at 4.0 GHz. It’s not just about speed — it’s about <em>efficiency</em>.</p><h4>1.1.1 Base Clock vs Boost (Max) Clock</h4><p><strong>Base Clock</strong></p><ul><li>The guaranteed minimum speed at which the CPU will run under normal load.</li><li>Example: <strong>3.2 GHz base</strong></li></ul><p><strong>Boost / Turbo Clock</strong></p><ul><li>The maximum speed the CPU can temporarily reach when extra performance is needed.</li><li>Happens automatically if the temperature and power allow it.</li><li>Example: <strong>up to 5.1 GHz boost</strong></li></ul><pre>Base clock: 3.2 GHz<br>Max boost clock: 5.1 GHz</pre><h4>1.2 Cores and Threads: How Many Brains Does the Brain Have?</h4><p>Modern CPUs are built with <strong>multiple cores</strong>, not just a single processing unit. Each core is like a small processor capable of executing instructions on its own. This allows a CPU to work on several tasks at the same time.</p><h4>1.2.1 Cores</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*viv8uFMb_q54aL_s57CUUQ.png" /></figure><p>A <strong>core</strong> is a physical processing unit built directly into the CPU hardware. Each core operates independently, possessing its own execution units and cache, which allows a multi-core processor to run multiple tasks in parallel.</p><p>For example:</p><ul><li><strong>4 cores (Quad-core)</strong>→ up to <strong>4 instruction streams</strong> can run at the same time</li><li><strong>8 cores</strong> → up to <strong>8 instruction streams</strong> can run simultaneously</li></ul><p>Consider a typical multitasking scenario: streaming music, browsing the web, writing code, and downloading a file. On a 4-core CPU, the operating system can assign each of these tasks to a dedicated physical core, processing them in parallel rather than forcing them to wait in a queue.</p><h4>1.2.2 Threads</h4><p>A <strong>thread</strong> is a <strong>separate instruction stream</strong> that a core can run. Think of it like a conveyor belt of instructions being sent to the core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5KmLGzPgIpFeE8vKrE2cbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5CW849cxFXiAETUgvWk4yg.png" /></figure><p>Refer to <a href="https://www.youtube.com/watch?v=hwTYDQ0zZOw">this</a> video for an in-depth explanation.</p><h4>1.3 CPU Generation / Architecture</h4><p>Clock speed (GHz) isn’t everything — <strong>generation matters more.</strong> Here’s how to actually read a CPU name:</p><p><strong>Intel:</strong> Core i3 / i5 / i7 / i9 <strong>AMD Ryzen:</strong> Ryzen 3 / 5 / 7 / 9</p><p><strong>The tier (i3, i5, i7) tells you the power class</strong> — more cores, more cache, more multitasking ability as you go up. Think of it like car trims — Base, Mid, and Top.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFgZ67c4TWCLtDGkKZpGSA.png" /></figure><p>The number after the name (i5<strong>–13</strong>600K or Ryzen 5 <strong>7</strong>600) tells you the generation. A higher generation = newer architecture = more efficient.</p><p>An <strong>i5 from 13th gen can beat an i7 from 10th gen</strong> — because the newer architecture does more work per clock cycle. Same with AMD — a <strong>Ryzen 5 7600 can outperform a Ryzen 7 4700</strong> in many tasks.</p><p>So i7 or Ryzen 7 doesn’t automatically mean better. An older i7 can be slower, hotter, and less efficient than a newer i5.</p><p><strong>How to read the number:</strong></p><ul><li>Intel i5<strong>–13</strong>600K → 13th generation ✅</li><li>Intel i7<strong>–10</strong>700 → 10th generation ⚠️ older</li><li>Ryzen 5 <strong>7</strong>600 → 7000 series ✅</li><li>Ryzen 7 <strong>4</strong>700 → 4000 series ⚠️ older</li></ul><p><strong>The Letter at the End — What Does it Mean?</strong></p><p>That letter suffix tells you what the chip is optimised for. Intel and AMD both use <strong>U</strong> for ultra low power (thin laptops, long battery), <strong>H</strong> for high performance (gaming, heavy workloads), and <strong>HX</strong> for extreme desktop-class power. Intel also has <strong>P,</strong> which sits between U and H — a balanced option for everyday productivity. For example, an <strong>i5–1335U</strong> is built for all-day battery life in a slim laptop, while an <strong>i7–13700H</strong> is built for raw performance in a gaming or creator laptop — even though the i5 has a higher U-series efficiency, the i7-H will outperform it under heavy load. Simple rule: <strong>U = battery, H = power.</strong> Pick based on what matters more to you.</p><h3><strong>2. GPU (Graphics Processing Unit) </strong>🖥</h3><p>While the CPU handles general tasks, the <strong>GPU is responsible for everything visual</strong> — rendering images, videos, and graphics on your screen. The more demanding the visual task, the more your GPU matters.</p><p>There are two types of GPUs you’ll find in laptops:</p><h4>2.1 Integrated GPU (iGPU)</h4><p>Built directly into the CPU — no separate chip. Intel calls theirs <strong>Intel Iris Xe</strong>, and AMD has <strong>Radeon Graphics</strong> built into their Ryzen chips.</p><p>Since it shares your RAM as its memory, more RAM = slightly better iGPU performance.</p><p><strong>Good for:</strong> Browsing, videos, documents, and light photo editing.</p><p><strong>Struggles with:</strong> Gaming, 3D work, video editing</p><p>AMD’s iGPU is generally stronger than Intel’s at the same price — Ryzen’s Radeon graphics can even handle light gaming.</p><h4>2.2 Dedicated GPU (dGPU)</h4><p>A separate chip with its <strong>own memory (VRAM)</strong> — doesn’t touch your RAM. Made by <strong>NVIDIA (GeForce GTX/RTX)</strong> or <strong>AMD (Radeon RX)</strong>.</p><p><strong>Good for:</strong> Gaming, video editing, 3D rendering, and AI work.</p><p><strong>Key spec to check:</strong> VRAM — 4GB is minimum, 6–8GB is comfortable, 12GB+ for heavy work.</p><p><strong>Bottom line: </strong>Casual user or student? iGPU is enough. Gamer or creator? You need a dedicated GPU.</p><h4>2.3 Reading a GPU Name — RTX 4060</h4><p>Just like CPUs, GPU names follow a pattern. Let’s decode <strong>RTX 4060:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_wLdPJc3VqVUZcWQZppBkg.png" /></figure><p><strong>One more thing — Laptop vs Desktop GPU:</strong></p><p>The same GPU name performs differently in a laptop vs desktop. An <strong>RTX 4060 laptop GPU</strong> is weaker than an <strong>RTX 4060 desktop GPU</strong> — because laptops limit power to manage heat and battery.</p><p>Always check if it says <strong>“Max-Q”</strong> or <strong>“Laptop GPU”</strong> — these are power-limited, quieter versions.</p><p>Same logic applies — RX <strong>7</strong>600 is newer than RX <strong>6</strong>600, and the tier goes 500 → 600 → 700 → 900.</p><h4>2.4 VRAM (Video RAM)</h4><p>VRAM is the GPU’s own dedicated memory — it stores textures, frames, and visual data so the GPU can access it instantly. More VRAM means the GPU can handle higher resolutions, more detailed textures, and heavier workloads without stuttering. For everyday use and light gaming, <strong>4GB</strong> is fine. For 1080p gaming and light editing, go for <strong>6–8GB</strong>. For 4K gaming, heavy video editing, or AI work, <strong>12GB+</strong> is recommended. One important thing — VRAM cannot be upgraded later, so don’t cheap out on it while buying.</p><h3>3. RAM (Random-Access-Memory) 💾</h3><p>RAM is your laptop’s short-term memory — it holds everything that’s currently running. Your browser tabs, open apps, background processes — all of it sits in RAM. The more RAM you have, the more your laptop can handle at once without slowing down. Unlike storage, RAM doesn’t save anything permanently — it clears every time you shut down.</p><h4>3.1 How Much RAM Do You Need?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SN73iqBN0FWRY0PSE-jA-Q.png" /></figure><p><strong>Bottom line:</strong> 16GB is the recommended minimum for most people today. 8GB will feel limiting quickly.</p><h4>3.2 RAM Speed (MHz)</h4><p>RAM speed tells you how fast data moves in and out of memory. It’s measured in MHz — like 3200MHz, 4800MHz, 5600MHz.</p><p>Faster RAM = snappier performance, especially for AMD Ryzen chips, which are more sensitive to RAM speed than Intel. However, the difference is noticeable mainly in gaming and heavy workloads — for everyday use, it matters less than capacity.</p><p><strong>Don’t prioritise speed over capacity</strong> — 16GB at 3200MHz beats 8GB at 5600MHz every time.</p><h4>3.3 DDR Generations</h4><p>DDR stands for <strong>Double Data Rate</strong>. It refers to a family of RAM technologies used in computers.</p><p>Earlier memory called <strong>SDR SDRAM (Single Data Rate SDRAM)</strong> transferred data once per clock cycle.</p><p><strong>DDR SDRAM (Double Data Rate SDRAM)</strong> transfers data twice per clock cycle — on both the rising and falling edges of the clock.</p><p>Because of this, DDR memory can <strong>move twice the data without increasing the clock speed</strong>.</p><p>Over time, newer generations of DDR have been released:</p><p><strong>DDR → DDR2 → DDR3 → DDR4 → DDR5</strong></p><p><strong>DDR5</strong> is the newest mainstream generation and offers significantly higher bandwidth than <strong>DDR4</strong>. However, <strong>DDR4 is still perfectly capable for most everyday tasks, and many laptops still use it.</strong></p><p>So, before upgrading RAM, always check <strong>which DDR generation your system supports.</strong></p><h4>3.4 Single vs Dual Channel</h4><p>This one is often overlooked but makes a real difference.</p><ul><li><strong>Single channel</strong> — one RAM stick working alone</li><li><strong>Dual channel</strong> — two RAM sticks working together, like two lanes on a highway</li></ul><p>Dual channel can improve performance by <strong>10–30%</strong> in gaming and heavy tasks — for free, just by having two sticks instead of one.</p><p><strong>Practical tip:</strong> 2×8GB is noticeably better than 1×16GB, even though the total is the same. When buying, check if the laptop has two RAM slots and if both are filled.</p><h4>3.5 Upgradeable or Soldered?</h4><p>This is critical. In many modern laptops — especially thin and light ones — RAM is <strong>soldered directly onto the motherboard.</strong> This means you cannot upgrade it later.</p><ul><li><strong>Soldered RAM</strong> — fixed forever, choose wisely at purchase</li><li><strong>Upgradeable RAM</strong> — can add or replace sticks later</li></ul><p>Always check the spec sheet or reviews before buying. If RAM is soldered, go higher than you think you need.</p><p><strong>Bottom line:</strong> Get 16GB minimum, DDR5 if possible, dual channel if available, and check if it’s upgradeable. RAM is one of the easiest things to get wrong on paper, but feel immediately in daily use.</p><h3>4. Storage 🗄️</h3><p>Storage is your laptop’s long-term memory — it holds everything permanently: your OS, apps, files, photos, and videos. Unlike RAM, it doesn’t clear when you shut down. Two things matter most when looking at storage: <strong>type</strong> and <strong>capacity.</strong></p><h4>4.1 HDD vs SSD</h4><p>There are two main types of storage:</p><p><strong>HDD (Hard Disk Drive)</strong> — old technology, uses spinning magnetic disks to read/write data. Slow, heavier, and fragile, but cheap and available in large capacities.</p><p><strong>SSD (Solid State Drive)</strong> — no moving parts, uses flash memory. Much faster, lighter, and more durable. The standard in modern laptops.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uBJgDQhEnPwskEc83g1DUA.png" /></figure><p><strong>Bottom line:</strong> Never buy a laptop with only an HDD in 2025. If a laptop has an HDD, it will feel sluggish from day one — slow boot, slow app launch, slow everything.</p><h4>4.2 SSD Types — SATA vs NVMe</h4><p>Not all SSDs are equal. There are two main types:</p><p><strong>SATA SSD</strong> — older interface, maxes out at around 500–550MB/s. Still much faster than HDD but the slower of the two SSD types.</p><p><strong>NVMe SSD</strong> — uses the PCIe lane, significantly faster. Speeds range from 2000MB/s to 7000MB/s depending on generation.</p><p>For everyday use the difference isn’t dramatic, but for transferring large files, booting, and loading heavy apps — NVMe is noticeably faster.</p><h4>4.3 NVMe Generations — Gen 3 vs Gen 4</h4><p>Just like CPUs and GPUs, NVMe SSDs have generations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-19SQMAJIwuGAAn1eD1X5Q.png" /></figure><p>Gen 4 is twice as fast on paper, but for most users — browsing, documents, even light editing — Gen 3 is perfectly fine. Gen 4 matters more for video editing and large file transfers.</p><h4>4.4 What is M.2?</h4><p>M.2 is simply the <strong>physical form factor</strong> — the shape and slot of the SSD, not the speed. An M.2 slot can hold either a SATA or NVMe SSD. So when someone says “M.2 SSD” it doesn’t tell you the speed — always check if it’s <strong>M.2 SATA</strong> or <strong>M.2 NVMe.</strong></p><h4>4.5 How Much Storage Do You Need?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*elblc3uTzQC7CVquETdR7A.png" /></figure><p><strong>Bottom line:</strong> Always go NVMe SSD, 512GB minimum, 1TB recommended. Check if it’s upgradeable and if a second slot is available — storage is one spec you’ll regret skimping on.</p><h3>5. Display</h3><p>The display is what you stare at every single day — yet most people only check the screen size and move on. A bad display causes eye strain, washed-out colours, and regret. Here’s everything you need to check:</p><h4>5.1 Resolution</h4><p>Resolution tells you how many pixels are packed into the screen. More pixels = sharper, cleaner image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D3_AconcnTOwrpIBlh4P3g.png" /></figure><p><strong>Bottom line:</strong> FHD is the sweet spot for most users. QHD is worth it on larger screens. 4K on a laptop drains battery fast, and the difference over QHD is barely visible at normal viewing distance.</p><h4>5.2 Panel Types</h4><p>The panel type determines colour quality, viewing angles, contrast, and response time — this is arguably the most important display spec.</p><p><strong>TN (Twisted Nematic)</strong></p><ul><li>Fastest response time, cheapest to make</li><li>Washed out colours, poor viewing angles</li><li>Found in old budget laptops</li><li><strong>Verdict: Avoid</strong></li></ul><p><strong>IPS (In-Plane Switching)</strong></p><ul><li>Great colour accuracy, wide viewing angles</li><li>The standard in most good laptops today</li><li>Slight backlight bleed, but generally excellent</li><li><strong>Verdict: Recommended for most users</strong></li></ul><p><strong>VA (Vertical Alignment)</strong></p><ul><li>Better contrast than IPS, deeper blacks</li><li>Slower response time; rare in laptops</li><li><strong>Verdict: Decent but uncommon</strong></li></ul><p><strong>OLED</strong></p><ul><li>Perfect blacks, stunning contrast, vibrant colours</li><li>Each pixel lights individually — no backlight bleed</li><li>Risk of burn-in over time, slightly more expensive</li><li><strong>Verdict: Best display quality, worth it for creators and media consumption</strong></li></ul><h4>5.3 Refresh Rate</h4><p>Refresh rate is how many times per second the screen updates — measured in Hz. Higher Hz = smoother motion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ykyQ6fCBIZICigkIWt7xUg.png" /></figure><p><strong>Important:</strong> A higher refresh rate drains battery faster. If you mostly work on documents and browse, 60Hz is fine. If you game or just want a smoother experience, go 120Hz minimum.</p><h4>5.4 Brightness &amp; Color Accuracy</h4><p><strong>Brightness</strong> is measured in <strong>nits.</strong> More nits = better visibility in bright environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2vscumDfKQ9wR_DIQ-nHcQ.png" /></figure><p><strong>Colour Accuracy</strong> is measured by <strong>colour gamut coverage:</strong></p><ul><li><strong>sRGB</strong> — standard colour space, 100% sRGB is good for everyday use and basic editing</li><li><strong>DCI-P3</strong> — wider colour space used in professional content creation. 90%+ P3 is excellent for photo and video editors</li></ul><p>For students and everyday users, 100% sRGB is perfectly fine. For creators, look for high DCI-P3 coverage.</p><h4>5.5 Aspect Ratio</h4><p>Aspect ratio is the width-to-height proportion of your screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cBPTuhH9GCKwb6geIkG0AQ.png" /></figure><p><strong>16:10 is increasingly popular</strong> in modern laptops — that extra vertical space makes a real difference when reading, coding, or working with documents. Worth prioritising over 16:9 if you have the choice.</p><p><strong>Bottom line:</strong> FHD minimum, IPS at least, OLED if budget allows. Aim for 300+ nits, 120Hz if you value smoothness, and a 16:10 ratio for productivity. Don’t ignore the display — you’ll look at it every day.</p><h3>Conclusion</h3><p>Hardware specs can look overwhelming at first, but once you know what each number means, the choice becomes much clearer. This guide covered everything from CPU generations to display panels — not to overwhelm you, but to make sure you get exactly what you pay for.</p><p>Use this as a reference every time you compare laptops. Your future self will thank you.</p><p><em>Found this helpful? Share it with someone about to buy a laptop. Got questions or suggestions? Drop them in the comments below.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ece2c6886c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fetch vs Axios: A Professional Developer’s Guide to HTTP Clients in JavaScript]]></title>
            <link>https://medium.com/@me4saurabh4u/fetch-vs-axios-a-professional-developers-guide-to-http-clients-in-javascript-83bfb3e37ecf?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/83bfb3e37ecf</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Sat, 07 Mar 2026 12:09:06 GMT</pubDate>
            <atom:updated>2026-03-07T12:09:06.652Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N1ItCBHJc8LYO2OmKpoMgQ.png" /><figcaption>Fetch vs Axios: A Professional Developer’s Guide to HTTP clients in JavaScript</figcaption></figure><p>Modern web applications rely heavily on HTTP communication. Whether you’re building a React dashboard, a Node.js backend, or a vanilla JavaScript app, choosing the right HTTP client affects your code quality, maintainability, and developer experience.</p><p>This guide examines two leading solutions: the native <strong>Fetch API</strong> and the <strong>Axios library</strong>. We’ll explore their architectures, compare real-world usage patterns, and provide clear recommendations based on application requirements.</p><h3>Architecture Overview</h3><h4>1. The Evolution: From XMLHttpRequest to Fetch</h4><p>Before diving into the comparison, let’s understand where these tools came from.</p><p><strong>XMLHttpRequest (XHR)</strong> — The Old Way:</p><p>For nearly two decades, XMLHttpRequest was the only way to make HTTP requests in JavaScript:</p><pre>// The old XMLHttpRequest way - verbose and callback-heavy<br>var xhr = new XMLHttpRequest();<br>xhr.onreadystatechange = function() {<br>  if (xhr.readyState === 4) {<br>    if (xhr.status === 200) {<br>      var data = JSON.parse(xhr.responseText);<br>      console.log(data);<br>    } else {<br>      console.error(&#39;Error:&#39;, xhr.status);<br>    }<br>  }<br>};<br>xhr.open(&#39;GET&#39;, &#39;/api/users&#39;);<br>xhr.send();</pre><p><strong>Problems with XHR:</strong></p><ul><li>Callback-based (no Promises, leading to “callback hell”)</li><li>Verbose syntax for simple tasks</li><li>Difficult error handling</li><li>Not intuitive for modern JavaScript</li></ul><h4>2. The Fetch API: Browser-Native HTTP</h4><p>Fetch is a standardized web API built into modern browsers, designed as a modern replacement for XMLHttpRequest.</p><p><strong>What makes Fetch “modern”? Let’s break it down with examples:</strong></p><p><strong>2.1 Promise-based asynchronous operations</strong></p><p>You can use .then() and async/await instead of callbacks.</p><pre>// Fetch uses Promises - much cleaner<br>fetch(&#39;/api/users&#39;)<br>  .then(response =&gt; response.json())<br>  .then(data =&gt; console.log(data));<br><br>// Or with async/await<br>async function getUsers() {<br>  const response = await fetch(&#39;/api/users&#39;);<br>  const data = await response.json();<br>  console.log(data);<br>}</pre><p><strong>2.2 Streaming response body processing</strong></p><p>You can process large files piece by piece instead of waiting for the entire download.</p><pre>// Example: Download a large file and show progress<br>const response = await fetch(&#39;/large-video.mp4&#39;);<br>const reader = response.body.getReader();<br><br>while (true) {<br>  const {done, chunk} = await reader.read();<br>  if (done) break;<br>  console.log(`Received ${chunk.length} bytes`);<br>}</pre><p><em>ChatGPT-style data streaming can be achieved using this approach.</em></p><p>To make this work, the backend must send the response as a <strong>stream (chunked response)</strong> instead of waiting to return the entire payload at once.</p><pre>// node.js server implementation<br>app.get(&quot;/stream&quot;, (req, res) =&gt; {<br>  res.setHeader(&quot;Content-Type&quot;, &quot;text/plain&quot;);<br>  res.setHeader(&quot;Transfer-Encoding&quot;, &quot;chunked&quot;);<br><br>  res.write(&quot;Hello &quot;);<br>  setTimeout(() =&gt; res.write(&quot;from &quot;), 500);<br>  setTimeout(() =&gt; res.write(&quot;the server &quot;), 1000);<br>  setTimeout(() =&gt; {<br>    res.write(&quot;stream!&quot;);<br>    res.end();<br>  }, 1500);<br>});</pre><p><strong>2.3 Full control over Request and Response objects</strong></p><p>You can inspect and modify every detail of your HTTP communication.</p><pre>// Create a reusable request configuration<br>const myRequest = new Request(&#39;/api/users&#39;, {<br>  method: &#39;GET&#39;,<br>  headers: {&#39;Authorization&#39;: &#39;Bearer token123&#39;},<br>  cache: &#39;no-cache&#39;<br>});<br><br>// Use it multiple times or clone it<br>const response1 = await fetch(myRequest);<br>const response2 = await fetch(myRequest.clone()); // clone() discussed below</pre><p><strong>Request.clone()</strong></p><p>Request.clone() creates a <strong>copy of the request, so its body/stream can be used again</strong>.</p><p>The important idea is:</p><blockquote><strong><em>A request or response body is a stream and can only be consumed once.</em></strong></blockquote><p>So once fetch() starts using it, the original request <strong>cannot be reused</strong> unless it is cloned.</p><pre>const req = new Request(&#39;/api/data&#39;, {<br>  method: &quot;POST&quot;,<br>  body: JSON.stringify({ name: &quot;Saurabh&quot; })<br>});<br><br>await fetch(req);<br>await fetch(req); // ❌ Error: body already used</pre><p><strong>2.4 Integration with other web APIs (Service Workers, Streams API)</strong></p><p>Fetch works seamlessly with modern browser features for offline apps and background processing.</p><pre>// Example: Cache API responses for offline use<br>self.addEventListener(&#39;fetch&#39;, event =&gt; {<br>  event.respondWith(<br>    caches.match(event.request)<br>      .then(cached =&gt; cached || fetch(event.request))<br>  );<br>});</pre><h4>3. Axios: Feature-Rich HTTP Library</h4><p>Axios is an isomorphic HTTP client that abstracts away platform differences between browsers and Node.js. It provides a higher-level API with conveniences that reduce boilerplate.</p><p><strong>What does this actually mean? Let’s break it down:</strong></p><p><strong>3.1 Isomorphic / Works everywhere</strong></p><p>Same code works in both browser and Node.js server.</p><pre>// This exact code works in browser AND on your Node.js server<br>import axios from &#39;axios&#39;;<br><br>const { data } = await axios.get(&#39;/api/users&#39;);<br>console.log(data);<br><br>// No need to import &#39;node-fetch&#39; or worry about compatibility</pre><p><strong>3.2 Automatic error rejection</strong></p><p>4xx and 5xx errors automatically go to your catch block — no manual checking needed.</p><pre>// Axios automatically treats HTTP errors as failures<br>try {<br>  const { data } = await axios.get(&#39;/api/user/999&#39;);<br>  console.log(data);<br>} catch (error) {<br>  // 404 automatically lands here - no manual checking!<br>  console.log(&#39;User not found&#39;);<br>}</pre><p><strong>3.3 Request/response transformation pipeline</strong></p><p><em>Axios automatically converts JavaScript objects to JSON and back — you don’t have to.</em></p><pre>// Axios handles JSON automatically<br>await axios.post(&#39;/api/users&#39;, {<br>  name: &#39;Alice&#39;,           // JavaScript object<br>  email: &#39;alice@test.com&#39;<br>});<br>// Axios automatically did: JSON.stringify() for you<br><br>const { data } = await axios.get(&#39;/api/users&#39;);<br>// Axios automatically did: response.json() for you<br>console.log(data.name); // Direct access to data</pre><p><strong>3.4 Interceptor pattern for middleware-style functionality</strong></p><p>Set up code that runs before every request or after every response — perfect for adding auth tokens.</p><pre>// Add authentication to ALL requests automatically<br>axios.interceptors.request.use(config =&gt; {<br>  config.headers.Authorization = `Bearer ${getToken()}`;<br>  return config;<br>});<br><br>// Now every axios request includes your auth token<br>await axios.get(&#39;/api/profile&#39;); // Token added automatically<br>await axios.post(&#39;/api/posts&#39;, data); // Token added here too</pre><h3>How We’ll Compare Them?</h3><p>Now that you understand what each tool is, we’ll compare them across critical areas:</p><ol><li><strong>Error Handling</strong> — How they treat failed requests</li><li><strong>Data Transformation</strong> — How they handle JSON</li><li><strong>Request Lifecycle</strong> — Adding auth tokens, logging, etc.</li><li><strong>Cancellation</strong> — Stopping requests mid-flight</li><li><strong>Timeouts</strong> — Preventing requests from hanging forever</li><li><strong>Progress Tracking</strong> — Monitoring uploads/downloads</li><li><strong>Security</strong> — CSRF protection</li></ol><p>Let’s dive into each area.</p><h3>1. Error Handling: A Critical Difference</h3><p>This is the biggest “gotcha” when switching between Fetch and Axios.</p><h4>1.1 Fetch’s Network-Only Rejection Model</h4><p>Fetch only treats network failures as errors. HTTP error codes like 404 or 500 don’t trigger the .catch() block.</p><p>Let’s see this in action:</p><pre>// Trying to fetch a user that doesn&#39;t exist (404 error)<br>async function getUser(userId) {<br>  try {<br>    const response = await fetch(`/api/users/${userId}`);<br>    <br>    // THIS IS THE PROBLEM: Even with 404, we reach this line!<br>    console.log(&#39;Request completed&#39;); // This prints for 404!<br>    <br>    // You MUST manually check if response is ok<br>    if (!response.ok) {<br>      throw new Error(`HTTP ${response.status}: ${response.statusText}`);<br>    }<br>    <br>    return await response.json();<br>  } catch (error) {<br>    // Only network errors land here automatically<br>    console.error(&#39;Request failed:&#39;, error);<br>    throw error;<br>  }<br>}<br><br>// Calling with non-existent user<br>getUser(9999); // Returns 404 but doesn&#39;t throw error automatically!</pre><p><strong>Real-world example where this causes bugs:</strong></p><pre>// BAD: Forgetting to check response.ok<br>const response = await fetch(&#39;/api/delete-account&#39;);<br>const result = await response.json();<br>showSuccess(&#39;Account deleted!&#39;); <br><br>// BUG: User sees success message even if server returned 500 error!</pre><p><strong>What you should take away:</strong></p><ul><li>✅ Fetch ONLY rejects on network failures (no internet, DNS errors, etc.)</li><li>❌ Fetch does NOT reject on HTTP errors (404, 500, etc.)</li><li>📝 You MUST check response.ok or response.status for every request</li><li>⚠️ Forgetting this check leads to silent failures and bugs</li></ul><h4>1.2 Axios’s HTTP-Aware Rejection Model</h4><p>Axios automatically treats HTTP error codes (4xx, 5xx) as failures that trigger your .catch() block.</p><pre>// Trying to fetch a user that doesn&#39;t exist (404 error)<br>async function getUser(userId) {<br>  try {<br>    const response = await axios.get(`/api/users/${userId}`);<br>    return response.data;<br>  } catch (error) {<br>    // 404 automatically lands here - no manual checking needed!<br>    if (error.response) {<br>      // Server responded with error status (404, 500, etc.)<br>      console.error(`HTTP ${error.response.status}:`, error.response.data);<br>    } else if (error.request) {<br>      // Request sent but no response received (network error)<br>      console.error(&#39;Network error:&#39;, error.request);<br>    } else {<br>      // Request configuration error<br>      console.error(&#39;Request setup error:&#39;, error.message);<br>    }<br>    throw error;<br>  }<br>}<br><br>// Calling with non-existent user<br>getUser(9999); // Automatically goes to catch block with 404!</pre><p><strong>What you should take away:</strong></p><ul><li>✅ Axios rejects on BOTH network errors AND HTTP errors</li><li>✅ 404, 500, 401, etc. automatically go to .catch() block</li><li>✅ No manual checking needed — less code to write</li><li>✅ Harder to accidentally ignore errors</li></ul><h3>2. Data Transformation: JSON Handling</h3><p>Almost every modern API uses JSON. How each library handles JSON conversion matters for your daily coding.</p><h4>2.1 Manual Transformation with Fetch</h4><p>Fetch requires two steps to get JSON data.</p><pre>// Step 1: Get the response<br>const response = await fetch(&#39;/api/users&#39;);<br><br>// Step 2: Parse JSON (this returns another Promise!)<br>const data = await response.json();<br><br>// Now you can use the data<br>console.log(data);</pre><p><strong>This two-step dance is required EVERY SINGLE TIME:</strong></p><pre>// Getting data - two steps<br>const response1 = await fetch(&#39;/api/posts&#39;);<br>const posts = await response1.json();<br><br>// Sending data - manual JSON.stringify<br>await fetch(&#39;/api/posts&#39;, {<br>  method: &#39;POST&#39;,<br>  headers: { &#39;Content-Type&#39;: &#39;application/json&#39; }, // Must set this<br>  body: JSON.stringify({ title: &#39;My Post&#39;, content: &#39;Hello&#39; }) // Must stringify<br>});</pre><p><strong>Other response types also need manual handling:</strong></p><pre>// Text response<br>const text = await fetch(&#39;/api/text&#39;).then(r =&gt; r.text());<br><br>// Blob response (file download)<br>const blob = await fetch(&#39;/api/file&#39;).then(r =&gt; r.blob());<br><br>// ArrayBuffer (binary data)<br>const buffer = await fetch(&#39;/api/binary&#39;).then(r =&gt; r.arrayBuffer());</pre><p><strong>What you should take away:</strong></p><ul><li>❌ Always requires two steps: fetch() then .json()</li><li>❌ Must manually JSON.stringify() when sending data</li><li>❌ Must manually set Content-Type header</li><li>❌ Easy to forget — common source of bugs</li><li>✅ Flexible — can handle non-JSON responses easily</li></ul><h4>2.2 Automatic Transformation with Axios</h4><p>Axios automatically handles JSON — both ways.</p><pre>// One step - JSON parsing happens automatically<br>const { data } = await axios.get(&#39;/api/users&#39;);<br>console.log(data); // Already parsed, ready to use!<br><br>// Sending data - automatic JSON.stringify<br>await axios.post(&#39;/api/posts&#39;, {<br>  title: &#39;My Post&#39;,     // JavaScript object<br>  content: &#39;Hello&#39;      // No JSON.stringify needed!<br>});<br>// Axios automatically:<br>// 1. Converts object to JSON<br>// 2. Sets Content-Type header</pre><p><strong>Real-world comparison:</strong></p><pre>// FETCH - Verbose<br>async function createUser(userData) {<br>  const response = await fetch(&#39;/api/users&#39;, {<br>    method: &#39;POST&#39;,<br>    headers: {<br>      &#39;Content-Type&#39;: &#39;application/json&#39;<br>    },<br>    body: JSON.stringify(userData)<br>  });<br>  <br>  if (!response.ok) throw new Error(&#39;Failed&#39;);<br>  <br>  return await response.json();<br>}<br><br>// AXIOS - Concise<br>async function createUser(userData) {<br>  const { data } = await axios.post(&#39;/api/users&#39;, userData);<br>  return data;<br>}</pre><p><strong>Other response types still supported:</strong></p><pre>// Text response<br>const { data } = await axios.get(&#39;/api/text&#39;, { <br>  responseType: &#39;text&#39; <br>});<br><br>// Blob response (file download)<br>const { data } = await axios.get(&#39;/api/file&#39;, { <br>  responseType: &#39;blob&#39; <br>});<br><br>// ArrayBuffer<br>const { data } = await axios.get(&#39;/api/binary&#39;, { <br>  responseType: &#39;arraybuffer&#39; <br>});</pre><p><strong>What you should take away:</strong></p><ul><li>✅ One step — get JSON directly in response.data</li><li>✅ Automatic JSON.stringify() when sending objects</li><li>✅ Automatic Content-Type header setting</li><li>✅ Less code = fewer bugs</li><li>✅ Still supports other response types when needed</li></ul><p><strong>Bottom line:</strong> Axios saves you from typing .json() hundreds of times in your codebase.</p><h3>3. Request Lifecycle Management: Interceptors</h3><p>Imagine you want to add an authentication token to EVERY request in your app. Or log EVERY response. Interceptors let you do this.</p><h4>3.1 The Interceptor Pattern in Axios</h4><p><strong>What are interceptors?</strong> Think of them as middleware that runs before your request goes out, or after the response comes back.</p><p><strong>Real-world use case #1: Automatic Authentication</strong></p><p>Without interceptors, you’d repeat this everywhere:</p><pre>// BAD: Repeating auth token in every request<br>await axios.get(&#39;/api/profile&#39;, {<br>  headers: { Authorization: `Bearer ${token}` }<br>});<br><br>await axios.get(&#39;/api/posts&#39;, {<br>  headers: { Authorization: `Bearer ${token}` }<br>});<br><br>await axios.post(&#39;/api/comments&#39;, data, {<br>  headers: { Authorization: `Bearer ${token}` }<br>});<br>// Repeated 50+ times in your app!</pre><p>With interceptors — write once, applies everywhere:</p><pre>// GOOD: Set up once, applies to all requests<br>axios.interceptors.request.use(config =&gt; {<br>  const token = localStorage.getItem(&#39;authToken&#39;);<br>  if (token) {<br>    config.headers.Authorization = `Bearer ${token}`;<br>  }<br>  return config;<br>});<br><br>// Now all requests automatically include the token<br>await axios.get(&#39;/api/profile&#39;);      // Token added automatically<br>await axios.get(&#39;/api/posts&#39;);        // Token added automatically<br>await axios.post(&#39;/api/comments&#39;, data); // Token added automatically</pre><p><strong>What you should take away:</strong></p><ul><li>✅ Write auth code once, not in every request</li><li>✅ Impossible to forget adding auth token</li><li>✅ Easy to update when token format changes</li></ul><p><strong>Real-world use case #2: Automatic Token Refresh</strong></p><p>When your auth token expires, automatically get a new one:</p><pre>// Intercept responses to handle expired tokens<br>axios.interceptors.response.use(<br>  response =&gt; response, // Pass through successful responses<br>  async error =&gt; {<br>    // Check if token expired<br>    if (error.response?.status === 401) {<br>      console.log(&#39;Token expired, refreshing...&#39;);<br>      <br>      try {<br>        // Get new token<br>        const { data } = await axios.post(&#39;/auth/refresh&#39;);<br>        localStorage.setItem(&#39;authToken&#39;, data.token);<br>        <br>        // Retry the original request with new token<br>        error.config.headers.Authorization = `Bearer ${data.token}`;<br>        return axios.request(error.config);<br>      } catch (refreshError) {<br>        // Refresh failed, redirect to login<br>        window.location.href = &#39;/login&#39;;<br>        return Promise.reject(refreshError);<br>      }<br>    }<br>    <br>    return Promise.reject(error);<br>  }<br>);<br><br>// Your code stays clean<br>await axios.get(&#39;/api/profile&#39;); <br>// If token expired, automatically refreshes and retries!</pre><p><strong>Real-world use case #3: Request/Response Logging</strong></p><p>Log all API calls for debugging:</p><pre>// Request interceptor - log outgoing requests<br>axios.interceptors.request.use(config =&gt; {<br>  config.metadata = { startTime: Date.now() };<br>  console.log(`→ ${config.method.toUpperCase()} ${config.url}`);<br>  return config;<br>});<br><br>// Response interceptor - log responses with timing<br>axios.interceptors.response.use(<br>  response =&gt; {<br>    const duration = Date.now() - response.config.metadata.startTime;<br>    console.log(`✓ ${response.status} ${response.config.url} (${duration}ms)`);<br>    return response;<br>  },<br>  error =&gt; {<br>    const duration = Date.now() - error.config.metadata.startTime;<br>    console.log(`✗ ${error.config.url} (${duration}ms)`);<br>    return Promise.reject(error);<br>  }<br>);<br><br>// Console output:<br>// → GET /api/users<br>// ✓ 200 /api/users (245ms)<br>// → POST /api/posts<br>// ✗ /api/posts (156ms)</pre><p><strong>Real-world use case #4: Global Error Handling</strong></p><p>Show error messages to users automatically:</p><pre>axios.interceptors.response.use(<br>  response =&gt; response,<br>  error =&gt; {<br>    // Show user-friendly error messages<br>    if (error.response) {<br>      switch (error.response.status) {<br>        case 404:<br>          showNotification(&#39;Resource not found&#39;);<br>          break;<br>        case 500:<br>          showNotification(&#39;Server error. Please try again.&#39;);<br>          break;<br>        case 403:<br>          showNotification(&#39;You don\&#39;t have permission&#39;);<br>          break;<br>      }<br>    } else {<br>      showNotification(&#39;Network error. Check your connection.&#39;);<br>    }<br>    <br>    return Promise.reject(error);<br>  }<br>);<br><br>// Your code stays clean - no error UI logic needed<br>try {<br>  await axios.get(&#39;/api/data&#39;);<br>} catch (error) {<br>  // Error notification already shown to user!<br>}</pre><h4>3.2 Fetch’s Manual Wrapper Approach</h4><p>Fetch doesn’t have interceptors. You need to create wrapper functions:</p><pre>// You have to build your own &quot;interceptor&quot; system<br>async function fetchWithAuth(url, options = {}) {<br>  // Manually add auth token<br>  const token = localStorage.getItem(&#39;authToken&#39;);<br>  <br>  const config = {<br>    ...options,<br>    headers: {<br>      ...options.headers,<br>      &#39;Authorization&#39;: token ? `Bearer ${token}` : undefined<br>    }<br>  };<br><br>  const response = await fetch(url, config);<br>  <br>  // Manually handle token refresh<br>  if (response.status === 401) {<br>    const refreshResponse = await fetch(&#39;/auth/refresh&#39;, { method: &#39;POST&#39; });<br>    if (refreshResponse.ok) {<br>      const { token } = await refreshResponse.json();<br>      localStorage.setItem(&#39;authToken&#39;, token);<br>      <br>      // Retry original request<br>      config.headers.Authorization = `Bearer ${token}`;<br>      return fetch(url, config);<br>    }<br>  }<br>  <br>  return response;<br>}<br><br>// Now you must use your wrapper everywhere instead of fetch<br>await fetchWithAuth(&#39;/api/data&#39;); // Can&#39;t use regular fetch anymore</pre><p><strong>What you should take away:</strong></p><ul><li>❌ Must build and maintain your own wrapper</li><li>❌ Team must remember to use wrapper, not fetch()</li><li>❌ More code to write and test</li><li>✅ Possible, but requires more work</li></ul><p><strong>Bottom line:</strong> Axios interceptors are like having a security guard (auth), translator (data transformation), and logger (debugging) that automatically help with every request. With Fetch, you build these helpers yourself.</p><h3>4. Request Cancellation: Stopping Requests Mid-Flight</h3><p><strong>Why cancel requests?</strong> User navigates away before data loads, or searches while typing (cancel old search when new one starts).</p><h4>4.1 Fetch with AbortController</h4><pre>// Create a controller<br>const controller = new AbortController();<br><br>// Start a request with the controller&#39;s signal<br>fetch(&#39;/api/slow-data&#39;, { <br>  signal: controller.signal <br>})<br>  .then(response =&gt; response.json())<br>  .then(data =&gt; console.log(data))<br>  .catch(error =&gt; {<br>    if (error.name === &#39;AbortError&#39;) {<br>      console.log(&#39;Request was cancelled by user&#39;);<br>    }<br>  });<br><br>// Cancel from elsewhere (e.g., user clicks back button)<br>controller.abort();</pre><p><strong>Real-world example — Search as you type:</strong></p><pre>let controller = null;<br><br>async function searchUsers(query) {<br>  // Cancel previous search<br>  if (controller) {<br>    controller.abort();<br>  }<br>  <br>  // Start new search<br>  controller = new AbortController();<br>  <br>  try {<br>    const response = await fetch(`/api/search?q=${query}`, {<br>      signal: controller.signal<br>    });<br>    const results = await response.json();<br>    displayResults(results);<br>  } catch (error) {<br>    if (error.name !== &#39;AbortError&#39;) {<br>      console.error(&#39;Search failed:&#39;, error);<br>    }<br>  }<br>}<br><br>// User types: &quot;j&quot; -&gt; &quot;jo&quot; -&gt; &quot;joh&quot; -&gt; &quot;john&quot;<br>// Only the &quot;john&quot; request completes, others are cancelled</pre><h4>4.2 Axios with CancelToken or AbortController</h4><p>Axios supports both methods:</p><pre>// Method 1: Axios CancelToken (older way)<br>const source = axios.CancelToken.source();<br><br>axios.get(&#39;/api/slow-data&#39;, {<br>  cancelToken: source.token<br>});<br><br>source.cancel(&#39;User clicked cancel button&#39;);<br><br>// Method 2: AbortController (newer, recommended)<br>const controller = new AbortController();<br><br>axios.get(&#39;/api/slow-data&#39;, {<br>  signal: controller.signal<br>});<br><br>controller.abort();</pre><h3>5. Timeout Configuration: Don’t Wait Forever</h3><p><strong>Why timeouts?</strong> Prevent requests from hanging indefinitely when server is slow or unresponsive.</p><h4>5.1 Fetch — Manual Timeout Implementation</h4><pre>// You have to build timeout yourself<br>async function fetchWithTimeout(url, timeoutMs = 5000) {<br>  const controller = new AbortController();<br>  <br>  // Set up timeout<br>  const timeoutId = setTimeout(() =&gt; {<br>    controller.abort();<br>  }, timeoutMs);<br>  <br>  try {<br>    const response = await fetch(url, {<br>      signal: controller.signal<br>    });<br>    clearTimeout(timeoutId);<br>    return response;<br>  } catch (error) {<br>    clearTimeout(timeoutId);<br>    <br>    if (error.name === &#39;AbortError&#39;) {<br>      throw new Error(&#39;Request timeout&#39;);<br>    }<br>    throw error;<br>  }<br>}<br><br>// Use your custom function<br>try {<br>  const response = await fetchWithTimeout(&#39;/api/data&#39;, 3000);<br>  const data = await response.json();<br>} catch (error) {<br>  console.error(&#39;Failed or timed out:&#39;, error);<br>}</pre><p><strong>What you should take away:</strong></p><ul><li>❌ No built-in timeout support</li><li>❌ Must combine AbortController + setTimeout</li><li>❌ More code to maintain</li></ul><h4>5.2 Axios — Built-in Timeout</h4><pre>// Simple one-line timeout configuration<br>try {<br>  const { data } = await axios.get(&#39;/api/data&#39;, {<br>    timeout: 3000 // 3 seconds<br>  });<br>  console.log(data);<br>} catch (error) {<br>  if (error.code === &#39;ECONNABORTED&#39;) {<br>    console.error(&#39;Request timed out!&#39;);<br>  }<br>}<br><br>// Or set globally for all requests<br>axios.defaults.timeout = 5000;<br><br>// Now every request times out after 5 seconds<br>await axios.get(&#39;/api/slow&#39;);     // Times out after 5s<br>await axios.post(&#39;/api/heavy&#39;, data); // Times out after 5s</pre><p><strong>What you should take away:</strong></p><ul><li>✅ Built-in timeout support</li><li>✅ One line of code</li><li>✅ Can set globally or per-request</li><li>✅ Less code = fewer bugs</li></ul><h3>6. Progress Monitoring: Track Upload/Download Progress</h3><p><strong>Why track progress?</strong> Show users progress bars for file uploads or large downloads.</p><h4>6.1 Fetch’s Limited Progress Support</h4><p>Fetch can track download progress (with effort) but <strong>cannot track upload progress</strong>.</p><p><strong>Download progress with Fetch:</strong></p><pre>async function downloadWithProgress(url) {<br>  const response = await fetch(url);<br>  const reader = response.body.getReader();<br>  <br>  // Get total file size<br>  const contentLength = +response.headers.get(&#39;Content-Length&#39;);<br>  <br>  let receivedLength = 0;<br>  const chunks = [];<br>  <br>  while (true) {<br>    const { done, value } = await reader.read();<br>    <br>    if (done) break;<br>    <br>    chunks.push(value);<br>    receivedLength += value.length;<br>    <br>    // Calculate progress<br>    const progress = (receivedLength / contentLength) * 100;<br>    updateProgressBar(progress); // Update UI<br>  }<br>  <br>  // Combine chunks into file<br>  return new Blob(chunks);<br>}</pre><p><strong>Upload progress with Fetch:</strong></p><pre>// ❌ NOT POSSIBLE with Fetch<br>// You must use XMLHttpRequest for upload progress</pre><h3><strong>What you should take away:</strong></h3><ul><li>⚠️ Download progress: Possible but complex</li><li>❌ Upload progress: Not supported</li><li>❌ Must use XMLHttpRequest for uploads</li></ul><h4>6.2 Axios’s Built-in Progress Events</h4><p>Both upload and download progress work out of the box:</p><p><strong>Upload progress:</strong></p><pre>// Track file upload progress<br>const formData = new FormData();<br>formData.append(&#39;file&#39;, fileInput.files[0]);<br><br>await axios.post(&#39;/api/upload&#39;, formData, {<br>  onUploadProgress: progressEvent =&gt; {<br>    const percentCompleted = Math.round(<br>      (progressEvent.loaded * 100) / progressEvent.total<br>    );<br>    <br>    updateProgressBar(percentCompleted); // Update UI<br>    console.log(`Uploading: ${percentCompleted}%`);<br>  }<br>});<br><br>console.log(&#39;Upload complete!&#39;);</pre><p><strong>Download progress:</strong></p><pre>// Track file download progress<br>await axios.get(&#39;/api/large-video.mp4&#39;, {<br>  responseType: &#39;blob&#39;,<br>  onDownloadProgress: progressEvent =&gt; {<br>    const percentCompleted = Math.round(<br>      (progressEvent.loaded * 100) / progressEvent.total<br>    );<br>    <br>    updateProgressBar(percentCompleted); // Update UI<br>    console.log(`Downloading: ${percentCompleted}%`);<br>  }<br>});<br><br>console.log(&#39;Download complete!&#39;);</pre><p><strong>Real-world example — File upload with progress bar:</strong></p><pre>async function uploadFile(file) {<br>  const formData = new FormData();<br>  formData.append(&#39;file&#39;, file);<br>  <br>  try {<br>    await axios.post(&#39;/api/files&#39;, formData, {<br>      onUploadProgress: (progressEvent) =&gt; {<br>        const percent = Math.round(<br>          (progressEvent.loaded * 100) / progressEvent.total<br>        );<br>        document.getElementById(&#39;progress&#39;).style.width = percent + &#39;%&#39;;<br>        document.getElementById(&#39;percent&#39;).textContent = percent + &#39;%&#39;;<br>      }<br>    });<br>    <br>    alert(&#39;Upload successful!&#39;);<br>  } catch (error) {<br>    alert(&#39;Upload failed!&#39;);<br>  }<br>}</pre><p><strong>What you should take away:</strong></p><ul><li>✅ Upload progress: Built-in support</li><li>✅ Download progress: Built-in support</li><li>✅ Simple callback functions</li><li>✅ Essential for good user experience</li></ul><h3>7. Cross-Site Request Forgery (CSRF) Protection</h3><p><strong>What is CSRF?</strong> A security attack where malicious websites trick users into performing unwanted actions on sites they’re logged into.</p><p><strong>How to prevent it?</strong> Include a special token with each request that only your site knows.</p><h4>7.1 Manual CSRF with Fetch</h4><p>You must manually read and send the CSRF token:</p><pre>// Read CSRF token from cookie or meta tag<br>const csrfToken = document<br>  .querySelector(&#39;meta[name=&quot;csrf-token&quot;]&#39;)<br>  ?.content;<br><br>// Manually add to every request<br>await fetch(&#39;/api/delete-account&#39;, {<br>  method: &#39;POST&#39;,<br>  headers: {<br>    &#39;X-CSRF-Token&#39;: csrfToken<br>  },<br>  body: JSON.stringify(data)<br>});</pre><p><strong>What you should take away:</strong></p><ul><li>❌ Must manually get token</li><li>❌ Must add to every request</li><li>❌ Easy to forget</li></ul><h4>7.2 Automatic CSRF with Axios</h4><p>Axios can automatically include CSRF tokens:</p><pre>// Configure once (usually in your app initialization)<br>axios.defaults.xsrfCookieName = &#39;XSRF-TOKEN&#39;;  // Cookie name<br>axios.defaults.xsrfHeaderName = &#39;X-XSRF-TOKEN&#39;; // Header name<br><br>// Now all requests include CSRF token automatically!<br>await axios.post(&#39;/api/delete-account&#39;, data);<br>await axios.put(&#39;/api/update-profile&#39;, userData);<br>await axios.delete(&#39;/api/remove-item&#39;);<br>// No need to manually add token to any of these</pre><p><strong>What you should takeaway:</strong></p><ul><li>✅ Configure once, works everywhere</li><li>✅ Automatic token inclusion</li><li>✅ Impossible to forget</li><li>✅ Better security with less effort</li></ul><h3>Conclusion</h3><p>Both Fetch and Axios are mature, battle-tested solutions for HTTP communication in JavaScript. Your choice should align with project requirements, team expertise, and long-term maintenance considerations.</p><p><strong>Summary recommendations:</strong></p><ul><li><strong>For enterprise applications</strong>: Axios’s feature set, interceptors, and superior developer experience typically justify its inclusion.</li><li><strong>For minimal dependencies</strong>: Fetch is perfectly adequate when features like interceptors and automatic transformations aren’t needed.</li><li><strong>For teams</strong>: Axios provides better consistency and reduces the cognitive load of manual error handling and data transformation.</li><li><strong>For learning</strong>: Understanding Fetch helps you grasp fundamental web APIs and HTTP concepts.</li></ul><p>Neither choice is inherently wrong. Evaluate based on your specific context, and don’t be afraid to use both in different parts of your application when appropriate.</p><p>The HTTP client you choose is a tool, not a commitment. Select the one that best serves your immediate needs while remaining open to evolution as your application grows.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83bfb3e37ecf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debounce for Interviews: What Most Candidates Miss]]></title>
            <link>https://medium.com/@me4saurabh4u/why-your-debounce-answer-isnt-strong-enough-for-top-interviews-9f3a006bd590?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f3a006bd590</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[debounce]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Sun, 01 Mar 2026 08:41:21 GMT</pubDate>
            <atom:updated>2026-04-22T15:31:08.998Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1FBOflMGRJhDcNFLxG3OWw.png" /></figure><p>Look, I get it. You’ve memorized the debounce function. You can recite it like Shakespeare reciting his own sonnets. You even threw in clearTimeout like a seasoned pro.</p><p>Congrats. You’re officially in the same boat as 10,000 other candidates who watched the same YouTube tutorial, read the same Medium article, and copy-pasted the same code from Stack Overflow.</p><p>Because there’s a lot of nonsense on the internet about debounce.</p><p>Most articles explain it like:</p><blockquote><em>“Debounce means a delayed function. Thank you. Bye.”</em></blockquote><p>That’s like teaching someone surgery by saying:</p><blockquote><em>“Cut the patient. Then close. That’s it.”</em></blockquote><p>We are not doing that today. We are going to go deep. And we’ll have some fun while doing it.</p><h3>The 3 Questions That Separate Gods from Mortals</h3><p>Alright, time for a quick surprise test. If you can confidently answer these three questions RIGHT NOW — not after Googling, not after checking your notes, but RIGHT THIS SECOND — you can close this tab, go crack open a beer, and live your best life.</p><p>But if even one of these makes you hesitate, makes you squint, makes you think “wait… why DO we do that?” — buckle up, buttercup. Things are about to get interesting.</p><p><strong>Simple debounce implementation</strong></p><pre>function debounce(fn, delay) {<br>  let timer;<br><br>  return function (...args) { // Question 2<br>    clearTimeout(timer);<br><br>    timer = setTimeout(() =&gt; {<br>      fn.apply(this, args); // Question 1, Question 3<br>    }, delay);<br>  };<br>}</pre><p><strong>Questions:</strong></p><ol><li><strong>Why do we use </strong><strong>fn.apply(this, args) instead of just calling </strong><strong>fn(args) directly?</strong> What&#39;s the deal with apply? Can&#39;t we just... you know... call the function like normal people?</li><li><strong>Can we return an arrow function from debounce instead of a regular function?</strong> I mean, arrow functions are the hot new thing, right? return () =&gt; {} looks so much cleaner!</li><li><strong>Can I use this debounce implementation with an arrow function as the input </strong><strong>const fn = () =&gt; {}?</strong> What happens if I pass in an arrow function instead of a regular function?</li></ol><p><strong>Pro tip:</strong> If you’re not confident with your answers, feel free to call me at 7777–4829–7777. If the call doesn’t go through, that’s expected. That’s just my advanced spam-filtering system doing its job. It only accepts calls from people who’ve finished reading the article.</p><p>So keep going. By the end, you’ll understand debouncing so well you could explain it to your grandmother… who still believes “the cloud” is something that might cause rain tomorrow.</p><h3>Alright, What IS Debouncing?</h3><blockquote>Debouncing is a technique where a function runs only after events have stopped for a specified amount of time.</blockquote><p><strong>Real-life Analogy:</strong></p><blockquote><em>You to Her:</em> <em>“Good morning ❤️”</em></blockquote><blockquote><em>2 seconds later: “Was that too much?”</em></blockquote><blockquote><em>3 seconds later: “Should I not have sent the heart?”</em></blockquote><blockquote><em>Her: “Let me know when you’re done with overthinking.”</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/0*2fpbpOQys6DM_Dar.gif" /></figure><p>That’s debouncing.</p><h4><strong>The Classic use case of debouncing (That Everyone Uses Because It’s Perfect)</strong></h4><p>Imagine a search box that fetches results as you type. You know the one — autocomplete, type-ahead, whatever you want to call it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WgdgBfa_3l1ZByCt.gif" /></figure><p><strong>Without debounce: </strong>You type “hello” and your app makes <strong>5 separate API calls</strong> to your backend:</p><p><strong>With debounce: </strong>You type “hello” and… <em>nothing happens</em>. You wait 300ms… <em>still nothing</em>. Then BAM — one single, beautiful, elegant API call for “hello.”</p><pre>// Without debouncing: 5 searches<br>// &quot;hello&quot; → h, he, hel, hell, hello (RIP server)<br><br>// With debouncing: 1 search  <br>// &quot;hello&quot; → hello (server is happy, you still have a job)</pre><h3>Let’s See It In Action</h3><p>Here’s a trailing debounce example (“trailing” means calling the function at the end of the wait time):</p><pre>let count = 0;<br><br>// The function we want to debounce<br>function counter() {<br>  console.log(&#39;Updated count:&#39;, count + 1)<br>  return count++;<br>}<br><br>// Create a debounced version<br>const debouncedFn = debounce(counter, 1000);<br><br>// Now watch the magic<br>debouncedFn(); // count is still 0<br>debouncedFn(); // count is still 0  <br>debouncedFn(); // count is STILL 0<br><br>// *1 second passes*<br>// Console: &quot;Updated count: 1&quot;<br>// count is finally 1!<br><br>// Later...<br>setTimeout(() =&gt; {<br>  debouncedFn(); // After 1.5 seconds total, count becomes 2<br>}, 1500);</pre><p>Even though we spam-called debouncedFn() three times, like an impatient teenager, the actual counter() function only executes <strong>once</strong>, after waiting 1 second from the <em>last</em> call.</p><p>Beautiful. Efficient. <em>Chef’s kiss</em>.</p><p>Now, to be frank, there’s way too much BS on the internet where entire tutorials are spent repeating the definition of debouncing, and the actual implementation gets treated like a side quest.</p><p>Honestly, this much is already enough to understand what debouncing really is. So now, let’s get to the part that actually matters.</p><h3>Basic debounce implementation</h3><pre>function debounce(fn, delay) {<br>  // This will store our timeout ID<br>  // (spoiler: this is a closure, and if you don&#39;t know what that means, <br>  // you&#39;re about to have a bad time)<br>  let timer;<br><br>  // Return a new function that wraps the original<br>  return function (...args) {<br>    // If the function gets called again before the delay,<br>    // CANCEL the previous scheduled execution<br>    clearTimeout(timer);<br><br>    // Schedule the function to run after the delay<br>    timer = setTimeout(() =&gt; {<br>      // Call the original function with the correct context and arguments<br>      fn.apply(this, args);<br>    }, delay);<br>  };<br>}</pre><p>Most people stop here. This is why most people fail. Let’s go deeper.</p><h4>The Intuition (Or: How the Hell Does This Actually Work?)</h4><p>Let’s break down what’s happening here in plain English, because the code is actually pretty clever once you understand it.</p><p><strong>The core idea of debouncing:</strong><br> “Don’t run the function immediately. Wait until the user stops calling it for X amount of time, THEN run it.”</p><p>So to create a debounced version of a function, we need to:</p><ol><li><strong>Take the original function</strong> (the one we want to debounce)</li><li><strong>Take a delay</strong> (how long to wait)</li><li><strong>Return a NEW function</strong> that does the waiting logic</li></ol><p><strong><em>Now, let’s take a closer look at the JS concepts needed to understand it:</em></strong></p><h4><strong>Closures (Pay Attention, This Is Important)</strong></h4><p>Notice how we declare let timer OUTSIDE the returned function but INSIDE debounce?</p><pre>function debounce(fn, delay) {<br>  let timer;  // ← Declared here!<br>  <br>  return function (...args) {<br>    clearTimeout(timer);  // ← But used here!<br>    timer = setTimeout(/* ... */, delay);<br>  };<br>}</pre><p>This is called a <strong>closure</strong> (if you don’t know what closures are, go learn it <a href="https://dev.to/saurabh_raj_afaabe1844a4c/mastering-closures-in-javascript-never-to-look-back-again-5gm3">here </a>right now — seriously, I’ll wait). The returned function “closes over” the timer variable, meaning it remembers and has access to it even after debounce finishes executing.</p><p>This is CRUCIAL because every time we callclearTimeout(timer), we need to cancel the PREVIOUS timeout. If timer was declared inside the returned function, it would be recreated every time, and we&#39;d lose track of the previous timeout ID. Game over.</p><h4><strong>The Rest Operator</strong></h4><pre>return function (...args) {</pre><p>The ...args syntax uses the <strong>rest operator</strong> to collect all arguments into an array. So if someone calls debouncedFn(1, 2, 3), the args variable becomes [1, 2, 3].</p><p>Why? Because we need to pass ALL the arguments to the original function later. We can’t know ahead of time how many arguments the function needs.</p><h4>setTimeout: The Asynchronous Hero</h4><pre>timer = setTimeout(() =&gt; {<br>  fn.apply(this, args);<br>}, delay);</pre><p>setTimeout is an asynchronous function (handled by the Web API, not JavaScript itself—look up this <a href="https://www.youtube.com/watch?v=8aGhZQkoFbQ&amp;t=1032s&amp;pp=ygURZXZlbnQgbG9vcHMgaW4ganM%3D">event loop</a> tutorial if you want your mind blown).</p><p><strong>Important note:</strong> setTimeout doesn&#39;t GUARANTEE execution after exactly delay milliseconds. It guarantees execution <em>after AT LEAST</em> delay milliseconds. Usually, it&#39;s close enough that you won&#39;t notice, but if the event loop is backed up, it might take longer.</p><p>setTimeout returns a timerId which we store in our closure variable timer. This lets us cancel it later with clearTimeout(timer) if the function gets called again before the delay expires.</p><h4>The ‘this’ keyword</h4><p>This is one of the most important parts of the implementation. You must understand it in depth to fully grasp what’s happening here. I will discuss it in brief here, but I recommend you read this <a href="https://dev.to/saurabh_raj_afaabe1844a4c/mastering-the-this-keyword-in-javascript-an-in-depth-exploration-2ach">article</a> for an in-depth understanding.</p><blockquote>In JavaScript, for <strong>regular functions</strong>, the value of this is determined by <strong>HOW the function is called</strong>, not WHERE it&#39;s defined.</blockquote><blockquote>This is decided at <strong>runtime</strong>. Dynamically. Which means this can be a different value every time you call the same function, depending on the context. Fun, right? No. Not fun. Traumatic.</blockquote><blockquote>In <strong>arrow functions</strong>, the value of this is determined by lexical scope, meaning it is taken from the surrounding context where the function is defined.</blockquote><p>Read that again. I’ll wait.</p><p><strong>Note: </strong>For a normal function inside an object, <strong>this</strong> refers to the object.</p><pre>const obj = {<br>  name: &quot;Saurabh&quot;,<br>  fun() {<br>    console.log(this.name)<br>  }<br>}<br><br>obj.fun();<br>// Outputs: &#39;Saurabh&#39; as &#39;fun&#39; is a regular function and is being called as a<br>// function of the object</pre><h3>Now the real question</h3><h4>Question 1: Why fn.apply(this, args)?</h4><p>Why not:</p><pre>fn(...args);</pre><p><strong>Ans:</strong> Because of <strong>context (this)</strong>.</p><p>Let’s see:</p><pre>const user = {<br>  name: &quot;Saurabh Raj&quot;,<br>  login() {<br>    console.log(this.name + &quot; logged in successfully&quot;);<br>  }<br>}.<br><br>user.login(); <br>// Output: &quot;Saurabh Raj logged in successfully&quot;<br>// `this` refers to the `user` object ✅</pre><p>When you call user.login() (which is a regular function), JavaScript looks at how you called it and says, &quot;Oh, you&#39;re calling login as a method of user? Cool, I&#39;ll set this to point to user.&quot;</p><p>Everything’s great! Your function works! You feel like a competent developer!</p><p><strong>But Then Debouncing Enters the Chat</strong></p><p>Now let’s see what happens if we debounce this WITHOUT using apply:</p><pre>function badDebounce(fn, delay) {<br>  let timer;<br>  <br>  return function (...args) {<br>    clearTimeout(timer);<br>    timer = setTimeout(() =&gt; {<br>      fn(...args);  // ❌ Just calling it directly<br>    }, delay);<br>  };<br>}<br><br>const user = {<br>  name: &quot;Saurabh Raj&quot;,<br>  login: badDebounce(function() {<br>    console.log(this.name + &quot; logged in successfully&quot;);<br>  }, 300)<br>};<br><br>user.login();<br>// Output: &quot;undefined logged in successfully&quot; 💀<br>// Or in strict mode: TypeError: Cannot read property &#39;name&#39; of undefined</pre><p><strong>WHAT JUST HAPPENED?!</strong></p><p>When setTimeout eventually calls our function, it&#39;s calling it in the <strong>global context</strong> (or undefined in strict mode). The function has lost all connection to the user object. this is no longer pointing to user.</p><p><strong>The </strong><strong>apply() Save</strong></p><p>This is where fn.apply(this, args) becomes the hero we need:</p><pre>fn.apply(this, args);</pre><p>The apply method lets us call a function while <strong>explicitly setting what </strong><strong>this should be</strong>.</p><p>When we write fn.apply(this, args):</p><ul><li>The first argument (this) becomes the this inside fn</li><li>The second argument (args) is an array of arguments to pass to fn</li></ul><p>So when someone calls user.login():</p><ol><li>The returned wrapper function executes with this pointing to user (because it was called as user.login())</li><li>Inside the wrapper, we use apply to pass that this along to the original function</li><li>The original function executes with this still pointing to user</li><li>Everything works! ✨</li></ol><p><strong>That’s why we use </strong><strong>apply.</strong> It preserves the this context from wherever the debounced function was called.</p><p><strong>Quick Sidebar: Call, Apply, and Bind</strong></p><p>If you’re confused about apply, you probably need to learn about its siblings:</p><ul><li><strong>call(thisArg, arg1, arg2, ...)</strong> — Like apply, but takes arguments individually</li><li><strong>apply(thisArg, [argsArray])</strong> — Takes arguments as an array (what we use)</li><li><strong>bind(thisArg)</strong> — Returns a NEW function with this permanently bound</li></ul><p>They’re all about controlling what this refers to. Learn them. Love them. They&#39;ll save your ass in interviews.</p><h3>Question 2: Can We Return an Arrow Function? (Spoiler: God No)</h3><p>Arrow functions are cool. They’re concise. They look modern and hip. But they have one critical difference from regular functions:</p><p><strong>Arrow functions DO NOT have their own </strong><strong>this.</strong></p><p>Instead, they <strong>inherit </strong><strong>this from their lexical scope</strong> (the place where they&#39;re defined), and they lock it in forever. You cannot change it. Not with call, not with apply, not with bind, not with prayers, not with sacrifice. It&#39;s PERMANENT.</p><p>This is usually great for callbacks! But for debounce? It’s an absolute disaster.</p><p><strong>Let’s Watch Everything Burn</strong></p><pre>function debounce(fn, delay) {<br>  let timer;<br><br>  // ❌ RETURNING AN ARROW FUNCTION<br>  return (...args) =&gt; {<br>    clearTimeout(timer);<br><br>    timer = setTimeout(() =&gt; {<br>      fn.apply(this, args);<br>    }, delay);<br>  };<br>}</pre><p>“What’s wrong with this?” you might ask. “It looks fine!”</p><p>Oh, sweet summer child. Let me show you the carnage:</p><pre>const user = {<br>  name: &quot;Saurabh Raj&quot;,<br>  getName: debounce(function() {<br>    console.log(this.name);<br>  }, 300)<br>};<br><br>user.getName(); <br>// Output: undefined 💀<br>// Or: TypeError in strict mode 💀💀</pre><p><strong><em>What Just Happened?</em></strong></p><p><strong>Act 1: The Definition</strong></p><ul><li>When debounce is called, we return an arrow function</li><li>This arrow function captures this from... where exactly?</li><li>From the scope where debounce was executed</li><li>Which is usually the global scope (or undefined in strict mode)</li><li>The arrow function’s this is now FROZEN at this value</li></ul><p><strong>Act 2: The Call</strong></p><ul><li>Later, we call user.getName()</li><li>Even though we’re calling it as a method of user...</li><li>The arrow function doesn’t care</li><li>Its this was already decided back in Act 1</li><li>It’s still pointing to the global scope/undefined</li></ul><p><strong>Act 3: The Tragedy</strong></p><ul><li>Inside the arrow function, fn.apply(this, args) tries to save the day</li><li>But this in the arrow function is WRONG</li><li>So we’re passing the WRONG this to our original function</li><li>The original function’s this.name is undefined</li><li>Bug reports flood in. Users complain. Your manager schedules a “chat.”</li></ul><h4>The Real-World Example</h4><pre>// Bad debounce with arrow function<br>function debounce(fn, delay) {<br>  let timer;<br>  return (...args) =&gt; {  // ❌ ARROW FUNCTION<br>    clearTimeout(timer);<br>    timer = setTimeout(() =&gt; {<br>      fn.apply(this, args);  // `this` is wrong here!<br>    }, delay);<br>  };<br>}<br><br>class Search {<br>  constructor() {<br>    this.query = &quot;&quot;;<br>  }<br><br>  handleInput = debounce(function (value) {<br>    this.query = value;  // ❌ `this` is undefined/window<br>    console.log(&quot;Searching:&quot;, this.query);<br>  }, 300);<br>}<br><br>const search = new Search();<br>search.handleInput(&quot;React&quot;);<br>// 💀 Doesn&#39;t work. This.query is undefined.<br>// 💀 Your search feature is broken.<br>// 💀 Your sprint demo is in 10 minutes.<br>// 💀 Panic.</pre><p>You wanted to debounce a search input handler. Instead, you got a production bug that will haunt you at 3 AM when you’re on call.</p><h4>The Lesson</h4><p><strong>Always return a regular function from debounce, NEVER an arrow function.</strong></p><h3>Question 3: Can We Debounce an Arrow Function?</h3><p>Yes, you CAN pass an arrow function to debounce. The code will run. The linter won’t yell at you. Your CI pipeline will pass.</p><p>But will it WORK the way you expect? That depends entirely on whether your arrow function uses this.</p><h4>When It Works</h4><pre>const logMessage = debounce(() =&gt; {<br>  console.log(&quot;Hello!&quot;);  // No `this` here!<br>}, 300);<br><br>logMessage(); // ✅ Works fine!</pre><p>If your arrow function doesn’t use this at all, you&#39;re golden. Debounce it all day long. Go nuts.</p><h4>When It Doesn’t Work</h4><pre>const obj = {<br>  name: &quot;Saurabh&quot;,<br>  show: debounce(() =&gt; {<br>    console.log(this.name);  // ❌ `this` refers to... what?<br>  }, 300),<br>};<br><br>obj.show(); <br>// Output: undefined 💀</pre><p><strong>“But wait!”</strong>. <strong>“Even without debounce, this wouldn’t work!”</strong></p><p>EXACTLY!</p><p>Let me prove it:</p><pre>const obj = {<br>  name: &quot;Saurabh&quot;,<br>  show: () =&gt; {<br>    console.log(this.name);  // Still undefined!<br>  }<br>};<br><br>obj.show(); // undefined (no debounce involved)</pre><p>The arrow function’s this is baked in when it&#39;s DEFINED, not when it&#39;s called. In this case, it&#39;s defined at the module/global level, so this refers to the global scope (or undefined in modules/strict mode), NOT to obj.</p><p><strong>Concluding:</strong></p><blockquote>Yes, we can use arrow functions in this debounce implementation because the this context isn’t important here. Arrow functions don’t have their own this; they simply inherit it from the surrounding scope. So the debounced function still gets the correct context, and nothing breaks. In short, using an arrow function is fine as long as you don’t need to manually control or change this.</blockquote><h3>Production-Grade Debouncing: How Lodash Does It</h3><p>Alright, so you’ve mastered the basics. You understand this, closures, and why arrow functions are secretly trying to sabotage your career.</p><p>But in the real world, we need more than just a basic debounce. We need <strong>cancellation</strong>, <strong>flushing</strong>, <strong>leading-edge execution</strong>, and <strong>trailing-edge execution</strong>.</p><p>This is what separates “I watched a YouTube tutorial” from “I actually built production applications.”</p><h4>What Does Lodash Add?</h4><p>Here’s what lodash’s debounce implementation gives you (and what fancy companies expect you to know ):</p><p><strong>1. Leading Edge Execution</strong><br> Run the function IMMEDIATELY on the first call, then wait before allowing another execution.</p><p><strong>2. Trailing Edge Execution (Default)</strong><br> Run the function AFTER the wait period (what we’ve been doing so far).</p><p><strong>3. Cancel Method</strong><br> Ability to cancel any pending execution.</p><p><strong>4. Flush Method</strong><br> Immediately execute any pending invocation.</p><h4>The Lodash Implementation (Buckle Up)</h4><p>Here’s a simplified but production-grade version based on lodash:</p><pre>/**<br> * Creates a debounced function that delays invoking func until after <br> * wait milliseconds have elapsed since the last time the debounced <br> * function was invoked.<br> * <br> * @param {Function} func - The function to debounce<br> * @param {number} wait - Delay in milliseconds<br> * @param {Object} options - Configuration options<br> * @param {boolean} [options.leading=false] - Invoke on the leading edge<br> * @param {boolean} [options.trailing=true] - Invoke on the trailing edge<br> * <br> * @returns {Function} Debounced function with cancel and flush methods<br> */<br>function debounce(func, wait, options = {}) {<br>  let timerId = null;        // Stores the active setTimeout<br>  let lastArgs = null;       // Last arguments passed<br>  let lastThis = null;       // Last `this` context<br>  let result;                // Last result from func<br>  let lastCallTime = 0;      // Timestamp of last call<br><br>  const leading = !!options.leading;<br>  const trailing = options.trailing !== false;  // Default true<br><br>  /**<br>   * Actually invoke the function with stored context<br>   */<br>  function invoke() {<br>    result = func.apply(lastThis, lastArgs);<br>    lastArgs = lastThis = null;  // Clean up<br>    return result;<br>  }<br><br>  /**<br>   * Called when the timer completes<br>   */<br>  function timerExpired() {<br>    timerId = null;<br><br>    // Trailing call happens only if we still have arguments stored<br>    if (trailing &amp;&amp; lastArgs) {<br>      return invoke();<br>    }<br><br>    // Clean up if no trailing call<br>    lastArgs = lastThis = null;<br>  }<br><br>  /**<br>   * The actual debounced function returned to the user<br>   */<br>  function debounced(...args) {<br>    const now = Date.now();<br>    const isInvokingLeading = leading &amp;&amp; !timerId;<br><br>    // Store the arguments and context<br>    lastArgs = args;<br>    lastThis = this;<br>    lastCallTime = now;<br><br>    // Clear any existing timer and start a new one<br>    if (timerId) {<br>      clearTimeout(timerId);<br>    }<br><br>    timerId = setTimeout(timerExpired, wait);<br><br>    // Leading edge execution: run immediately on first call<br>    if (isInvokingLeading) {<br>      return invoke();<br>    }<br><br>    // Return the last result for subsequent calls<br>    return result;<br>  }<br><br>  /**<br>   * Cancel any pending invocation<br>   */<br>  debounced.cancel = function () {<br>    if (timerId) {<br>      clearTimeout(timerId);<br>    }<br>    timerId = null;<br>    lastArgs = lastThis = null;<br>  };<br><br>  /**<br>   * Immediately invoke any pending execution<br>   */<br>  debounced.flush = function () {<br>    if (!timerId) return result;<br><br>    clearTimeout(timerId);<br>    timerId = null;<br><br>    if (lastArgs) {<br>      return invoke();<br>    }<br><br>    return result;<br>  };<br><br>  return debounced;<br>}</pre><h4>Leading vs Trailing: What’s the Difference?</h4><p><strong>Trailing (default):</strong> Function runs AFTER the wait period</p><pre>const log = debounce(<br>  () =&gt; console.log(&quot;Clicked&quot;),<br>  1000,<br>  { trailing: true }  // default<br>);<br><br>// User clicks rapidly...<br>// *nothing happens*<br>// *nothing happens*  <br>// *nothing happens*<br>// *1 second after last click*<br>// Console: &quot;Clicked&quot;</pre><p><strong>Leading:</strong> Function runs IMMEDIATELY, then waits before allowing another</p><pre>const log = debounce(<br>  () =&gt; console.log(&quot;Clicked&quot;),<br>  1000,<br>  { leading: true, trailing: false }<br>);<br><br>// User clicks<br>// Console: &quot;Clicked&quot; ← IMMEDIATE!<br>// User clicks again quickly  <br>// *nothing happens* (still within 1 second)<br>// User clicks again quickly<br>// *nothing happens* (still within 1 second)<br>// *1 second passes*<br>// User clicks again<br>// Console: &quot;Clicked&quot; ← Allowed again!</pre><p><strong>Both:</strong> Run immediately, AND at the end (if there were additional calls)</p><pre>const log = debounce(<br>  () =&gt; console.log(&quot;Clicked&quot;),<br>  1000,<br>  { leading: true, trailing: true }<br>);<br><br>// User clicks<br>// Console: &quot;Clicked&quot; ← IMMEDIATE (leading)<br>// User clicks 5 more times quickly<br>// *1 second after last click*<br>// Console: &quot;Clicked&quot; ← TRAILING (because there were more calls)</pre><p><strong>Cancel: Stop Everything</strong></p><pre>const save = debounce(() =&gt; {<br>  console.log(&quot;Saving...&quot;);<br>}, 1000);<br><br>save();  // Scheduled to run in 1 second<br><br>// Oh wait, user navigated away!<br>save.cancel();  // ❌ Cancelled! Never runs.</pre><p><strong>Flush: Run It NOW</strong></p><pre>const save = debounce(() =&gt; {<br>  console.log(&quot;Saving...&quot;);<br>}, 1000);<br><br>save();  // Scheduled to run in 1 second<br><br>// User clicks &quot;Save and Exit&quot; button<br>save.flush();  // ✅ Runs IMMEDIATELY instead of waiting<br>// Console: &quot;Saving...&quot;</pre><p>If you made it this far, congratulations. Seriously. Most people would’ve rage-quit after the this keyword explanation, but you stuck around. That already puts you ahead of 90% of developers who skim articles and think they&#39;ve learned something.</p><p>Thanks for reading. If you:</p><p><strong>Found this helpful?</strong> Drop a comment with the most confusing part of debouncing you struggled with. I read every single one.</p><p><strong>Crushed your interview?</strong> Tell me about it! Success stories fuel my caffeine addiction.</p><p><strong>Still confused about something?</strong> Ask! That’s what the comments are for. Plus, your question might help someone else who’s too shy to ask.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f3a006bd590" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Open-Source Tools That Are Shockingly Powerful (And Free)]]></title>
            <link>https://medium.com/@me4saurabh4u/5-open-source-tools-that-feel-illegal-but-are-100-legal-85328a835306?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/85328a835306</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Wed, 18 Feb 2026 14:08:20 GMT</pubDate>
            <atom:updated>2026-03-15T17:44:11.849Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kp1oXpjC0hqAoV428tLgow.png" /></figure><p>There are some tools on the internet that make you stop and think:</p><p>“Wait… this is free??”</p><p>And then your brain quietly adds:</p><p>“This should not be allowed.”</p><p>But somehow, some incredibly powerful tools are open source. No paywall. No trial. No shady subscription that auto-renews at 3:17 AM.</p><p>Here are 5 open-source tools that feel illegal because of how powerful they are.</p><h3>1. Sherlock — Find Anyone’s Online Footprint in Seconds</h3><p>Type in a username. ANY username.</p><p>Sherlock will hunt it down across <strong>400+ websites</strong> in seconds — Instagram, Twitter, GitHub, Steam, TikTok, Reddit, Medium, and hundreds more you’ve never heard of.</p><p>It’s like having a private investigator in your terminal.</p><pre>sherlock target_username</pre><p><strong>🔗 </strong><a href="https://github.com/sherlock-project/sherlock"><strong>Download Sherlock</strong></a></p><p><strong>Real talk:</strong> I tested this on my own username once. Found accounts I’d forgotten I even made. It’s unsettling how thorough it is.</p><p><strong>Why it feels illegal:</strong><br> You’re essentially tracking someone’s digital footprint across the entire internet in under a minute.</p><p><strong>Why it’s not:</strong><br> All the data is public. Sherlock just automates what you could theoretically do manually by checking each site one-by-one. It’s used by journalists, investigators, and security researchers every day.</p><p><strong>The power move:</strong><br> Before you hire someone, date someone, or partner with someone — run their username. You’ll know who they really are online.</p><h3>2. Wireshark — See Every Packet on Your Network (Like X-Ray Vision)</h3><p>Ever wonder what’s <em>actually</em> happening on your WiFi network?</p><p>Wireshark shows you <strong>everything</strong>. Every packet. Every connection. Every piece of data flowing through your network — in real-time.</p><p>It’s the same tool cybersecurity professionals use to detect hackers, diagnose network problems, and investigate security breaches.</p><p><strong>🔗 </strong><a href="https://www.wireshark.org/download.html"><strong>Download Wireshark</strong></a></p><p><strong>Why it feels illegal:</strong><br> You’re literally watching data flow through the air. Seeing unencrypted passwords, website visits, app traffic — all laid bare.</p><p><strong>Why it’s not:</strong><br> It’s 100% legal to analyze traffic on <em>your own network</em>. Network admins, security teams, and developers use it daily. Just don’t use it on networks you don’t own.</p><p><strong>What you can do with it:</strong></p><ul><li>See what apps are phoning home</li><li>Catch devices hogging bandwidth</li><li>Spot suspicious connections</li><li>Learn how the internet <em>actually</em> works</li></ul><p>The interface looks complicated, but once you get it, it’s like The Matrix. You just… <em>see</em> the network.</p><h3>3. yt-dlp — Download Literally Any Video From the Internet</h3><p>YouTube. Twitter. Instagram. Vimeo. TikTok. Reddit. Facebook.</p><p>Over <strong>1,000+ sites</strong> supported.</p><p>One command downloads the video in the highest quality available — with subtitles, metadata, everything.</p><pre>yt-dlp &quot;https://example.com/video&quot;</pre><p><strong>🔗 </strong><a href="https://github.com/yt-dlp/yt-dlp"><strong>Download yt-dlp</strong></a></p><p><strong>Why it feels illegal:</strong><br> You’re bypassing platform restrictions and downloading content that “isn’t supposed” to be downloadable.</p><p><strong>Why it’s not:</strong><br> Downloading videos for personal, offline use is legal in most places. Just like recording a TV show. Don’t redistribute copyrighted content and you’re fine.</p><p><strong>The real use case:</strong><br> Archive important content before it gets deleted. Save tutorials for offline learning. Keep that one video essay you watch once a year. It’s your internet insurance policy.</p><h3>4. Meshtastic — Create Your Own Internet That Can’t Be Shut Down</h3><p>Wait, what?</p><p>Meshtastic turns cheap $30 radio devices into a <strong>decentralized, off-grid communication network</strong> that works without cell towers, WiFi, or the internet.</p><p>Text messaging. GPS sharing. Works for miles. No monthly fees. No one can shut it down.</p><p><strong>🔗 </strong><a href="https://github.com/meshtastic/firmware"><strong>Get Meshtastic</strong></a> | <a href="https://meshtastic.org/"><strong>Official Site</strong></a></p><p><strong>Why it feels illegal:</strong><br> You’re creating an untraceable communication network that governments and corporations can’t monitor or control.</p><p><strong>Why it’s not:</strong><br> It uses open radio frequencies. Completely legal. Used by hikers, preppers, and communities in areas with poor cell coverage.</p><p><strong>The kicker:</strong><br> During natural disasters when cell towers go down, people with Meshtastic devices can still communicate. It’s like having a backup internet in your pocket.</p><h3>5. Nmap — Map Any Network Like a Hacker (Because Hackers Use It)</h3><p>Want to see <em>every single device</em> on a network?</p><p>Nmap scans networks and reveals <strong>everything</strong>: every computer, phone, IoT device, open port, running service, operating system, and security vulnerability.</p><p>It’s been featured in The Matrix, Mr. Robot, and used by both security professionals and hackers worldwide.</p><p>bash</p><pre>nmap -A 192.168.1.0/24</pre><p><strong>🔗 </strong><a href="https://nmap.org/download"><strong>Download Nmap</strong></a></p><p><strong>What it does:</strong><br> You’re literally mapping the entire network infrastructure. Seeing devices people forgot existed, services running in the background, and security holes waiting to be exploited.</p><p><strong>Why it’s legal:</strong><br> It’s 100% legal to scan <em>your own network</em>. System administrators, security teams, and IT professionals use it daily. Just don’t scan networks you don’t own or have permission to test.</p><p><strong>The moment it saves your life:</strong></p><ul><li>Discovered a suspicious device on my home network stealing bandwidth</li><li>Found out my “smart” TV was sending data to 15 different servers</li><li>Identified which devices had security vulnerabilities before getting hacked</li></ul><p>I once found a neighbor accidentally connected to my WiFi. One Nmap scan showed exactly what they were doing. Problem solved in minutes.</p><h3>Use Them Responsibly (Obviously)</h3><p>Look, these tools are legal. But like any powerful tool, context matters:</p><p>✅ <strong>Do:</strong> Use on your own networks, for your own content, for legitimate purposes<br> ❌ <strong>Don’t:</strong> Spy on others, steal content, break laws</p><p>Think of them like a camera. Taking photos is legal. Stalking people with it isn’t.</p><p>Be smart. Be ethical. And if you’re not sure, don’t do it.</p><h3>The Real Question</h3><p><strong>Why are these free?</strong></p><p>Because thousands of developers worldwide believe powerful tools shouldn’t be locked behind paywalls. They donate their time building things that level the playing field.</p><p>That’s the open source philosophy: <strong>knowledge and tools for everyone</strong>.</p><p>Not just the wealthy. Not just corporations. <em>Everyone</em>.</p><h3>One Last Thing</h3><p>You now know about 5 tools most people will never discover.</p><p>The question is: what are you going to do with them?</p><p>Because power without action is just potential.</p><p>Start with one. Learn it. Use it. See what becomes possible.</p><p>And then maybe — just maybe — you’ll understand why open source people are so obsessed with this stuff.</p><p>It’s not just about free software.</p><p>It’s about freedom.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85328a835306" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The console.log Trick That Senior Developers Don't Want You to Know]]></title>
            <link>https://javascript.plainenglish.io/agethe-console-log-trick-that-senior-developers-dont-want-you-to-know-af66d61eda99?source=rss-ce1ec0301cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/af66d61eda99</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[devtools]]></category>
            <dc:creator><![CDATA[Saurabh Raj]]></dc:creator>
            <pubDate>Sun, 08 Feb 2026 08:00:43 GMT</pubDate>
            <atom:updated>2026-02-18T14:22:59.028Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*f5RPtqQco87gAey7GrG3fA.png" /></figure><p>Okay, I’ll be honest — senior developers absolutely want you to know this. In fact, they’ve been using it for years, while the rest of us have been cluttering our code with console.log(&quot;here&quot;), console.log(&quot;here2&quot;), and the classic console.log(&quot;aaaaaa&quot;).</p><p>These techniques will transform you from someone who debugs by trial and error into a developer who pinpoints issues with surgical precision. Master these, and you’ll be the one your team turns to when something breaks in production.</p><h3>1. The Game-Changer: Computed Property Names</h3><p>Stop doing this:</p><pre>const user = { name: &quot;Alice&quot;, age: 30 };<br>const product = { id: 123, price: 49.99 };<br><br>console.log(&quot;user&quot;, user);<br>console.log(&quot;product&quot;, product);</pre><p>Start doing this:</p><pre>console.log({ user, product });</pre><p><strong>Why this matters:</strong> Using ES6 shorthand object syntax wraps your variables in an object, so you instantly see both the variable name AND its value in the console. No more guessing which log corresponds to which variable when you have 20 of them.</p><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*AeyvDEf2FHDSYBOwp8caTA.png" /></figure><h3>2. The Secret Weapon: console.table()</h3><p>When you’re dealing with arrays of objects, console.log is virtually useless. Try this instead:</p><pre>const users = [<br>  { name: &quot;Alice&quot;, age: 30, role: &quot;Admin&quot; },<br>  { name: &quot;Bob&quot;, age: 25, role: &quot;User&quot; },<br>  { name: &quot;Charlie&quot;, age: 35, role: &quot;Moderator&quot; }<br>];<br><br>console.table(users);</pre><p>This renders a beautiful, sortable table in your browser console. You can click column headers to sort, and it’s infinitely more readable than a nested object dump. I’ve seen this single technique cut debugging time in half for data-heavy applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K7-3ecbJsVVsAmclA5WUtw.png" /></figure><h3>3. The Stack Trace Shortcut: console.trace()</h3><p>Ever wonder “how did I even get here?” when your function gets called from multiple places?</p><pre>function processPayment(amount) {<br>    function innerFn() {<br>        console.trace(&quot;Payment processing started&quot;);<br>    }<br><br>    innerFn()<br>}<br><br>processPayment(20)</pre><p>console.trace() prints the full call stack, showing you the exact path the code took to reach that point. This is absolutely crucial when debugging complex applications where a function might be called from 5 different places.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GPvSyu4BUX3mUSOJlTxxnA.png" /></figure><h3>4. The Conditional Breakpoint: console.assert()</h3><p>Instead of wrapping your logs in if statements:</p><pre>if (user.age &lt; 18) {<br>  console.log(&quot;Underage user detected!&quot;);<br>}</pre><p>Use this:</p><pre>console.assert(user.age &gt;= 18, &quot;Underage user detected!&quot;, user);</pre><p>It only logs when the assertion fails (when the condition is false). Cleaner code, less noise in your console, and it includes the actual data automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mPUnAbRwNggrxjIzF6eHLw.png" /></figure><h3>5. The Performance Monitor: console.time()</h3><p>Stop guessing how long your code takes to run:</p><pre>console.time(&quot;API Call&quot;);<br><br>fetch(&quot;https://api.example.com/data&quot;)<br>  .then(response =&gt; response.json())<br>  .then(data =&gt; {<br>    console.timeEnd(&quot;API Call&quot;);<br>    return data;<br>  });<br><br>console.timeEnd(&quot;API Call&quot;);</pre><p>This tells you exactly how many milliseconds elapsed between console.time() and console.timeEnd(). I use this constantly for comparing different implementations or finding performance bottlenecks.</p><p><strong>Output:</strong></p><pre>API Call: 342.87ms</pre><h3>6. The Styled Logger: CSS in Console</h3><p>Make your important logs impossible to miss:</p><pre>console.log(<br>  &quot;%c🚨 CRITICAL ERROR&quot;, <br>  &quot;color: red; font-size: 20px; font-weight: bold; background: yellow; padding: 10px;&quot;<br>);</pre><p>You can add CSS styling to console logs using %c. This is perfect for:</p><ul><li>Error states that need immediate attention</li><li>Success messages in development</li><li>Separating sections of complex debugging output</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ATbrCGv2O0GV9oKBCbG1rw.png" /></figure><h3>7. The Group Organizer: console.group()</h3><p>When you have related logs, group them:</p><pre>console.group(&quot;User Authentication&quot;);<br>console.log(&quot;Checking credentials...&quot;);<br>console.log(&quot;Token:&quot;, token);<br>console.log(&quot;Validating...&quot;);<br>console.groupEnd();<br><br>console.group(&quot;API Response&quot;);<br>console.log(&quot;Status:&quot;, response.status);<br>console.log(&quot;Data:&quot;, response.data);<br>console.groupEnd();</pre><p>This creates collapsible groups in your console, making it dramatically easier to navigate through lots of debug output. Use console.groupCollapsed() if you want groups collapsed by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CJjLckInrSeOyfRx9xx53A.png" /></figure><h3>8. The Object Deep Dive: console.dir()</h3><p>For DOM elements or objects with special properties:</p><pre>const element = document.querySelector(&quot;#myButton&quot;);<br><br>console.log(element);  // Shows HTML representation<br>console.dir(element);  // Shows object properties</pre><p>console.dir() displays an interactive list of object properties, which is especially useful for DOM elements where you want to inspect methods and properties rather than the HTML structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Zh35Jqfuqa0n27twOtuVw.png" /></figure><h3>9. The Log Level Hierarchy: Using the Right Tool</h3><p>Stop using console.log() for everything. JavaScript gives you different log levels for a reason:</p><pre>console.log(&quot;Regular information&quot;);      // General info<br>console.info(&quot;ℹ️ User logged in&quot;);       // Informational messages<br>console.warn(&quot;⚠️ API rate limit at 80%&quot;); // Warnings<br>console.error(&quot;❌ Payment failed&quot;);       // Errors<br>console.debug(&quot;🔍 Variable state:&quot;, x);   // Debug info</pre><p><strong>Why this matters:</strong> Modern browser DevTools let you filter by log level. When debugging in production, you can hide all console.log and console.debug statements and only see warnings and errors. This makes critical issues impossible to miss in a sea of debug output.</p><h3>10. The DevTools Secret Weapons: 0, $ , and More</h3><p>These magical shortcuts only work in browser DevTools console, but they’re absolute game-changers:</p><h3>$0 — The Last Selected Element</h3><p>Click on any element in the Elements tab, then switch to Console:</p><pre>$0 // References the currently selected element<br>$0.style.backgroundColor = &#39;red&#39;;<br>$0.classList.add(&#39;highlight&#39;);</pre><p>Even better: $1, $2, $3, $4 references the last 5 selected elements. Perfect for comparing or manipulating multiple elements quickly.</p><h3>$$ — The Superior Selector</h3><p>Forget document.querySelectorAll():</p><pre>// Instead of this:<br>Array.from(document.querySelectorAll(&#39;.product-card&#39;))<br>  .forEach(card =&gt; console.log(card.textContent));<br><br>// Use this:<br>$$(&#39;.product-card&#39;).forEach(card =&gt; console.log(card.textContent));</pre><p>$$() returns a real array (not a NodeList), so you get all array methods immediately. No more Array.from() wrapper.</p><h3>$ — Quick querySelector</h3><pre>$(&#39;#header&#39;)           // document.querySelector(&#39;#header&#39;)<br>$(&#39;.btn-primary&#39;)      // document.querySelector(&#39;.btn-primary&#39;)</pre><p><strong>Note:</strong> This only works if jQuery isn’t loaded. If jQuery is present, $ is jQuery.</p><h3>$_ — The Last Result</h3><pre>2 + 2<br>// 4<br><br>$_ * 10<br>// 40</pre><p>$_ stores the result of the last expression evaluated in the console. Incredibly useful for chaining operations without re-typing.</p><h3>copy() — Instant Clipboard</h3><pre>const data = { users: [...], products: [...] };<br>copy(data);<br>// Copied to clipboard as formatted JSON!</pre><p>No more right-clicking and “Copy object” or trying to stringify and select text. Just copy(anything) and it&#39;s on your clipboard.</p><h3>getEventListeners() — Event Inspector</h3><pre>getEventListeners($0)<br>// Shows ALL event listeners attached to the selected element<br><br>// Example output:<br>// {<br>//   click: [{ listener: ƒ, useCapture: false, passive: false }],<br>//   mouseenter: [{ listener: ƒ, useCapture: false, passive: true }]<br>// }</pre><p>This is invaluable for debugging event handler issues or finding memory leaks from unremoved listeners.</p><h3>The Bonus: Live Expression Watch (Chrome DevTools)</h3><p>This isn’t technically a console method, but it’s game-changing. In Chrome DevTools, you can create “Live Expressions” that constantly update as your code runs.</p><ol><li>Open Chrome DevTools</li><li>Click the “eye” icon in the Console tab</li><li>Type any JavaScript expression: user.isAuthenticated, cart.items.length, etc.</li></ol><p>It stays pinned at the top of your console and updates in real-time. Perfect for watching state changes without flooding your console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*IPO-UVyAqU5dRYQJxWEFEg.png" /></figure><h3>Conclusion</h3><p>I spent years thinking console.log() was just for printing text. These techniques transformed debugging from a frustrating guessing game into a precise, efficient process.</p><p>The real secret senior developers know? <strong>The right debugging technique saves you hours of trial and error.</strong> Master these tools, and you’ll spend less time adding logs and more time actually fixing bugs.</p><p>Next time you’re debugging, try replacing all your plain console.log statements with these techniques. Your future self (and your code reviewers) will thank you.</p><p><em>What’s your favorite console trick? Drop it in the comments — I’m always looking to level up my debugging game.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af66d61eda99" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/agethe-console-log-trick-that-senior-developers-dont-want-you-to-know-af66d61eda99">The console.log Trick That Senior Developers Don&#39;t Want You to Know</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>