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.
67 TILs so far!
Recent TILs
- typescript
Add custom element to JSX.IntrinsicElements
As of version 19, React supports custom elements!
- html
Define a custom element
I've been using web components for a bit, and I've accrued a bit of code I generally use as a base for my custom elements. "Boilerplate" has a negative connotation, so let's just call it a "web component starter kit".
- javascript
Programmatically create SVG elements
This is simple, but it tripped me up for a bit. TL;DR you can't do this:
- css
Anchor scroll position to the bottom
Recently, I was building a vertical "timeline" for an explorable explanation, in which new elements would be added below any existing ones. As elements were added, I wanted the scroll position anchored to the bottom of the timeline, as it would be in a chat app.
- nextjs
Don't server-side render a client component
React Server Components splits React components into two kinds: server components and client components.
- volta
Install Volta with Homebrew
It seems so easy: just
brew install volta
and you have a modern Node version manager ready to go! - 1password
Use specific SSH keys
One reason I use 1Password over Apple Passwords is that it also manages your SSH keys.
- css
Swap between black and white text based on background color
The title is overselling it a little, but not by much. Devon Govett posted this clever trick on Bluesky using CSS relative colors and LCH:
- systemd
Set up a basic service
I use systemd pretty infrequently, so whenever I need to stand up some persistent process on a server I spend a bunch of time looking things up again. Hence: this TIL!
- 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.