Skip to content

Instantly share code, notes, and snippets.

John Nunemaker jnunemaker

Block or report user

Report or block jnunemaker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jnunemaker / gist:4495290
Created Jan 9, 2013
Web And Mobile Revenue Models
View gist:4495290
jnunemaker / gist:3093898
Created Jul 11, 2012
RubyConf Brazil Talk
View gist:3093898

Addicted to Stable

Stable? In most developer communities, especially Ruby, stable seems nothing short of a curse word. Everyone seems to be addicted to new. I should know, as I once was. Heck, I even own

Over the past few years, my sentiments have changed. Through my experience maintaining and growing a handful of applications, I have grown to respect and love stability.

This talk is jam packed with everything I have learned about building and growing a production application. Stories of mistakes and victories will abound.

jnunemaker / mongodb_slave_synced_time.rb
Created Jun 12, 2012
mogodb get last synced time for slave in master/slave setup
View mongodb_slave_synced_time.rb
db.command(BSON::OrderedHash['serverStatus', 1, 'repl', 1])['repl']['sources'].first['syncedTo']['time']
jnunemaker / mind_blower_ruby19.rb
Created May 30, 2012
Mongo allows objects as _id. _id is always indexed and Mongo knows how to index complex objects.
View mind_blower_ruby19.rb
require 'pp'
require 'rubygems'
require 'mongo'
conn =
db = conn.db('test')
col = db['test']
oid =
jnunemaker / null_object.rb
Created Apr 15, 2012
basic null object
View null_object.rb
# from
class NullObject
def method_missing(*)
def nil?
View fetch_as_assertion.rb
# from
opt = {}.fetch(:required_option)
# IndexError: key not found
opt = {}.fetch(:required_option) do
raise ArgumentError, "Missing option!"
# ArgumentError: Missing option!
jnunemaker /
Created Mar 16, 2012
Two dimensional list prototype in Io
TwoDimensionalList := Object clone
TwoDimensionalList list := List clone
TwoDimensionalList dim := method(x, y,
for(i, 1, y,
self list push(List clone setSize(x))
jnunemaker / heroku_create_app.rb
Created Jan 30, 2012
Simple script that shows how to create heroku app without command line client
View heroku_create_app.rb
require 'rubygems'
require 'highline/import'
require 'heroku'
require 'pp'
email = ask('Email: ')
password = ask('Password: ') { |q| q.echo = false }
client =, password)
View user_presenter_test.rb
class UserPresenterTest < Test::Unit::TestCase
def test_as_json
user = Factory(:user, {
:first_name => 'John',
:last_name => 'Nunemaker',
:email => '',
json =
urls = json['urls']

Posted to the REE Google Group as well:!topic/emm-ruby/EBkMfFpk40A

A week back I innocently updated Sinatra on an app which in turn updated Rack. Since then, I've had crazy hung passenger processes that just gobble up CPU like it is going out of style.

After spending a few days trying everything I knew to to fix it, today I got help from a friend (Eric Lindvall) and dug in with strace, rbtrace, gdb, and gdb.rb and found the issue. Rack 1.3.0 tests a regex against a URL and it causes things to hang.

You can’t perform that action at this time.