Skip to content

Instantly share code, notes, and snippets.

View tomholford's full-sized avatar

tomholford

View GitHub Profile

Email Styling Best Practices

Email rendering is fundamentally different from web rendering. There is no universal standard — each email client uses its own engine, strips different things, and handles dark mode differently. This guide is split into two parts: design principles for designers, and technical reference for developers.


Part 1: Design Principles

For designers who may not be familiar with email-specific constraints.

@tomholford
tomholford / proton-drive-backup-fix.md
Created March 1, 2026 19:45
Fixing rclone Proton Drive uploads — block verification, retry, draft cleanup (March 2026)

Fixing rclone Proton Drive Uploads (March 2026)

Proton Drive uploads via rclone have been broken since ~November 2025. This documents the root causes, fixes, and testing.

Problem

Three issues combine to break uploads:

  1. Missing block verification tokens — Proton's storage backend now requires a Verifier.Token per block in POST /drive/blocks. Without it, every block upload fails with 422 / Code=200501. This is the primary cause.
  2. Broken shouldRetry()backend/protondrive/protondrive.go:248 always returns (false, err), disabling rclone's pacer retry logic entirely.
@tomholford
tomholford / git-branch-cleanup.md
Created February 20, 2026 22:52
Git branch cleanup aliases for zsh — worktree-safe, handles squash/rebase merges, auto-detects default branch

Git Branch Cleanup Aliases for Zsh

Improved one-liners for cleaning up stale local branches after merge. Inspired by the CIA's leaked dev docs and HN discussion.

Helpers

# Auto-detect default branch (main/master) from remote
function _git_default_branch() {
  git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main"
@tomholford
tomholford / install_pg_gem.md
Last active September 7, 2025 13:07
Install postgresql gem `pg` on macOS

Installing pg gem on macOS

If you're trying to install the postgresql gem pg and it is failing with the following error message:

Installing pg 1.2.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: ~/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pg-1.2.3/ext
~/.rbenv/versions/3.0.0/bin/ruby -I ~/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -r ./siteconf20210125-97201-pycpo.rb extconf.rb
@tomholford
tomholford / README.md
Created May 15, 2020 01:42
Extend Rails application layouts

extends

An elegant way to nest Rails layouts.

Example Usage

# devise.html.erb
<%= extends :application do %>
 
@tomholford
tomholford / newface.sh
Created April 24, 2020 03:30
Get a new neural-net generated face jpg via This Person Does Not Exist
curl https://thispersondoesnotexist.com/image -o ~/$(date +%s).jpg
@tomholford
tomholford / external_link_to.md
Last active October 19, 2019 02:52
Rails link_to helper for external links that open a new tab
@tomholford
tomholford / classifier.rb
Created June 7, 2018 17:19
even / odd classifier using proc
f = proc do |p|
Hash.new.merge(
->{ p.odd? }.call => 'odd',
->{ p.even? }.call => 'even'
).fetch(true)
end
=> #<Proc:0x00007ff91188af38@(irb):1>
> f[1]
=> "odd"