Vim: filter text with external programs Jan 02, 2021 One of the reasons Vim1 is powerful is that it gives you easy access to your shell. If you’ve invested in developing your skills with the Unix shell, and in writing shell-scripts, that work also pays off in Vim. Here’s a simple example that I use frequently: let’s say I find a slow SQL statement in my Postgres logs, and I’d like to rewrite it. To rewrite it, I first want to read it, so I’d like to turn this: ...
Vim, Orthogonality, and Software Design Dec 27, 2020

I learned Vim1 in my first programming job, when a senior engineer who loved Vim gave my group of new hires a few Vim basics intro sessions. I floundered at first, then got to the point where I could navigate Vim fairly fast. I could comfortably use Vim, but I didn’t really get Vim: I only got good enough at using it to make it work as well as any other (normal) text editor.

...
Quoting Strings in Postgres Dec 22, 2020

PostgreSQL offers multiple ways of quoting string literals. Most programmers are familiar with the first, but not the other forms.

...
Exported vs Un-exported Shell Variables Dec 21, 2020

Many programmers new to Unix shells are confused by shell variables, and how they relate to the Unix environment.

...
Constructor Injection is Good Design Dec 17, 2020

A key aspect of writing good code is asking for your dependencies as inputs, instead of hard-wiring references to your dependencies in the code, viz. dependency injection

...
Ask for a Clock Dec 11, 2020

When writing code that needs the current time, don’t hardcode a reference to the current time.

...
Timezones and Calendars on the Command Line Dec 10, 2020

When programming, you may have to work with dates and times in different time-zones, or look at events in calendars in the past or future. You can do all of these using GUI tools, but your Unix command-line is there for you (and easier to script).

...
Kotlin Calling Java: Mind Your nulls Dec 09, 2020

If you’re introducing Kotlin to an existing Java codebase, you’ll probably have places in your code where new Kotlin code has to call existing Java code, or vice-versa. Kotlin’s default behavior for Java interop poses a subtle, but significant safety problem with nullability.

...
Program for Yourself First Dec 09, 2020 First program to empower yourself, then program to solve the problem
Command Line Clipboard Manipulation Dec 08, 2020

When working on the command-line, it’s often useful to paste from the system clipboard to a command-line tool, or to copy output from the command-line into your system clipboard.

On macOS, pbcopy and pbpaste do this. On Linux, you can use xclip or xsel.

...