For the first time ever, I am going to lead with the end of the story. Here is the full ~30 lines that I will break down in detail during the rest of this post. require 'forwardable' module Foo module Instrumenters class Noop def self.instrument(name, payload = {}) yield payload if bl...
I don’t find this post a very persuasive sell for state machines (although I realize the example was designed to be short and easily digestible). There are times when I look at a code base and think “oh good, we’re using XYZ technique, that’ll go smoothly.” I have literally never had ...
October 10, 2012 Posted by John Older: Four Guidelines That I Feel Have Improved My Code Booleans are Baaaaaaaaaad First off, did you pronounce the title of this article like a sheep? That was definitely the intent. Anyway, onward to the purpose of this here text. One of the things I ...
I have seen this around and this morning finally decided to try it out. Thus far I am finding it surprisingly helpful. If you put the following in your bash profile, it will show the current git branch in your terminal prompt. bash profile addition function parse_git_branch { ref=$(gi...
@Luigi – I always took relational to mean ‘mapping relationships between incompatible type systems’ not a literal reference to the most common underlying storage type. Then again I’m self taught so what do I know :P Ignoring the abbreviation aren’t common problems are being repeatedly...
I have been thinking a lot about isolation, dependencies and clean code of late. I know there is a lot of disagreement with people vehemently standing in both camps. I certainly will not say either side is right or wrong, but what follows is what I feel has improved my code. I post it...
The other day I wanted to do some queries in production, but our servers are pretty locked down to the outside world. I was well aware that I could just make an ssh tunnel to connect to the database server, but I decided I wanted to do it in Ruby. I am not the brightest of crayons in ...
The other day I was explaining the difference between class and instance methods to a friend and I realized that I should probably write up a post. I figured since I’m on a plane headed back home, now was as good of time as ever. If you want a little history, you can read about the di...
A few weeks back, we publicly released the Gauges API . Despite building Gauges from the ground up as an API , it was a lot of work. You really have to cross your t’s and dot your i’s when releasing an API . 1. Document as You Build We made the mistake of documenting after most of the...
October 14, 2010 Posted by John Tagged rants Older: Building an Object Mapper: Override-able Accessors Newer: The Chain Gang Stop Googling Yesterday, one of my inter-web buddies IM’d me and asked if I had used Typhoeus before. I said yes, so he asked me if it was possible to follow re...
GitHub is awesome, really awesome for open source projects and for projects with multiple people. In fact, if you use your own git setup for an open source project, you are most likely hindering your project’s progress and wasting your time . On the other side of the coin, if you are ...
The only people that don’t like “unless” are either: A) Old school programmers, which I can understand. B) Blog followers, the people that let the hip blogs choose their mindset. I’ve personally thought, from back in my C/C++ days, that “if not” sounded like the most obscure piece of ...
In a certain application that I’m working on, accounts have subdomains. Nothing new. The column name I used for subdomain in the accounts table was…wait for it…subdomain! DHH’s account_location plugin , however, assumes username as the default attribute. Whatever was I to do? I liked ...
I have been using mongo and MM for a project the last few months. I was initially very enthusiastic but as my data model has gotten more complex, I struggled to map it to the mongo way of thinking. Mongo does not do joins, so you are encouraged to store things hierarchically. So if I ...
I’m definitely excited about the direction Heroku is going. I briefly used them for a production site a year ago, when they were still in the “Toy in the cloud” phase. It seemed very promising back then, but ultimately it was too slow and limited for us. I’ve played with it recently a...
March 21, 2011 Posted by John Tagged analytics , gauges , and statsd Older: Give Yourself Constraints Newer: SSH Tunneling in Ruby Hi My Name is John... …and I am addicted to analytics. It all started when I was a wee lad. I quite enjoyed playing Tecmo NBA Basketball, among other game...
Great writeup. Glad you’re finding Shoulda feels good. A few common requests and complaints have floated around Shoulda for some time. “How do I use context with Shoulda macros?” “I don’t like Shoulda’s string evaluation.” (should_redirect_to ‘login_url’ in your example above) “Should...
March 05, 2012 Posted by John Tagged gauges and kestrel Older: More Tiny Classes Misleading Title About Queueing I don’t know about you, but I find it super frustrating when people blog about cool stuff at the beginning of a project, but then as it grows, they either don’t take the ti...
I relate to your testimonial here, as I do believe it’s the most accurate description of how to achieve proficiency at something. Another fellow programmer gave his opinion on the matter, and I would like to reproduce my comment on his post here: This discussion about “Inate Talent” v...
Update (6/13/2008): I posted a bit more on the topic with example uses in the wild . First, let me preface this article with a fact: I’m new to Ruby, however, new is relative in that statement. I’ve been toying with Ruby for over a year but only in the last two months have I really st...
My last post, Keep ’Em Separated , made me realize I should start sharing more about what we are doing to make Gauges maintainable. This post is another in the same vein. Gauges allows you to share a gauge with someone else by email. That email does not have to exist prior to your add...