Journey to ElixirDaze 2018

Last October I discovered an interesting Github issue, Elixir-Lang #6643. It was opened José Valim, the creator of Elixir.

Here's part of the introduction to this issue:

Elixir master now includes a code formatter that automatically formats your code according to a consistent style.

We want to convert Elixir's codebase to use the formatter on all files. We understand this means a lot of code churn now but, on the positive side, it means we can automatically enforce and/or format future contributions, making it easier for everyone to contribute to Elixir.1

This issue set off a massive refactoring project to get Elixir conforming with its new formatter. Today, new pull requests to Elixir must pass through the formatter without requiring changes. I think this will have a ripple effect on every Elixir project in production.

While closing this issue, José provided the following statistics on the refactor:

Why Vim?

Hashrocket is known as a Vim shop; what does that mean?

When visitors learn Hashrocket is a "100% Vim shop", questions follow:

  1. Does everyone use Vim?
  2. Is Vim mandatory at Hashrocket?
  3. Why Vim?

These are fair, and I admit that from the outside, our company's
preference for Vim might seem unusual.

When we evangelize Vim to the development
world, via the Vim Chicago Meetup and
others, the questions become more acute. In a recent
I tried to sell Vim to
React.js developers. I feel obligated to have compelling, succinct
answers on hand.

I'll tackle this subject in three parts: why Hashrocket uses Vim, what
Vim is, and why we think every developer should try Vim. Few subjects
are as contentious in the development world as text editors. Whatever you use,
learn and make it your own. I hope to simply add Vim to the list of things

Continue reading “Why Vim?”

Hashrocket and Code Platoon

Hashrocket's collaboration with Code Platoon continues this October!

For the past three cohorts, Hashrocket has taught an intensive all-day workshop at the Code Platoon bootcamp. Here's a
description of this unique developer training program, from their website:

Code Platoon is a Chicago-based non-profit program exclusively for veterans.
We’ll teach you full-stack development over the course of 20-weeks (6 weeks
remotely, 14 weeks in our Chicago classroom), and train you to be eligible
for paid internships and full-time employment as a web developer. No previous
programming experience is necessary.

In this post, I'd like to talk about this important program, and what we offer to it.

About Code Platoon

The world needs more
programmers; there's a mountain of work to be done. Code bootcamps rise
to this challenge by recognizing that a college degree isn't enough, or perhaps
even required, to do what we do, and that the fundamentals can be

Continue reading “Hashrocket and Code Platoon”

Observing Change: A Gold Master Test in Practice

How do we test a system that seems untestable?

Untested legacy code is the bane of many a developer's existence. In a
permissive language like Ruby, continued development in an untested legacy
codebase requires adding tests. Users expect certain behavior to survive each release intact.

For some systems, the traditional pyramid of test types (unit, API, and
integration) is insufficient. Unit and API tests must presumably cover hundreds
or thousands of functions; which matter? Integration tests could cover a wide
range of user interactions; which are likely? Familiarity with the project is a luxury we don't all enjoy.

I recently worked on an application that took a complex input (a
production database), ran it through a large SQL function, outputting a
giant CSV file representing thousands of permutations of data. Each stage of
the transformation was complex enough that visual inspection would fail to
determine if something was amiss.


Continue reading “Observing Change: A Gold Master Test in Practice”

Today I Learned in Phoenix

The Phoenix port of Today I Learned, Tilex, is live.

Today I Learned began as a Ruby on Rails application.
We open-sourced the code after launch and have maintained it for over two
years. Our mission:

Today I Learned is an open-source project by Hashrocket that exists to
catalogue the sharing & accumulation of knowledge as it happens day-to-day.
Posts have a 200-word limit, and posting is open to any Rocketeer as well as
selected friends of Hashrocket. We hope you enjoy learning along with us.

Today, we are moving forward with an Elixir/Phoenix port of the project.
Here's a little more about the project, focusing on the work, technology, some
observations, the people behind it, and the future.


This project began over two years ago as my
Hashrocket apprentice project. Here's the launch
from that time.

We open-sourced the Ruby on Rails
application in February 2016.

Continue reading “Today I Learned in Phoenix”

A Typical Day at Hashrocket

What is a typical day like for you at Hashrocket?

This is a question people ask. If you've never worked with a
consultancy, what happens on the inside can be mysterious. We're
consultants… does that mean we write code? We're developers…
does that mean we only take projects in languages and frameworks we know very
well? And perhaps most importantly: do we have a ping-pong table?

Today I aim to answer some of these questions the best way I can, by describing my
typical day as a developer at Hashrocket in Chicago. I hope this gives insight into consulting,
and how one person can find their place in the industry.

My typical day flows through team standup, client standups, development,
lunch, development again, and individual contributions, not always in that

Team & Client Standups

At Hashrocket, a vital part of our process is standing up together every day,

Continue reading “A Typical Day at Hashrocket”

Exploring Hashrocket’s Vimbundle: Vim Hashrocket

Hashrocket committed to Vim early in our history, and it's been a crucial decision. When we set up a new development machine, we
install the Dotmatrix, a library of
configurations that includes our favorite, must-have Vim plugins. This blog
post is part of a series exploring some of those plugins, focusing on Vim Hashrocket.

Vim Hashrocket

Vim Hashrocket is a collection
of settings our team shares. Spend enough time
writing code with Vim on a shared machine, and you'll find that the Vim configuration
file in the root directory (.vimrc) swells to hundreds of lines,
as each developer adds their own favorite settings. Vim Hashrocket codifies that into a plugin. It's a neatly organized
junk drawer that reflects many of our evolving goals as a development team.

Here are a few noteworthy settings in the 227-LOC hashrocket.vim plugin.


:NotRocket (line 36) is one of those

Continue reading “Exploring Hashrocket’s Vimbundle: Vim Hashrocket”

Titled URL Slugs in Phoenix

Today I Learned has a feature I love that
we call 'titled slugs'. This week I reimplemented it in Phoenix.

Here's an overview of the feature. Visit any post on 'Today I Learned', and
the URL looks like this:

61e2f0db67 is the url_slug for the post, a unique string that does not
change. But what's with the rest of the URL? -logrotation-for-a-rails-app is
a slugified version of the title of the post. It makes the URL easier to read,
and might improve our SEO in some magical way.

Bur what happens if an author changes the title? The slugified version of the
title should change, altering the URL and breaking any old links to the post.

To test this scenario, visit this link, and look at the URL in your browser:

Surprised? The feature I want to discuss today allows you to remove or

Continue reading “Titled URL Slugs in Phoenix”

Integration Testing Phoenix With Wallaby

Let's write an integration test for Phoenix using Wallaby.

Integration tests are used for behavior description and feature delivery. From
the test-writer's perspective, they are often seen as a capstone, or, to the
outside-in school, an initial 10,000-foot description of the landscape. At Hashrocket
we've been perusing the integration testing landscape for Elixir, and
recently wrote a suite using Wallaby.

In this post, I'll walk through a test we wrote for a recent Phoenix project.


Two emerging tools in this space are Hound and Wallaby; they differ in many ways, enumerated in this Elixir
Chat thread

The Wallaby team describes the project as follows:

Wallaby helps you test your web applications by simulating user interactions.
By default it runs each TestCase concurrently and manages browsers for you.

We chose Wallaby for our project– an ongoing Rails-to-Phoenix port of
Today I Learned (available
)– because we liked

Continue reading “Integration Testing Phoenix With Wallaby”

Hashrocket Stands Up

At Hashrocket, a vital part of our process is standing up together every day.

In 2006, Jason Yip wrote a thorough overview of the Agile/Scrum meeting
style known as the 'standup'. It's available

Yip concludes the article with the accurate observation that "[i]t’s really
just standing up together every day". While true, his arguments reveal the subtlety behind this simple idea.

It would be hard to improve on this article; I'd rather talk
about an example of this technique in the real world, here at Hashrocket.

In this blog post, I will share the details of the two (and usually only two)
meetings our team members participate in each day— a standup with the
Hashrocket team, and a standup with our clients.

Why We Stand Up

Yip lists outcomes a standup can achieve; they are, to

  1. Shared understanding of goals
  2. Coordinated efforts
  3. Sharing problems and improvements
  4. Identify as

    Continue reading “Hashrocket Stands Up”

Gold Master Testing

Gold Master
is a technique for evaluating complex legacy systems.

The general idea is that you take a known input, such as a database,
run it through a function that changes the data, and
then compare the output with an approved version of the output.

It's ideal for systems that are mature, where little change in the output is
expected. And it's ideal for systems that are complex and difficult
to test.

This week my pair and I wrote a test like this, and I wanted to share the
experience. Our work developed through four general phases: preparation, testing, evaluation, and

1. Preparation

The first step we took was to acquire a production database dump and restore it
into a local Postgres database.

Once we had the database dump, we wrote a small Rake task to transform it into
plaintext SQL.

namespace :gold do
  desc "DATABASE will be 
Continue reading "Gold Master Testing"

Best of TIL Year One: Rails

Here are some of the top Rails posts from Today I Learned.

My goal with this series is to highlight some of the top posts from
the first year of Today I Learned. Today we'll
look at Rails, our fifth-most active channel.

Hashrocket was one of the first Ruby on Rails consultancies, and Rails is still very
important to our business. Many of our projects are Rails applications, and we strive to maximize
this ever-evolving framework to meet client needs. Today I Learned is itself
written in Rails (source); some of these posts came directly from working on it.

Here are the top five most liked Rails posts, in order, from the first year of
Today I Learned.


Rails Sandbox ? (Dillon Hafer)

When you are working with a complicated database structure, and find yourself needing to debug a complex or dangerous (delete) action, you might be

Continue reading “Best of TIL Year One: Rails”

Best of TIL Year One: Command Line

Here are some of the top command line posts from Today I Learned.

My goal with this series is to pause and highlight some of the top posts from
the first year of Today I Learned. Today we'll
look at Command Line, our fourth-most active channel.

At Hashrocket, our developers pair every day using Vim and Tmux, sometimes remotely, so command-line proficiency is
a must. The Dotmatrix is one of
several projects we maintain to maximize our terminal environment.

Here are the top five most liked command line posts, in order, from the first year of
Today I Learned.


Homebrew is eating up your harddrive (Dorian Karter)

If you've been using Homebrew on your Mac (if you have a Mac you really should) you may not be aware that every time you upgrade your brew formulas using brew update && brew upgrade Homebrew is leaving behind a copy of

Continue reading “Best of TIL Year One: Command Line”

Best of TIL Year One: Ruby

Here are some of the top Ruby posts from Today I Learned.

My goal with this series is to pause and highlight some of the top posts from
the first year of Today I Learned. Today we'll look at Ruby, our third-most active channel.

Hashrocket invested early in Ruby, and it remains the lingua franca of our company.
Though many of us enjoy hacking on JavaScript, Elixir, Go, Clojure, and other languages, Ruby is still
a well-worn and trusty tool. We travel to Rails Conf and Ruby Conf
each year, and host our own annual Ruby conference in St. Augustine. There's a cache at Hashrocket to an elegant line of Ruby, because it's a language we all know well.

Here are the top five most liked Ruby posts, in order, from the first year of Today I Learned.


Ruby String Mutability (Vinicius Negrisolo)

Until Ruby 3 we need to

Continue reading “Best of TIL Year One: Ruby”

Best of TIL Year One: SQL

Here are some of the top SQL posts from Today I Learned.

My goal with this series is to pause and highlight some of the top posts from
the first year of Today I Learned. Today we'll look at SQL, our second-most active channel.

Databases matter to Hashrocket. 'Your database will be
multi-tenant' is a common axiom. We feel that a
robust database, with precise constraints, capable of standing alone
from any framework, is crucial to the long-term success of a project.
SQL mastery is a badge of honor here.

Here are the top five most liked SQL posts, in order, from the first year of Today I Learned.


Watch for database changes on #PostgreSQL (Dorian Karter)

If you are trying to debug multi-threaded environments or a really fast job queue you might need to "watch" a table for changes.

In psql use the \watch command like so:

Continue reading "Best of TIL Year One: SQL"

Best of TIL Year One: Vim

Here are some of the top Vim posts from Today I Learned.

Today I Learned is now over a year old.

The participation from my coworkers has been inspiring, rocketing our posts
count to over 750. The enthusiasm from fans of the
site has been encouraging, on Twitter, Hacker News, and elsewhere. We
open-sourced the codebase earlier this
year and have gotten issues and pull requests, as well as several clones in
production. It's been awesome.

TIL content is like a river; if you haven't posted today, your content gets lost
in the stream. That's why I'd like to pause and highlight some of the
top posts from the first year of Today I Learned.

Beyond a chance to reflect, I hope we can all benefit from the hard-won epiphanies of Rocketeers
at work. Leverage the head-banging of others!

We'll start with Vim, our first and most active channel. Below


Continue reading “Best of TIL Year One: Vim”

Vim Magic with Abolish.vim

Occasionally, I discover a Vim plugin that blows my mind. Abolish.vim is just such a plugin.

The creator Tim Pope describes Abolish.vim as follows:

It's three superficially unrelated plugins in one that share a common theme: working with variants of a word.

He's right. The features of this plugin— abbreviation, substitution, and coercion— seem unrelated. The first can be used to preempt chronic typos, the second can be used to beat Vim's limited string substitution, and the third can be used to transform all the unique cases we use as programmers. Why combine them?

It doesn't matter why. This plugin is amazing. Add it to your Vim configuration, learn a few commands, and prepare to look like a magician at the keyboard.

In this blog post, we will explore the setup and three main features of Abolish.vim.


With Pathogen.vim, installation is as easy as:

Continue reading "Vim Magic with Abolish.vim"

Introducing Metabot

We made a robot.

Our foray into chatbots began with Steambot. Rocketeer Josh Davey wrote a Markov Chain text generator in Clojure, then trained it on some Kafka, Russell, Aristotle, Nietzsche, and a special ingredient: Steam, Its Generation and Use by Babcock & Wilcox Company (35th edition, copyright 1919).

He named his program Steambot and configured it as an outgoing webhook in Slack. This was Steambot's first message, triggered with the keyword 'steambot':

'The Mean man will be vexed, but only moderately and as their age changes so likewise do their pleasures.' -Steambot (November 6, 2014)

We pinged Steambot for a few days, asking it Turing Test-style questions like 'Steambot, what is love?'. Steambot responded:

'It is the test of a K. W. steam engine turbine unit, Mr. H. G. Stott and Mr. R. G. S.' -Steambot (December 18, 2014)

Pretty soon there was so much traffic

Continue reading “Introducing Metabot”

Reviewing Code

The dreaded code review. Nobody likes receiving or delivering a code review, but scrutinizing our code leads to a better product.

"In my reviews, I feel it's good to make it clear that I'm not proposing objective truth, but subjective reactions; a review should reflect the immediate experience." – Roger Ebert

Code reviews are crucial – one set of eyes on a codebase is not enough. Modern applications are simply too complex for one person to manage alone. We review code to prevent regressions, document behavior, ensure quality, and share knowledge. The ability to justify and explain your design choices is an essential skill for any developer.

(I'm using the term 'code review' here in the same way others might say 'code audit': I'm reviewing a pull request on a project I maintain from a developer I don't yet have a relationship with. I'm the gatekeeper, and and my

Continue reading “Reviewing Code”