I recently learned that NetNewsWire supports opting-in individual feeds to “always use reader view” , so I’ve been noticing more closely which of my feeds provide the full content of their feeds versus just a summary, and opting in the latter to that setting where it makes sense. (Annoyingly, this setting doesn’t seem to sync across NetNewsWire macOS and iOS, oh well!)…
In Go, it’s common to wait on a condition via a channel while also respecting context cancellation. A common idiom looks like: select { case <- condition : return nil case <- ctx . Done (): return ctx . Err () } An issue with this is that if you’d prefer that condition (i.e., the non-error case) be treated with precedence, you’re racing with ctx.Done() ; select chooses a case at…
I recently read Will Manidis’ Against Taste and found myself nodding along to much of that essay: The taste thesis, at its deepest and most simple structure, reverses this order. It places man at the end of the chain of creation, evaluating what has already been generated, rather than at the beginning, participating in the generation itself. It makes man what he has been slowly becoming for…
TIL of “sargable” conditions in SQL queries, which just means that an index can be used to speed up the query. One of those “you already know the concept, but the handle is useful” sort of things.
Again , not something I learned today , but within the last few weeks: “tangenting”. I read about this in the wonderful Looking At Picture Books Substack, discussing one of my (and Wilhelmina’s) favorites, Goodnight Moon : Tangenting is something you get yelled at for when you’re in art/design school. The theory is that the edges of things shouldn’t touch closely. You should…
TK means “to come” . You’ll typically see it as “TKTK” or “TKTKTK”, as a simple way to search (i.e., ⌘ + f ) for details that haven’t been written yet. I use it when drafting blog posts to skip over a sentence or section I want to come back to write later, to avoid losing momentum. I didn’t learn this today, but within the last year or two (not…
This weekend, I built a language server for CEL called cells . It currently supports semantic highlighting, diagnostics, documentation on hover, signature help, references, document highlighting (for variable references), completion, and formatting. CEL is a pretty simple language, so a language server for it doesn’t really need to support things like go to definition or some of the other…
Yesterday, I was working on improving buf ’s lsp protobuf semantic tokens , and needed to test out how my changes were working in a real LSP client. I knew neovim had a couple of helper functions for inspecting the current position; first I tried: : lua vim . print ( vim . inspect_pos ()) I figured there must be a function more specifically for semantic tokens: : lua vim . print ( vim . lsp…
Growing up playing World of Warcraft (WoW) 1 , I became familiar with the concept of “Fog of War” — that is, areas of the world that your character hadn’t visited. Once you moved close enough to a certain area on the map, the fog would “lift”, and that area on your map would be filled in moving forward. Also, you’d gain experience points for clearing Fog of War…
I had assumed that to interact with Tree-sitter in Neovim, you still needed to use the utilities from nvim-treesitter . Apparently that’s not the case — Neovim has had a builtin :InspectTree command that brings up the AST from Tree-sitter in a split window, which is scrollbound to the original window and highlights the selected node in both windows. It also has a query editor , which I…
TIL about WikiGnomes : A WikiGnome is a wiki user who makes useful incremental edits without clamoring for attention. WikiGnomes work behind the scenes of a wiki, tying up little loose ends and making things run more smoothly. Some of the most valuable work can be the tiny changes that leave things in a better place than they were found. Also, sounds a little like prutsen .
Since moving out to suburban Ipswich from Boston, I’ve been on a “seasons” kick — you know, those things that feel wonderful the first couple weeks they’re here and then eventually drag on until the next one comes along? (Currently waiting patiently for Autumn to get started in New England!) Pondering my seasons While I’m more thoroughly immersed in the seasons now than when I was in the city, I…
Riffing on Tom MacWright’s “Using super” post from yesterday, I saw the post and immediately thought of using jq . I thought I might get what he was looking for with my initial attempt, something like: $ pbpaste | jq '.[].name' "ALGOLIA_API_KEY" "AMAZON_AWS_ACCESS_KEY_ID" … but that left out the wrapper array. I figured I might need some other jq function or pipe, but…
I was lucky enough to be included in the inaugural Internet Phonebook , in the “Atmosphere” section on p. 22 — I’m number #58 if you’d like to Dial-my-site . I ordered a copy to peruse for myself, and lo and behold, I had forgotten that I had submitted on a whim. Probably the first and last time a link to this little site of mine will appear in print. Still, glad to be included in, and support,…
neovim released v0.11.0 a little while back, and in the interest of using the defaults, I removed some of my LSP -related keymaps that are now automatically mapped . These are listed at :help lsp-defaults .
TIL about the Postgres citext type (that is, case-insensitive text type ), from reading this schema . Based on this tip from the Postgres docs, this might not be the right type for general text: Consider using nondeterministic collations (see Section 24.2.2.4 ) instead of this module. They can be used for case-insensitive comparisons, accent-insensitive comparisons, and other combinations, and…
I’ve long struggled with the choice of how to pass around Go values, specifically structs. I was happy to find this article on the topic, specifically the conclusion, reproduced here: Types that are not structs or arrays should be passed by value. Struct types that don’t export their members and are clearly built as immutable value types, like time.Time, should be passed by value. Note that…
Last week I learned that an HTML datetime attribute can represent a duration . For example: < time datetime = "PT4H18M3S" > 4 hours, 18 minutes and 3 seconds </ time > The syntax is an ISO 8601 Duration .
Last week, I watched a coworker bring up a file on a different branch using fugitive.vim’s :GBrowse and I was floored: almost daily I find myself using it to open the URL to a file to share (or a few lines). However, much of the time I’m working on a different branch than the one I want to share, and navigating to the same file on a different branch in the GitHub UI takes too many…
I’ve long wanted to figure out how to get nfnl's directory-local configuration working, but it took me until yesterday to figure it out — mostly by opening a discussion and then realizing my mistakes. 🤡 First, exrc needs to be enabled . This will ultimately load the contents of the generated .nvim.lua file, as described in :help 'exrc' Next, create an .nfnl.fnl file in the directory.…
This isn’t something I’m just learning today, but I’ve looked this up enough to warrant writing it down. I’m often working on some code, and come across something unrelated that I want to change. So I do — but it really doesn’t belong in this commit or PR /patch/etc.! (I’ve yet to put in the reps to understand worktrees or jujutsu , which I’m…
My Overcast settings screen shows the following: Smart Speed has saved you an extra 949 hours beyond speed adjustments alone. That’s a lot of time. I’ve been using Overcast to listen to podcasts since it launched, with years now of what-I’d-call “heavy” podcast listening. I’ve spent most of that time listening on 1.5 or 2x speed, with smart speed always turned…
Inspired by Louie Mantia’s CSS for This Blog , I figured I’d publish the page I use locally for testing out how my CSS looks. It’s over at /style-guide ( source ) and it’s basically a dump of the markdown tab on bryanbraun.com/poor-mans-styleguide . A great, simple way to see the various styles for most everything on the site.
A quick retrospective on my November Goals post: Run 80 miles I fell a little short here, running just 58 miles for the month. But it was busier than I gave myself credit for: a trip to see friends and being on call for two straight weeks made things a bit tricky. I should still be in good shape to get to 1000 miles for the year, which would likely be the most I’ve clocked in a year, ever.…
I’ve been a little hesitant to write here, for whatever reason. Haven’t had the gumption to write, I suppose. So I’d like to start up a bit of a habit — call it a “reverse New Years resolution”: I’d like to write something here (either a blog or TIL) each day until the end of 2022. s/each day/each week A bit too much, I think, to post each day. But I’m glad to have started up the habit of…
TIL of Service Wrappers a technique I’ve used in the past but have never had a name for. It’s essentially an approach to wrapping external APIs. From the article: Methods should be named in the language of the service, not the language of the app. Arguments should use the domain of the service, not the domain of the app. Arguments should be whatever type is directly needed by the…
Watched “The Blair Witch Project” last night as a bit of a pre-Halloween treat. Two thoughts: Some movies are just better in theaters. (Maybe related!): The bar for “scary” has gotten higher in the last 20 years. Either way, worth the watch. Just don’t read the Wikipedia page first, and pay attention — the found-film effect can be jarring.
I’ve spent a decent amount of time tweaking my … “system” for reading articles and blogs on the ’net that I figured I’d jot down what I’ve tried, and what’s currently working for me. I currently use two separate but related tools for reading the web: a feed reader, and a “read later” app. My first feed reader was Google Reader until its…
Setting some November goals a little early: Run 80 miles I set a goal of 500 miles this year — I’m already at 864 miles for the year, most of which I ran in the early summer. I’d really like to pass 1000 for the first time in a long while, and if I’m not at 950 by December, I can tell I’m not going to make it. 20 miles a week should be reasonable, given that I was getting…
I’ve been a little hesitant to write here, for whatever reason. Haven’t had the gumption to write, I suppose. So I’d like to start up a bit of a habit — call it a “reverse New Years resolution”: I’d like to write something here (either a blog or TIL) each day until the end of 2022. Grease the Groove, they say. Don’t worry about who’s reading…
Not sure how I hadn’t seen this before: in Go, you can specify the index of the format argument you want to use for each formatting verb. Simply enough, from the package docs : fmt . Sprintf ( "%[2]d %[1]d\n" , 11 , 22 ) // => "22 11" In the past, I’ve actually done something along the lines of: s := "test" fmt . Sprintf ( "%s %s" , s , s ) // => "test test" Instead, you can do: s :=…
These notes are basically cribbed from Ben Johnson’s excellent “Building Production Applications Using Go & SQLite” GopherCon talk, specifically the “Configuring SQLite” section . Generally speaking, you’ll want to set three PRAGMA s on each SQLite connection: PRAGMA journal_mode = WAL ; PRAGMA busy_timeout = 5000 ; PRAGMA foreign_keys = ON ; In turn, PRAGMA…
For a long time, I’ve used commandline as the name for the syntax of code fences in markdown whenever I’ve wanted to denote a shell command or session. I’ve now realized that I’ve been using the wrong name, and also that there are two separate scenarios to keep in mind: The first scenario is one-off commands, which should use the syntax sh , or shell . This would be showing…
Found a bug in one of our systems at work that deals with jsonb data stored in Postgres today. The quick summary is that one of our systems was looking for the maximum numerical value of a jsonb integer in a table. A very simplified example: SELECT max ( balances ) FROM unnest ( ARRAY [ '{"balance": 7}' :: jsonb ->> 'balance' , '{"balance": 17}' :: jsonb ->> 'balance' ]) as balances This returns 7…
I still feel rather new to PostgreSQL, and a few times now in Go I’ve tried to do something along the lines of: type pgdb struct { db * sql . DB } func ( db * pgdb ) getEntityByID ( ctx context . Context , ids [] string ) ([] Entity , error ) { query := "SELECT * FROM entities WHERE entities.id IN ($1)" rows , err := db . db . QueryContext ( ctx , query , pq . StringArray ( ids )) /// ... }…
I wasn’t aware of the Go fmt package %q verb, for quoting strings. Typically, I’ve been escaping the quotes manually and using the %s verb: fmt . Sprintf ( "this needs quoting: \"%s\"" , "input" ) But the %q verb obviates the need for that manual quoting. From the package documentation : %s the uninterpreted bytes of the string or slice %q a double-quoted string safely escaped with Go…
Recently I polished up and published my seven-guis project. It’s an implementation of the 7 GUIs “ GUI Programming Benchmark” , written in ClojureScript and Reagent . It’s not quite complete - there are 7 tasks , and I finished all except for the last one (the spreadsheet - the most vaguely specified and open-ended, and the most difficult). I’ll finish it down the…
When writing HTML templates in Go, knowing about the whitespace modifiers is crucial for keeping both the templates and the output HTML looking good. For example, if you had the following template, with .SomeText being "foo" and .Something being true : < a href = "/posts" > < span > {{ if .Something }} Text {{ else }} Image {{ end }} </ span > {{ .SomeText }} </ a > The actual output HTML would…
I’ve added a new uses page, detailing my personal computing setup. I’m hoping to make it more prose-like in the future, but for now it lists my current most commonly used hardware and software.
The time.Ticker type in Go is incredibly useful for situations in which polling is needed. The easiest way to use the Ticker is via the time.Tick function, which just provides access to the ticking channel, which makes it easy to range over: package main import ( "fmt" "time" ) func main () { for currentTime := range time . Tick ( time . Second ) { fmt . Println ( "current time: " , currentTime )…
I typically don’t do much with concurrency in Go, but messed around this morning with both oklog/run and sync/errgroup . I’ve defaulted to using oklog/run in the past, but I realized that while they have similar interfaces, they’re useful for different things: oklog/run is useful for long-running processes. think starting up http servers alongside other components, and waiting…
I’m constantly using jq to deal with JSON via the CLI . Today I needed to figure out the difference between a key existing with a null value or not existing at all in a bit of JSON . By default, “querying” a key via jq will return null whether the key exists and is null , or the key doesn’t exist: △ # NOTE: the following is in fish, but should be straightforward to port to…
A quick domain update: svbn.me -> stefan.vanburen.xyz and to match, an email address update: me@svbn.me -> stefan@vanburen.xyz Will hold on to the old domain for awhile, so it should still work, but most things are being redirected.
At $work, I’ve been writing a web application that is server-side rendered via Go’s html/template package. I’ve been writing a toy application in Clojure with a similar approach: server rendered HTML with Tailwind for styling and AlpineJS for a hint of interactivity. With the introduction of Go’s new embed package in 1.16, I was tempted to port the application to Go. I was…
I was reminded of the font-variant-numeric CSS property by Jim Nielsen, here , and ended up using it in a similar way for the dates on my list of blog posts . For context, without tabular-nums enabled, numbers on this site look like this: 0123456789 And with it enabled, they look like this: 0123456789 At least on Apple platforms, where the system sans-serif font is San Francisco , the…
Recently I was building a new website in go at $work and needed to do some URL parsing to grab some expected parameters in the URL . The URL was expected to look something like the following: /path/:id1/:id2 , where I was trying to grab id1 and id2 out of the URL . In the past, I’ve done something along the lines of: splitPath := strings . Split ( r . URL . Path , "/" ) // error handling,…
A quick update: I’ve put the repository in maintenance mode , and started work on a neovim colorscheme based on the same colors. The end goal is to have a generalized colorscheme that can be exported for use elsewhere. I published the vim colorscheme I’ve been using for the last few months publicly on GitHub . It’s called rams.vim, after the German Designer, Dieter Rams . I had…
I was browsing through my GitHub repositories the other day and noticed small , a CLI tool I started working on about two years ago to convert text. I finally polished up the repo and published it for all to see . It’s really not much, but it gave me a chance to think about the expected behaviors associated with a tool like small . In particular, support for being piped ( $ command | small )…
I recently learned of “prutsen”, a Dutch word meaning “to fiddle around” . In a lot of ways, I think it encompasses a lot of how I approach some of my computer diversions. For example, this website, at the time of writing, has 135 commits on it . With a total of five published posts, and most of my posts being written within a commit or two, much of the work being done on…