Weeknotes 40
3rd April, 2022
“Less work. More learning.”
-
It would be really nice if I could mark certain repos/organisations on GitHub as “work” and turn off notifications for those over the weekend. Is it possible without a separate account?
-
Nice tip for making doctests easier to write:
TIL Elixir’s doctests support an
import: true
flag so that you don’t have to write out the full module name in your doctests.When I last wrote some Elixir doctests I remember this being a problem. I would often have modules nested several layers deep which made referencing them in the test difficult.
-
CodeEdit, a new code editor for macOS – not yet released.
However, comparable editors are built on Electron. This is a huge limitation because it cannot utilize all system resources to its fullest potential.
Shots fired, but not wrong. Electron is used for a lot of reasons, but performance isn’t one of them.
-
Why we chose NanoIDs for PlanetScale’s API – this is the first time I’ve heard about NanoIDs. Basically, a more URL-friendly alternative to UUIDs, which tend to be cumbersome and ugly.
Most of the systems I’ve used still use auto-incrementing integers for database records, and sometimes a UUID against the record that can be shared more readily between front and back ends where an identifier needs to be passed into another system.
The idea of an identifier in a system having a collision terrifies me. But as you can see from the Nano ID Collision Calculator the probability is actually much less than I anticipated.
For example, if you create 1000 IDs per second, using this alphabet -
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
- at 21 characters long, the probability of having a collision is 1% in ~30 million years. Those odds seem good.And as well as the JavaScript support, there are also client libraries for Ruby, Rust, and Elixir.
I’ve read quite a lot of criticism of NanoIDs, some of it fair, but an awful lot seemed to miss the main selling point, readability.
-
Maybe you should do less ‘work’ by John Whiles – I mean, maybe? This is the sort of thing a lot of people do, but never talk about.
-
Learning at work by Julia Evans. Related to the above.
My view is that it’s my job to take time out of my workday to learn things.
You shouldn’t be expected to learn everything outside of work, when the work is constant learning.
-
Generics can make your Go code slower. I don’t know Go. I don’t really want to, but I found this article (what I understood of it) very interesting.
-
I’ve written about Fly a few times, but their blog output is consistently interesting, and this is no different – A Foolish Consistency: Consul at Fly.io by Thomas H. Ptacek. The things they have to do to wrangle VMs on multiple continents is crazy.
-
Do you want your digits to take up the same space regardless of number?
…if your font supports it, you can use
font-variant-numeric: tabular-nums
in your CSS to keep your numerals the same width and prevent shifting layout. -
I stalled moving my Vim config over to Lua but made progress this week – nearly done.
I figured that I rely on so many Neovim-only plugins now that there is probably no going back to regular ol' Vim, so I might as well fully embrace the new world.
Lua feels a lot more like something I could write myself, it makes basic sense as a language, whereas Vimscript has always felt weird to me, a bit like trying to do something in Bash.
The move is a work in progress as not all Neovim APIs are available from Lua at the moment (as they are in Vimscript), but there are fairly good workarounds.