Skip to content

Instantly share code, notes, and snippets.

@stepahn
stepahn / wheel o' food.rb
Created April 13, 2010 10:01
wheel 'o food
class Array; def rand; self[Kernel.rand self.length]; end; end
Array.new(rand(100)*2+1){[:pizza, :chinese, :greek].rand}.inject(Hash.new{0}){|h, i| h[i]+=1;h }
@stepahn
stepahn / .gitignore
Created April 22, 2010 13:00
a gitignore for rails
*#
*~
.#*
.DS_Store
.svn
db/*.sql*
db/schema.rb
log/*
tmp/*
test/*
document.createElement('header');
document.createElement('footer');
document.createElement('section');
document.createElement('aside');
document.createElement('nav');
document.createElement('article');
header, footer, section, aside, nav, article {
display: block;
}
$(document).ready(function() {
$("a[rel='external']").attr('target', '_blank');
});
fib = Hash.new {|hash, key| hash[key-1] + hash[key-2]}
fib[0],fib[1] = 0, 1
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Locking environment
Your bundle is already locked, relocking.
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize': not in gzip format (Zlib::GzipFile::Error)
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `new'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:63:in `each'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:54:in `loop'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:54:in `each'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:32:in `initialize'
-----> Heroku receiving push
-----> Rails app detected
-----> Gemfile detected, running Bundler version 1.0.0.rc.5
Unresolved dependencies detected; Installing...
Could not find rake-0.8.7 in any of the sources
FAILED: Have you updated to use a 0.9 Gemfile?
http://docs.heroku.com/gems#gem-bundler
error: hooks/pre-receive exited with error code 1
class W_SimpleObject(object):
def getvalue(self, key = None):
for parent in self.get_mro():
try:
return parent.getval(key)
except KeyError:
pass
return None
class Foo(object):
def f(self, x=None):
print 'hello'
print x
return None
class Bar(Foo):
pass