Skip to content

Instantly share code, notes, and snippets.

Hi David
I'm impressed with your back ground and your responsibilities at 37signals. When researching your profile I also found that you have 4.8K followers and have been starred 29 times on GitHub. This speaks volumes to your work and your high technical expertise. I'd love the opportunity to speak with you about a Ruby Engineering role I'm currently working on for Heroku. I'd like to share more details about the position and find out if you or anyone you know would be interested.
Heroku is a Platform as a Service (PaaS) that lets you deploy, run and manage applications written in Ruby, Node.js, Java, Python, Clojure and Scala. Heroku is owned by Salesforce however, we operate as a completely separate entity. This allows us to maintain our technology, culture and the formula that has made us so successful.
Anyway, it would be great to set up sometime to chat. I am more than happy to answer any questions that you might have and it would be great for me to hear about what you are looking for in any potentia
def root(*args)
if defined?(RAILS_ROOT)
args.compact.empty? ? RAILS_ROOT : File.join(RAILS_ROOT, args)
end
end
#!/bin/sh
# git-create-remote-branch <branch_name>
if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 branch_name
exit 127
fi
set branch_name = $1
git push origin origin:refs/heads/${branch_name}
class Poller < Rails::Metal
def process(env)
if env["PATH_INFO"] =~ /^\/poller_rack/
return [200, {"Content-Type" => "text/html"}, ["Hello, World!"]]
end
end
end
# Implementation:
@dhh
dhh / gist:38672
Created December 21, 2008 12:02
case request.format
when :html then render
when :js then render
else head(:not_supported)
end
# vs
respond_to do |format|
format.html
$ ruby ~/Code/rails/railties/bin/rails wonky --edge
create
create README
create .gitignore
create Rakefile
create config.ru
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
class Notifier < ActionMailer::Base
delivers_from 'notifications@example.com'
def welcome(user)
@user = user # available to the view
mail(:subject => 'Welcome!', :to => user.email_address)
# auto renders both welcome.text.erb and welcome.html.erb
end
def goodbye(user)
Dec 9 14:27:03 acc-db-01 [248740.420900] divide error: 0000 [#1] SMP
Dec 9 14:27:03 acc-db-01 [248740.428791] last sysfs file: /sys/devices/system/cpu/cpu15/cache/index2/shared_cpu_map
Dec 9 14:27:03 acc-db-01 [248740.444194] CPU 6
Dec 9 14:27:03 acc-db-01 [248740.450660] Modules linked in: btrfs zlib_deflate crc32c libcrc32c ufs qnx4 hfsplus hfs minix ntfs vfat msdos fat jfs reiserfs xfs exportfs nfs lockd nfs_acl auth_rpcgss sunrpc ipmi_devintf ipmi_si ipmi_msghandler autofs4 bonding fbcon tileblit font bitblit softcursor vga16fb vgastate bnx2 psmouse dell_wmi serio_raw joydev power_meter dcdbas lp parport ses enclosure usbhid hid megaraid_sas
Dec 9 14:27:03 acc-db-01 [248740.516499] Pid: 17864, comm: dsm_sa_snmp32d Not tainted 2.6.32-22-generic #33-Ubuntu PowerEdge R710
Dec 9 14:27:03 acc-db-01 [248740.538698] RIP: 0010:[<ffffffff8105621c>] [<ffffffff8105621c>] find_busiest_group+0x63c/0x900
Dec 9 14:27:03 acc-db-01 [248740.561223] RSP: 0018:ffff880604711b88 EFLAGS: 00010046
Dec 9 14:27:03 acc-
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class BuildStatusTest < ActiveSupport::TestCase
test "remove the old statii" do
assert_equal 2, BuildStatus.count
BuildStatus.expire_old
statii = BuildStatus.all
assert_equal 1, statii.size
assert statii[0].updated_at >= 30.days.ago
end
kendall :: git/rbx » ruby scratch/bm_either.rb
Rehearsal ---------------------------------------------
includes? 4.410000 0.000000 4.410000 ( 4.421223)
either? 6.450000 0.000000 6.450000 ( 6.478906)
compare 2.040000 0.010000 2.050000 ( 2.044516)
----------------------------------- total: 12.910000sec
user system total real
includes? 4.470000 0.000000 4.470000 ( 4.479386)
either? 6.520000 0.000000 6.520000 ( 6.542424)