Blog Articles
First Post with Sanity.io
My first post in Sanity.io's Content Lake. Created with Sanity Studio.
Bash to initialize a project
Most of the time I start an experiment/idea with an empty directory. So I've got a couple bash programs to help "upgrade" those stubs into a full project. You may find it useful.
Invest in Yourself
... not some company's thrash machine.
Create Dynamic Open Graph Images from HTML and CSS
Using HTML and CSS, my server dynamically creates og:image assets for any given blog article. A special HTTP Node.js Lambda creates them on demand and CloudFront caches them for ultra-fast response times. Powered by Satori and resvg-js.
Automating My robots.txt to Block AI User Agents
darkvisitors.com provides a nice list of known AI scraper agents. I'm automatically updating my site's /robots.txt
AWS Bedrock with aws-lite
Connect to AWS Bedrock with the latest release of aws-lite. In less than 50 lines, we'll be able to select a model and send a query.
Compare Node.js Module Sizes With a CLI
While there are many ways to analyze ./node_modules, I use a CLI utility from npm called howfat to compare package install sizes. This is very helpful to keep total project size down and my dependency graph simpler.
Quick Color Functions for a Node.js CLI
Here are a few functions for adding color to CLI output while respecting the NO_COLOR env variable.
Super Helpful: Server-Timing HTTP Response Headers
TIL about the Server-Timing header and the accompanying browser dev tools feature. So I built a quick helper to create and transmit performance timers.
Easy Confirmation Prompt for Node.js CLI Script
Prompt the user if they'd like to continue when executing a Node.js script from the command line.
Check If Node.js File is Imported or Run as CLI
How to check if a Node.js (ESM) program is being executed on the command line or when imported by a Node.js process.
vendurl: Vendor Packages from a URL to Your Node.js Project
Some libraries are not available on npm or not published in a way you'd like to consume. Vendor them to your project from a URL with vendurl.
HTML-First Web Dev Learning Path
How I'd teach a newcomer to build for the web.
Add htmx to an Enhance Project
Use Enhance @bundles to include htmx and make it available to all of your app's web components.
Get a random record from 126K lines of JSON
How I put a 76MB file in a Lambda and grab a random line without loading the whole thing into memory.