RSSAmplifier

Blog

Anti-pattern

The most popular unpopular opinions on programming.

anti-pattern.comRSS feed ↗6 posts

Latest posts

Rename Git’s Default Branch

If you’re interested in changing the default Git branch name from “master” to something else, here’s how you do it. Make a new default branch Start by duplicating master. I’m using “main” for this example but use whatever you like. git switch --create main master Then push it up and set the upstream. git push -u origin main Next change your default branch in GitHub to “main”. And finally change…

.dev Domains Not Resolving

For the last year I’ve been unable to view any .dev domains on my computer. The problem was simple, but it took me a long time to figure out what it was. As soon as Google started selling domains on the .dev TLD developers started snapping them up and using them for their websites, blogs, and other projects. Strangely though, I found I couldn’t see any of them. Whenever I would click through to a…

Migrating to a New Mac for Programmers

Apple creates great experiences, but migrating to a new computer tends to not be one of them. There are several different ways of migrating, it’s not clear what the relative differences are between them, and when it’s taking a lot longer than you expect it’s not clear why. The seemingly never-ending migration hits programmers especially hard. After running into this problem yet again recently, I…

Explicit Privates

The private keyword in Ruby makes all instance methods declared after it private. There are a few different styles and ways of formatting it, but the most common style is this. class Stuff def something_public # … end private def something_private # … end end I’ve always found this to be a bit awful. If your file is large, the only way to know if a method you’re looking at is private or not is to…

Always Use Double-quoted Strings in Ruby

Single-quoted strings or double-quoted strings; the eternal conflict rages on. Between years of freelancing and open-source work I’ve gotten to see a lot of different codebases and the most common quote style I see is using single quotes by default and double quotes only when interpolating. When I ask why I always get the same answers: The style guides say to use single quotes Single-quoted…

Complex Static Sites on Heroku

Hosting a static site generated by Middleman or Jekyll on Heroku is easier than it might seem. You don’t need a custom buildpack or a gem, all you need is Rake and a few middlewares. Generating Some people like to build their site locally and commit it to the repo, but you really don’t need to do that. Heroku’s Ruby buildpack will invoke a Rake task called precompile:assets during deployment if it…