Skip to content

Instantly share code, notes, and snippets.

General key themes:

  • Hiring is really hard. You’re not just hiring a “Rails Engineer” or a “Python Programmer” you’re hiring someone who can help you change the world. Tell them why! Talk about the hard problems you’re solving. 2/3 of these talks give ideas and insight into hiring from sourcing to actual interview processes.

  • Rewriting systems is hard. People think they are going to replace their broken down horse and buggie with a bullet train and this often ends up in disaster. Successful rewrites require an incremental approach that takes months/years and often runs way over schedule. 2/3 of these talks go over how to handle rewrites not only from a high level technical perspective but a cultural/management perspective as well.

Two Developers, Many Lines of Code, and A Campaign that Made History

Harper Reed (CTO of Obama for America, now CEO of Modest) and Dylan Richard (Director of Eng of Obama for America, now CTO of Modest)

#!/bin/sh
git rebase --interactive --autosquash \
$(git merge-base $(git symbolic-ref --short HEAD) master)
@codeslinger
codeslinger / gist:6389
Created August 20, 2008 15:21
Recursive, iterative and tail-recursive performance test for X86 (with factorial)
/*
* Test for recursive, tail-recursive and iterative functions
* solving the same problem (factorial) to test execution speed
* on an X86 processor.
*
* Found:
* http://mpathirage.com/recursion-non-recursion-and-tail-recursion-test/
*
* Cleaned up by Toby DiPasquale <toby@cbcg.net>
*
if ENV['BENCHMARK_TESTS'] && ENV['BENCHMARK_TESTS'] == 'on'
class Test::Unit::TestCase
# Replaces the regular Test::Unit::TestCase#run method with one that
# does benchmarking of each test method in a test case
def run result
yield(STARTED, name)
@_result = result
begin
setup
{:one => 1, :two => 2}.map {|k,v| k == :one ? v : nil}.compact
(in /Users/toby/code/friendly)
All dependencies seem to be installed.
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/json-1.1.3/lib/json/common.rb:60: warning: already initialized constant State
.................................................................................FFFFFFF.........................................................................................................................................
1)
NoMethodError in 'Friendly::DataStore retrieving all based on a query gets the data from the dataset for the klass and makes it an arary'
undefined method `map' for nil:NilClass
/Users/toby/code/friendly/spec/../lib/friendly/data_store.rb:20:in `all'
./spec/unit/data_store_spec.rb:29:
require 'yaml'
class Hash
def filter(*keys)
self.inject({}) {|h,(k,v)| h[k] = v if keys.include?(k); h}
end
end
test_hash = {'one' => 1, 'two' => 2, 'three' => 3}
puts test_hash.to_yaml
# Power law (log tail) distribution
# Copyright(C) 2010 Salvatore Sanfilippo
# this code is under the public domain
# min and max are both inclusive
# n is the distribution power: the higher, the more biased
def powerlaw(min,max,n)
max += 1
pl = ((max**(n+1) - min**(n+1))*rand() + min**(n+1))**(1.0/(n+1))
max-1-pl.to_i
@codeslinger
codeslinger / foo.rb
Created March 16, 2010 20:57
problem with module attribute keeping value over multiple Rails requests
#
# -=[ Problem ]=-
#
# On the first Rails request, after calling Foo.configure in
# config/environments/development.rb, @@provider is the correct
# object and so Foo.doit() succeeds. On the second request, though,
# it raises the ArgumentError b/c @@provider is now nil. What am I
# doing wrong?
#
# This file lives in lib/foo.rb in a Rails 2.3.5 project
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#