How (and Why) to Log Your Entire Bash History

For the last three and a half years, every single command I’ve run from the command line on my MacBook Pro has been logged to a set of log files.

Uncompressed, these files take up 16 MB of disk space on my laptop. But the return I’ve gotten on that small investment is immense. Being able to go back and find any command you’ve run in the past is so valuable, and it’s so easy to configure, you should definitely set it up today. I’m going to share how to do this so you can take advantage of it as well.

Read more on How (and Why) to Log Your Entire Bash History…

Using Rust 1.8 Stable for Building Embedded Firmware

A lot of things have changed since I wrote my last blog post on using Rust to build embedded firmware.

Since Rust 1.6 was released, libcore is now stable, and nostd is now a stable feature. This means we can now build Rust libraries for our embedded firmware using the official stable version of the compiler!

Read more on Using Rust 1.8 Stable for Building Embedded Firmware…

A Swift Architecture for Managing State: Revised

In my previous blog post, I wrote about an approach for managing state in a Swift app. Following that post, some changes were made to the Swift language that deprecated some convenient syntax my approach relied on. After some thinking, and with a better understanding of Swift’s approach to mutability, I’ve slightly revised this architecture to reduce a lot of friction.
Read more on A Swift Architecture for Managing State: Revised…

A Minimalist Guide to Customizing ActiveAdmin Forms

ActiveAdmin has saved a huge amount of time on our current project, and I highly recommend it for quickly giving non-technical people administrator access to your Rails app.

Some of the documentation is great, and there are lots of methods you can use to customize, but there are also some out-of-date red herrings, some things that require learning about Formtastic, etc. So here’s a minimalist guide to customizing ActiveAdmin forms relying more on Ruby and logic than on the unique ins and outs of ActiveAdmin.
Read more on A Minimalist Guide to Customizing ActiveAdmin Forms…

Avoiding “Undefined is Not a Function” with Constants

How many times have you come across JavaScript’s “Undefined is not a function”? Too many. JavaScript is known for being so flexible that it’s easy to create unintentional bugs.

One way we can add structure to JavaScript code is to make a habit of using constants. Constants pair well in JavaScript with JS’s powerful object data structure, and they can prevent all kinds of problems, Read more on Avoiding “Undefined is Not a Function” with Constants…

Ansible Communication with AWS EC2 Instances on a VPC

I’ve recently started using Ansible to manage Elastic Compute Cloud (EC2) hosts on Amazon Web Services (AWS). While it is possible to have public IP addresses for EC2 instances on an AWS Virtual Private Cloud (VPC), I opted to place the EC2 instances on a private VPC subnet which does not allow direct access from the Internet. This makes communicating with the EC2 instances a little more complicated.

While I could create a VPN connection to the VPC, this is rather cumbersome without a compatible hardware router. Instead, I opted to create a bastion host which allows me to connect to the VPC, and communicate securely with EC2 instances over SSH.
Read more on Ansible Communication with AWS EC2 Instances on a VPC…

Monadt – Algebraic Data Types and Monads in Ruby, Part 2: Monads

In yesterday’s post, I introduced monadt, a gem that adds algebraic data types (ADTs) and monads to Ruby. Today I’m going to dive into how monadt provides monad support, specifically the imperative-looking syntactical sugar you get in languages like Haskell and F#. Read more on Monadt – Algebraic Data Types and Monads in Ruby, Part 2: Monads…

Monadt – Algebraic Data Types and Monads in Ruby, Part 1: ADTs

Functional programming is elegant and expressive. I’ve written before about my love of partial application, and how the funkify gem can be used to bring the power of partial application to your Ruby code. But partial application is just one of the powerful idioms from functional languages that I’d like to borrow in object-oriented languages. I’m also pretty into algebraic data types and monads.

So, continuing my pattern of adding functional concepts to object-oriented languages whether they like it or not, I recently created the monadt gem which adds support for using algebraic data types and monads to Ruby. Read more on Monadt – Algebraic Data Types and Monads in Ruby, Part 1: ADTs…

Creating Graphics Code in iOS & OS X with PaintCode


Two years ago, I worked on a large iOS project with a very complex, dynamic shape that needed to be rendered on its main screen. The shape had to be drawn using hundreds of Bézier curves in a closed path, generated from real-world data.

Despite my background in computational geometry and OpenGL, I wasn’t sure how to best accomplish the shape in iOS using the drawing primitives and their rendering contexts. Fortunately, I found a helpful tool called PaintCode which cut the time to prototype the drawing code by an order of magnitude. In this post, I’ll describe how I used PaintCode and cover some of its more interesting features. Read more on Creating Graphics Code in iOS & OS X with PaintCode…