TIL

TIL

Fixing type errors with Vite, vitest, and one’s UserConfig

I find myself in JavaScript codebases with Vite and vitest often enough that I’ve fixed and forgotten how to fix this error.

TIL

Redirecting Shopify users after signing out via Auth0

Shopify Plus subscribers gain access to OIDC support with which their customers can authentication using Auth0.

TIL

Auth0 strategies

When provisioning Auth0 connections (especially via Terraform), it’s particularly useful knowing the set of supported strategies.

TIL

Local Rust docs with Nixpkgs and Fenix

The Rust ecosystem has a nifty trick for opening documentation locally, but when managing Rust with Nix, we’re missing one important piece in the toolchain.

TIL

Astro tracks me

Opting out of Astro’s telemetry and third-party tooling toolbar is a little more tricky thanks to the new bespoke preferences system.

TIL

Colourful Emacs messages

When displaying a little message to help understand why my code doesn’t work, a little colour can go a long way to breaking up a lengthy line.

TIL

Processes from Emacs

Keeping everything in Emacs opens up a world of possibilities, combined with a freedom found less and less in our virtual spaces. With this quick trick, you can run your (non-interactive) development processes displayed in a buffer as a child process of Emacs itself.

TIL

WET Astro headings

Producing headings in a reproducible way with Tailwind and Astro requires some hoop jumping. To save you from solving the same problem in your own codebase, I share a monstrously messy Astro component I use on this very website to produce consistent headings with little effort.

TIL

Astro can’t find Sharp

The upgrade to Astro 4 has been painless, but the same simple issues come up enough that I thought I’d document the fix for anyone else encountering similarly sticky spots.

TIL

Ordinals in JavaScript

If you search for a way to format numbers into their ordinal representation (e.g. 1 becomes 1st, 2 becomes 2nd), you might come across hand-minified algorithms that inspire, but there’s a widely available API that you almost certainly should be using instead.

TIL

Global (ZSH) aliases are magic

If you pipe all of your commands into Emacs buffers, or build all of your software in an IDE, you might not have use for ZSH’s delightful global aliases, but as someone who’s often cutting and splicing text, these little tricks come in extremely handy.

TIL

Legible jq colours

I have a fancy Terminal emulator that switches between a light and dark theme as the sun moves overhead. This feels easier on the eyes, but poses a challenge with colourised output from the plethora of tools and hacky scripts I tinker with daily.

TIL

GitHub anniversary

While reviewing the set of maintainers in the Home Manager repo, I noticed each attribute list included a GitHub user ID.

TIL

Rust with flake.parts

Installing a Rust toolchain with Nix and Fenix is simple but there’s a small hoop to jump through as soon as you move to the more modern approach provided by flake.parts.

TIL

Abusing microformats to test HTML

Testing semantic markup can prove tedious with complex selectors and fragile tests. Littering the code with “js”-prefixed classes is no better to the discerning craftsperson.

TIL

Clojure test system

I recently found myself working on a Clojure codebase and needed to resurrect a pattern that’s served me well in large Clojure codebases for close to a decade.

TIL

Wave function collapse

My mind went to probabilities and subatomic wave packets when I heard wave function collapse, but it turns out there’s a novel algorithm that borrows ideas from entropy to generate random outputs.

TIL

Read while table

Parsing strings can be made easier with liberal use of Bash’s builtins, which comes in especially handy when documenting things like APIs in Org-mode.

TIL

Configuring a colourful Logback

Logging colourful output came up recently in project I was working on. Here’s how I typically configure logging from my Clojure codebases with a little colour on top.

TIL

When LSP gets lost

A quick win that has saved me minutes of searching online documentation while I’m deep in a Ruby codebase is combining the power of a language server with predecessors like Robe.

TIL

Removing colour from the colourless

Considerate use of colour can help paint a picture on the command line, but when a tool doesn’t support the requisite ANSI codes output becomes garbled beyond recognition.

TIL

Visualising redirects with Org mode

I often find myself testing and documenting things from Org mode, and have a cool trick one can use to peek at reponse headers from a source block.

TIL

Indenting HTML is awful

When I first started writing code it was in Notepad on Windows. I’ve still not forgiven Microsoft.

TIL

Formatting Ruby with Doomed LSP

I’ve found myself writing a lot more Ruby than expected recently, and waiting on Rubocop to tell me my code is bad enough that I can’t ship my work. Something had to be done.

TIL

Delightful Astro components

Astro components come in many shapes and sizes. This is one of my favourites.

TIL

Specifying OmniAuth

Authentication in a Ruby on Rails application is a problem well-served by libraries like Devise, but the requirement for authentication via a third party comes up in most cases.

TIL

Embedding Python embeddings

While Python sees the most significant investment by the machine-learning community in the 2020s, the foundations of AI were symbolic and largely Lisp-based. Many have attempted to explain this progression, and while history is always fascinating, today’s learning comes from wanting a better language than Python that can benefit from all the brilliant work being done by the snake-loving masochists.

TIL

PostgreSQL, vectors, and Clojure

Like every other startup, I’m adding vectors and embeddings to all of my products to capitalise on the cumulative creative efforts of humanity.

TIL

Extracting nodes from namespaced XML

While most developers deride XML, opting instead for a subset of the second-most scolded language on the planet, sitemaps and Java tools still depend on this pointy format.

TIL

Incrementing dates in Python

When everything is text, one spends 50% of their time parsing strings and the other 50% fixing errors produced by representing everything as text.

TIL

Tables of files with Org mode

Literate programming is a superb way of encoding knowledge in a collaboration with a machine, and Org mode is one of the best environments for interacting with text and images out there.

TIL

Lite System configuration

Having moved away from Ansible to configuring my macOS environment with nix-darwin and Home Manager, I found myself wanting to DRY up the Flake entrypoint to my many hosts.

TIL

Rest in peace, statistical mechanics

A big part of my Physics education was based on statistical mechanics and the work of the Austrian Physicist, Ludwig Boltzman.

TIL

When pkg won’t update

As part of the upgrades handed down to me by the FreeBSD/TrueNAS teams, I ran into a strange issue where pkg was trying to install things from a very-end-of-life package repository, regardless of my configured repositories.

TIL

Silencing the message of the day

It appears things have changed in FreeBSD 13, and the venerable motd has had a facelift.

TIL

Creating CLIs with sub

Some time ago, I wanted to add a custom CLI to my ~/.config/box project, where I automated the configuration of various computers with a boatload of YAML on top of Ansible.

TIL

System appearance in Emacs on macOS

More and more applications offer an automatic switch from light mode to dark mode as your plot on Spaceship Earth turns its back on the sun. In “modern” applications, these comforts are commonplace, but a little work is required to upgrade software older than any dog, cat, and most millennials.

TIL

Flake.parts and unfree packages

I’m making use of Nix to manage a slew of Clojure and Python dependencies for an upcoming article, and I decided I’d replace flake-utils with flake.parts as part of my ongoing yak-shaving duties.

TIL

Finding project files in Emacs

When I find myself repeating the same operations over and over, it’s time to timebox some automation to preserev my meaty appendages.

TIL

Stable scrollbars

When flying around a website with pages of varying heights, you may notice elements jumping about without apparent cause. I was perplexed until I realised the problem stemmed from invisible scrollbars.

TIL

Blocking a domain with Adguard

As part of my Kagi subscription, I must use their Safari Web Extension to redirect search requests to their website. A recent update to their extension broke the redirect, meaning a good proportion of my search traffic leaked my data even more than usual.

TIL

Scheduling a deployment to Vercel

If your static site is a function of time, triggering a build at regular intervals can ensure things remain fresh.

TIL

Removing backticks from Tailwind Typography

Out-of-the-box inline code is wrapped in backticks, much like the Markdown that probably produced it.

TIL

Installing aspell dictionaries with Nixpkgs

One might assume installing aspell and associated dictionaries with Nixpkgs can be accomplished using the familiar approach of listing desired packages.