Welcome!
My repository of things I've learned. Mostly programming related. Part microblog, part knowledge base, part digital garden. If you like this, you might enjoy my blog.
58 TILs so far!
Recent TILs
- math Check whether an angle is between two other angles
Weirdly, I've had to do this a lot recently: given an angle, determine whether it's bounded by two other angles. Technically, this is always true — just go the other direction around the circle — but usually I care about going in a particular direction.
- git Update all submodules to latest commit on origin
I use Git submodules in a bunch of projects, and one common task is checking out the latest commit on the origin.
- entr Reload a webpage when a file changes
I store my blog in a git repo of plain Markdown files. It's a pretty spartan setup, which I like — it forces me to keep all my writing extremely portable between website generators.
- prosemirror Prevent extra whitespace in NodeViews
While trying to build a ProseMirror
NodeView
using a Shoelace dropdown, I kept getting a ton of extra vertical space around the dropdown trigger. - django Conditionally extend a template
Django supports template inheritance via the
extends
tag. Often, a template inheritance chain follows all the way up to a "base" template that contains the full markup for a page, from the doctype to the closing HTML tag. - prosemirror Use a Svelte component as a NodeView
The ProseMirror rich text editor library has a concept called
NodeView
for rendering custom widgets with a document. - svelte Force reactive state to reevaluate
In Svelte 5, you declare a reactive variable using the
$state
rune. - git Ignore all .DS_Store files
If you use git on a Mac, chances are you've accidentally committed a
.DS_Store
to a repo. I used to reflexively add.DS_Store
to all my.gitignore
files to avoid ever repeating that mistake. - logic Send stereo output through specific output channels
This probably works for many audio interfaces, though in this case I'm using a Quad Cortex. When I have my interface hooked up to Logic Pro, I want to route stereo output to the specific output channels that are connected to my speakers.
- caddy Serve Markdown files as HTML
Caddy is a simple web server that nonetheless has a bunch of cool features. One example is pre-processing responses using Go's
text/template
package.