The Existential Operator

Thoughts on Ruby, Rails, JavaScript, and web development

August 31, 2015

Arduino Temperature Sensor

Because we live on a boat, my wife and I have recently had trouble keeping the temperature consistent in our son’s bedroom. The ideal temperature for infants to sleep in is apparently 68°F, but in the late summer when we’ve put him down, the nights tend to hover around 73°, then drop precipitously to around 64° around 5am. Consequently, my wife tends to wake up around 4–5 times a night to either turn a fan or a heater on or off. We have a thermometer in the room, but it’s a cheap one without a light, so she has to go into the room, try to read the thermometer, inevitably take it out of the room, turn on a light, hurt her sleepy eyes, then read the temperature, and get the thermometer back next to his bed without waking him up. I wanted to fix this problem, and I’ve long been looking for an excuse to hack on an Arduino project. Continue reading…

June 12, 2015

Lightweight Presenters With OpenStruct

I was pairing with a coworker the other day, and we ran into an issue that we have started to encounter more and more since we started to break up our monolithic Rails app into microservices. The problem is complex and requires some background, but the solution, I think, is elegant and simple.

Continue reading…

January 13, 2015

Adding Backbone.js to an Existing Rails App, Part 2

This is part two of a two-part tutorial. If you haven’t already, get up to speed on part one. In the last part, we took a look at getting a Rails app set up with Backbone.js, and introduced some of the modular concepts behind Backbone: models, collections, and views. In this part, we’ll dig in further to templating, as well ashandling user input with Backbone’s Event module. Finally, we’ll refactor our app and improve the user experience.

Let’s get started.

Continue reading…

December 21, 2014

Adding Backbone.js to an Existing Rails App, Part 1

Editor’s note: This tutorial assumes a basic comfortability with basic Rails concepts, as well as running tasks on the command line. An understanding of jQuery is helpful, and while CoffeeScript knowledge isn’t absolutely mandatory, not having a strong aversion to it would be beneficial. This is part one of the tutorial. You can find part two here.

Since the dawn of the rise of front-end JavaScript frameworks, much of the user interface on modern websites has been handled on the client. Single-page applications have become widespread, and users have come to expect a richer, more desktop-like experience. Increasingly, rendering templates on the server and re-rendering the whole page with each request has come to feel slow.

Continue reading…

October 1, 2014

Listening to Backbone.Events

I know I’m late to the party, but I’ve been digging into Backbone.js lately, and I’ve run across a few things that have really tripped me up because I didn’t understand the framework well enough.

In looking at the documentation on listening to events, for example, you find that listenTo does the following: “Tell an object to listen to a particular event on an other object.” Let’s take a look at an example. Continue reading…

June 14, 2014

How to Choose a New Programming Language

I had recently felt like my skills in Ruby had reached a plateau. Not at all because I had learned everything; on the contrary, it’s just now that I’m gaining an understanding of all that I don’t know. Rather, about a month ago, I had felt a stagnation in my skills because all of my programming had been confined to Ruby and JavaScript. And someone recently mentioned the book Apprenticeship Patterns, which suggests that to further our career, programmers learn a new language every year.

Because all of my programming was confined to the two languages I was most comfortable with (and the fact that I didn’t study computer science in college), there were aspects of programming that I had absolutely no concept of. For example, I had been reading a lot of what Steve Klabnik has been writing on the Rust language, and I was immediately out of my element when he started talking about concepts such as pointers, a concept it seems is immediately familiar to programmers of C++. This is to say nothing of manual memory management or other close-to-the-metal concepts.

In light of all this, I decided to begin the foray into a new language in the hopes of broadening my perspective. Continue reading…

January 4, 2014

Testing Ember Models With Jasmine, CoffeeScript, and Rails 4


Getting Ember set up with Jasmine and Rails 4 is tricky. I’ve done the hard part and set up a skeleton Rails app that contains a passing Ember model test as a starting point for your apps. Feel free to fork the repo and start a project if you want to use Jasmine to test your Ember app. For more detail about how to get it working, and a pretty thorough run through of some high- and low-level Ember concepts, read on.

Continue reading…

November 16, 2013

A Public Apology to Nicole Sullivan

I’d like to offer Nicole Sullivan a public apology for dismissing her work. But first, a bit of back story.

Continue reading…

May 11, 2013

Contributing to Rails

I’ve finally gotten around to putting my recent talk on Triaging Rails Issues on my speakerdeck page. The slides are extremely terse, though, and it will probably be easier to follow by watching the video of my talk, embedded here. (Thanks to Dave...

Continue reading…

December 18, 2012

Method Aliases in Ruby

I often find myself wondering why so many of the Ruby native string and array methods have aliases. For example, with string methods, we have next and succ, which are equivalent; they both return the next alphanumeric character. Like so:

          1.9.3p194 :024 > string = "a"
           => "a"
          1.9.3p194 :025 >
           => "b"
          1.9.3p194 :026 > string
           => "a"
          1.9.3p194 :027 > string.succ
           => "b"

So why do we need both? Continue reading…

Page 1 of 2