Skip to content

Instantly share code, notes, and snippets.

View notahat's full-sized avatar

Pete Yandell notahat

View GitHub Profile
# On a new ubuntu 14.04 box, as root, with the following variables
# export BUILDBOX_AGENT_NAME="buildbox-agent-N"
# export BUILDBOX_AGENT_ACCESS_TOKEN="<your token here>"
# export BUILDBOX_AGENT_SSH_PRIVATE_KEY="<an ssh private key>"
# export BUILDBOX_AGENT_SSH_PUBLIC_KEY="<an ssh public key>"
# Make tmp totally in memory
echo "none /tmp tmpfs size=4g 0 0" >> /etc/fstab
mount /tmp
class Dependency
def self.foo
puts "Foo"
end
def self.bar
puts "Bar"
end
end
require 'test/unit'
require 'enumerator'
class Array
def in_chunks_of(size_of_chunks)
enum_slice(size_of_chunks).to_a
end
end
class TestArrayInChunks < Test::Unit::TestCase
@notahat
notahat / gist:39132
Created December 22, 2008 21:33 — forked from xaviershay/gist:39075
value = "Don T Alias"
first_name, last_name = value.reverse.split(' ', 2).reverse.collect(&:reverse)
first_name = first_name.to_s
last_name = last_name.to_s
# Refactored to take into account Xavier's pathological aversion to case statements:
words = value.split(' ')
first_name, last_name = if words.size == 0
['', '']
elsif words.size == 1