Easier Gem Releases with Bundler Release Tasks

If you maintain a gem and aren’t using Bundler’s release rake tasks you’re missing out. If you have a well maintained gem, then the best practice is to tag a release every time you push a new gem version to RubyGems.org. This helps users to see differences between versions. For example you can compare releases on the Heroku Ruby Buildpack https://github.com/heroku/heroku-buildpack-ruby/compare/v142…v143. Bundler comes with a Rake task that simplifies tagging a release and pushing a version to RubyGems.

Keep Reading


Speeding up Sprockets

The asset pipeline is the slowest part of deploying a Rails app. How slow? On average, it’s over 20x slower than installing dependencies via $ bundle install. Why so slow? In this article, we’re going to take a look at some of the reasons the asset pipeline is slow and how we were able to get a 12x performance improvement on some apps with Sprockets version 3.3+.

Keep Reading


Do You Believe in Programming Magic?

Unlike pulling a rabbit out of a hat, “magic” in programming is often performed under the guise of productivity. In this post, we’ll look at what defines a magical programming experience for better or worse. If you were in Rails around 2007 you might be quick to describe it as “auto-magical,” and this was a good thing. Magic meant freedom from the tyranny of endless boilerplate, freedom from hours of tedious configuration, freedom to be productive.

Keep Reading


Upgrading to Rails 5 Beta - The Hard Way

Rails 5 has been brewing for more than a year. To take advantage of new features, and stay on the supported path, you’ll need to upgrade. In this post, we’ll look at the upgrade process for a production Rails app, codetriage.com. The codebase is open source so you can follow along. Special thanks to Prathamesh for his help with this blog post.

Keep Reading


Ruby Debugging Magic Cheat Sheet

This document is all about deciphering behavior of Ruby code using nothing but Ruby code. I recommend you get familiar with a debugger like pry-debugger, this doc doesn’t go into debuggers because they’re not always available.

Keep Reading


The Definitive Guide to Ruby Heap Dumps, Part I & II

In this two part series I talk about the in and outs of debugging Ruby memory with heap dumps. The first section covers what a heap dump is, how to get one, and how to analyze it. The second section focuses on getting a heap dump off of a Heroku dyno. We then use that data to debug a production memory problem. These were originally published in December 2015, sorry for the delay in linking. Enjoy!

Keep Reading


SemVer for Library Maintainers

SemVer is simple. Well…until you start publishing libraries, and accidentally break a metric ton of apps on accident. I’ve never caused any mass scale melt downs, however I’ve made my fair share of screw-ups. I maintain gems with over 200 million downloads. I wish I had this guide available to me when I first got in the library authorship game. Let’s take a look at what SemVer is and how to use it as a maintainer.

Keep Reading


SQL statements in Rails logs

Sometimes in programming, the smallest things are the most helpful. I remember wowing a co-worker when I hit CTRL+A and my cursor jumped to the beginning of a long terminal command. Since then, I’ve vowed that no tip is too small to share. Today, my tip is for getting Rails SQL statements and Cache behavior in production logs locally. It’s pretty simple. If you’re using rails_12factor gem to output your logs to standard out, then all you need to do is boot up your server with LOG_LEVEL=debug, like this:

Keep Reading


Debugging a Memory Leak on Heroku

This is one of the most frequent questions I’m asked by Heroku Ruby customers: “How do I debug a memory leak?” Memory is important. If you don’t have enough of it, you’ll end up using swap memory and really slowing down your site. So what do you do when you think you’ve got a memory leak? What you’re most likely seeing is the normal memory behavior of a Ruby app. You probably don’t have a memory leak. We’ll work on fixing your memory problems in a minute, but we have to cover some basics first.

Keep Reading


Who Does your Gem Work For?

Have you ever wondered who out there is using a gem? Now there’s an easy way.

Keep Reading


Subscribe to my Newsletter 😻 🤠

Join thousands of developers who get new code, writing, and programming links from me delivered to their inboxes.