Skip to content
  • Home
  • Articles
  • Screencasts
  • Projects
  • About
  • Resources
  • Screencasts
  • Today I learned
  • Things I use
  • Talks
  • Newsletter
  • Home Home
  • Articles Articles
  • Screencasts Screencasts
  • Projects Projects
  • About About
  • Other Stuff
    • Blogroll People blogging great stuff.
    • Resources Bookmarks I want to keep for later.
    • Show some love Support my blog and newsletter.
    • Talks Talks I've given at conferences.
    • Things I use My hardware and software setup.
    • Today I learned 247 #TIL posts.
  • Newsletter
Stefan on LinkedIn Stefan on Mastodon Stefan on Bluesky RSS

Snippets โ€“ Page 3

Make magical things happen with a few lines
  1. How to remove all event listeners from a DOM element

    Published Aug 18 2023 in JavaScript

    Learn how to replace all on a DOM element registered event listeners by replacing it with a clone of itself.

  2. Copy an array and replace one element at a specific index with modern JavaScript

    Published Aug 10 2023 in JavaScript

    Use Array.with to copy an array and update a single entry while doing it.

  3. Make a PDF look like it was manually scanned

    Published Mar 17 2023 in Bash

    Learn how to use imagemagick to change sharp PDFs to look like they've been scanned manually.

  4. A userland React hook for managing global state

    Published Feb 18 2023 in React

    A snippet to share state across React components without a state management library but with a short useGlobalState hook.

  5. How to fail function calls with undefined arguments with a one-liner (sorta)

    Published Jan 30 2023 in JavaScript

    Learn how to throw errors in JavaScript function default parameters by shuffling some code around.

More articles

  1. Previous page
  2. Page 3 of 14
  3. Next page

Most popular posts

  • The difference between @ts-ignore and @ts-expect-error
  • Can we have custom media queries, please?
  • How to import JSON files in ES modules (Node.js)
  • Web content, the social contract and copyrights
  • On being a "JavaScript framework developer"...
Read popular posts

Weekly newsletter

Weekly newsletter all around web development

Get weekly news

TIL: Today I learned in Web Dev

  • Node.js supports import maps
  • Forbidden headers can't be set in "fetch" requests
  • The macOS inline dictionary has a shortcut
Learn something new

Blogroll

5 random Sites I'm subscribed to via RSS. ๐Ÿ‘‡

  • Eric Bailey
  • Adrian Roselli
  • Manuel Matuzovic
  • Jim Nielsen
  • Malte Ubl
Discover more blogs

Other stuff

Topics

  • JavaScript (128 posts)
  • CSS (99 posts)
  • Tools (61 posts)
  • HTML (54 posts)
  • Bash (44 posts)
  • NodeJS (39 posts)
  • Accessibility (35 posts)
  • Web (30 posts)
  • git (23 posts)
  • Performance (20 posts)
  • VSCode (20 posts)

Random Web Dev Learnings

  • A preceding space prevents dangerous commands from going into history
  • Elements with overflow: hidden are scrollable
  • Error catch-bindings are finally optional
  • A "section" without an accessible name is nothing but a "div"
  • Downloads can be triggered via HTTP headers
  • How to open a local file from the URL bar in VS Code

Popular articles

  • The difference between @ts-ignore and @ts-expect-error
  • Can we have custom media queries, please?
  • How to import JSON files in ES modules (Node.js)

Recently updated resources

  • Staying up to date
  • Writing good docs, blogs and technical articles
  • Public speaking

stefanjudis.com ยฉ 2025 by Stefan Judis is licensed under CC BY-NC-SA 4.0

All rights reserved and content created without AI.

โ™ฅ๏ธ