This is a compilation of how to do things in Vim which I sometimes forget and
have to look up. It’s naturally a work in progress, and I’ll add new things as
I encounter them.
Add a word to the dictionary
Explanation: Adds the word under the cursor to the spellfile. See
:help spell for details.
Execute a macro on each line of selection
:norm[al][!] will run whatever argument you give it
(in this case it’s
@a) as if it were typed in Normal mode. It takes a
range, and will execute …
Suppose you want to write a decorator for a function that will execute a
callback on a function’s argument. You also want to specify the name of that
argument so that it doesn’t matter where it appears in the function’s
signature, or how the function was called (you can give arguments to a function
in any order if you use keyword arguments).
More concretely, we want to be able to write
def f(w, x, y):
callback(x) execute whenever
f() is called. To do
this, we’ll need to map …
We’ve been having quite a lot of snow this winter, and a couple weeks ago I
decided to photograph it. This is my first real attempt at a photo essay, but I
think I’m going to do more of these in the future since I find it to be a nicer
way of presenting images than having a stream of unrelated images (a la Flickr
or Instagram). Some individual images may not be great on their own, but as
part of a collection they contribute to the overall mood of the whole set.
This post is an experiment in presenting photos on this blog. There are no
previews on the index pages; you have to open the post itself to see any images
(I’m trying to reduce load times for my front page). For now, it’s just a
series of images at the same width as the rest of the text; I’ll be looking
into making it more fancy in the future. Specfically, I’d like to have the
images be bigger, but still fit within the viewport.
As for the photos, they’re 3 images I shot at SFU a week or two ago during some
particularly heavy fog. Processing has been minimal as I’m starting to like the
look of CaptureOne’s default processing, and I’m trying to restrict myself from
messing with the colors to the extreme extent I did in the past.
A project I’m working on stores JSON objects in Postgres using its native JSON
datatype. For developing the frontend of the site, running Postgres locally is
unwanted, but some components still require a database to exist. To deal with
this, we’re using SQLite for any local development that doesn’t modify the schema.
The problem caused by this setup is that SQLite doesn’t natively support the
JSON datatype. Yes, it has the json1 extension, but SQLAlchemy’s
Page 1 of 11
types.JSON doesn’t work with it. To solve this, I’ve decided to simply
serialize the JSON and store …