A nice way to kill Tmux sessions is from the Tmux session tree. This is the list of sessions you may already use, accessible by hitting <leader> s. Navigate the tree with hj. When you find the session you want to kill, hit x and then confirm the kill with y. Note: when you do choose your current session from the list, that closes your Tmux session and you’re back out in the cold.
Serving With Vercel's Serve
When I’m building an index.html or anything else particularly simple, I like to spin up a web server with Vercel’s serve package. It’s this easy: npx serve . Your HTML file, scripts, and stylesheets will be available on port 3000. You can serve on another port if 3000 is taken, which is frequently true on my machine: npx serve . -l 3001 The package chooses a free port in this case, flag or not, so there’s never a conflict. ...
First Letter Capitalization with CSS
I like to decouple data from its visual presentation whenever I can. So, if I get “basketball Game”, “basketBall game”, or “BASKETBALL GAME” from an API, and I want it displayed sentence-style as “Basketball game” without any scripting, how do I do that? You might try this: h1 { text-transform: capitalize; } However, this turns “basketball game” into “Basketball Game” with a capitalized “G”. This violates Microsoft’s sentence-capitalization style, and it’s not what I want. Here’s how you transform any capitalization to sentence-style. ...
Programming "Zero" in Strudel
Today I programmed a song with Strudel, a JavaScript DSL for making music. Here’s my first program, attempting to play the introduction to “Zero” by The Smashing Pumpkins. const ratchet = register('ratchet', (pat) => pat.sometimes(ply(2))) setcpm(60 / 4); const lead = "59 58 58 51 51 51 51 59@2 58 58 51 51 51 51 51"; $: note(lead).sound("sawtooth").gain(0.5); $: note(lead).transpose(-12).sound('sawtooth').gain(0.5); $: note("~ ~ ~ 82 79 75 ~ ~ ~ ~ ~ 82 79 75 ~ ~") .transpose(12) .sound('sawtooth') .gain(0.5); $: s("[bd bd] ~ [bd bd] ~, ~ sd ~ sd, oh*4").fast(2).gain(0.6); $: s("<cr ~>").fast(2).gain(0.6); A couple of things I learned while writing this: ...
Alias a Function in JavaScript
While simple, today I used this trick to write the code I wanted. Variable assignment of a function is a valid, communicative way to alias a function in JavaScript. const clearFilters = () => setFilters({}); // Use the same behavior when starting a new search. const startNewSearch = clearFilters; // These create the same result. clearFilters(); startNewSearch(); In this case, calling clearFilters didn’t fit with a click handler on a button labeled “Start New Search.” With this technique, was able to call the function I wanted, abstracting its implementation.
Dash for Pairing
I’ve written about Kapeli Dash before: it’s a Mac program that lets you download sets of documentation to your computer. This week I discovered a killer use case: pair-programming. Recently I was pairing in a domain I didn’t know well. Before the session, I loaded Dash with every docset I thought I might need. So, for Python, think: Python, Django, and SaltStack, plus React and TailwindCSS for the frontend. When we needed docs, we could effortlessly explore these resources without Googling. Opening a browser while a pairing can be distracting (Banner ads! AI summary!), it can expose your personal information, and is a bit more clumsy when you know what you need. I can find React’s useMemo docs by typing useMemo into Dash and hitting enter— that’s it. There’s no path to that resource online that’s as direct as that. ...
Make Videos Play at Any Speed
When consuming educational materials, I often want to watch faster than the player permits. 2x seems to be an upper limit on many platforms, and that makes sense; 2x can be pretty fast. For material that’s review, I want to go even faster, like 2.5x. Here’s how I bypass this artificial constraint: open developer tools and ensure that the video HTML entity is in scope. You might have to scroll down to it, or highlight it with the element selector. Then, type this into the developer tools console: ...
Disabling Paste Doesn't Prevent Text Entry
This week I had a fascinating conversation about disabling paste into a text input. You might see this UX pattern when a form requires a user to type “confirm” before taking an action. I believe it’s a UX anti-pattern. It breaks an expected behavior of a web form without an obvious benefit. What I learned is that even if it were good practice, you can’t reliably enforce manual typing anyway. ...
Gradle Test Continuous
Running tests in a watch mode encourages test-first thinking and creates a virtuous cycle. Here’s the command to run a Gradle Wrapper (Java) test suite in watch mode: ./gradlew test --continuous Gradle calls this a “continuous build.” It runs when tests or files under test change. Continuous Builds – Gradle Docs
Dropping Images into Keynote
Today I uncovered a nice hack for building a product demo. I had a bunch of Cleanshot screenshots I wanted to present in a Keynote slideshow. If you select all your screenshots and drop them into the left-hand slide navbar on Mac Keynote, each one becomes its own slide in the deck. This let me create a polished presentation in about five total minutes of work, including collecting the screenshots.