JavaScript Reflection Preserves Comments

In JavaScript reflection with .toString(), comments are preserved. const hello = () => { // returns "Hello" return 'Hello'; }; hello.toString(); // '() => {\r // returns "Hello"\r return "Hello";\r}' Note the comment in the returned string.

September 9, 2026

Call a Git Hook on Demand

Git hooks are scripts that run at key moments in the version-control lifecycle. And, they’re just scripts! So we can call them when we want. <shell> <hook> For me in this project (Zsh + Husky), this could look like: zsh .husky/pre-commit This runs my pre-commit script anytime.

September 4, 2026

Building a Pitchfork-Style Loading Skeleton

Today, after waiting for an album review to load, I built something small: my own take on the Pitchfork aggregate review loading experience. Pitchfork uses a Skeleton-style UI while returning an album’s aggregate review, such as “8.0” for Mastodon’s Crack the Skye. Skeleton UIs show you something, like blurred text or a flashing bar, to build anticipation and fill out the page while in a loading state. They are a fantastic UX touch for the right kind of app and data. In the case of the Pitchfork app, the aggregate review is a pivotal piece of information about an album, and is presumably being calculated on demand, so this choice makes sense. ...

September 2, 2026

Link to Local Package With npm link

When developing a local Node module, we might want to point another project’s package.json at the local module. Here’s how you do that. First, change directory to your local module and run npm link: cd ~/code/my-module npm link This creates a global symlink pointing at your module: npm ls -g --depth=0 --link /opt/homebrew/lib └── my-module@1.0.0 -> ./../../../Users/jake/code/my-module Then, change directory into the place you want to install the module and link the package: ...

September 2, 2026

tsc watch script

Today I learned what tsc --watch is really for. You put it into your package.json as a script. // package.json { "scripts": { "watch": "tsc --watch" } } This lets us to build a TypeScript project on write: npm run watch With every change, we get a new dist/index.js. This an essential tool for quickly developing a TypeScript Node module. See tsc --help for more info.

September 1, 2026

Read lpr Configuration

I’ve written about lpr before; to me the ability to send a file to my printer from the command line is a magic trick. What if I want to know where the file is going to go before sending it? lpr’s docs say: The LPDEST and PRINTER environment variables are consulted first. If neither are set, the current default set using the lpoptions(1) command is used, followed by the default set using the lpadmin(8) command. ...

August 31, 2026

Hugo Markdown-Reading Shortcode

Today I built a system to read a markdown file from one location in my Hugo project into another. It has two parts, a shortcode that reads an argument and parses it as markdown: <!-- layouts/shortcodes/include-markdown.html --> {{ readFile (.Get 0) | markdownify }} And using that shortcode: <!-- about.md --> {{< include-markdown "doc/about-content.md" >}} This lets me put a file into docs/ and read it into my template, a handy way to reduce duplication in my app. ...

August 31, 2026

Don't Use npm init on an Existing Project

npm init is a nice tool for initializing a package.json. Today I learned that you should not use it on an existing JavaScript project! This blog is a Go project, but I use JavaScript dependencies for development. My manifest looks like this: // package.json { "scripts": { "test:e2e": "cypress run", "push": "npm run test:e2e && git push" }, "devDependencies": { "cypress": "^15.20.1", "prettier": "^3.8.3" }, "allowScripts": { "cypress@15.20.1": true } } I thought I could get away with running npm init on it to standardize the file. When I did, the program looked in my node_modules directory and saw ~170 dependencies, most belonging to Cypress. ...

August 25, 2026

Favorite TypeScript Learnings from TypeNotes

This Summer I wrote a number of blog posts for my TypeNotes project. Here are a few things I learned about TypeScript that were worth revisiting. Path aliases in TypeScript Use cases for JavaScript loose equality (==) Inspecting TypeScript’s inferred types Why TypeScript error codes aren’t documented Here is a summary of each thing I learned. Path Aliases in TypeScript Path aliases are the modern way to do aliases and they are worth adopting on your team. ...

August 24, 2026

Open Source Icons via Lucite

Something I put off until a bit into a personal project is adding an icon library. But, it’s essential to a good user experience. With Lucite there’s a fantastic open source option that’s easy to use. Add it to a React project like this: npm install lucide-react And then you’re ready to go: import {Camera} from 'lucide-react'; const App = () => { return <Camera />; }; export default App; No more hacky iconography in my MVPs. ...

August 23, 2026