This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to do this algorithm in Smalltalk? Call a function on each pair of elements | |
// in a set once. Do not call func(b,a) if func(a,b) has already been called. | |
var i,j,ray,func; | |
ray = [3,2,11,7,5]; | |
func = function(a,b) { | |
console.log(a + "x" + b + " -> " + a*b); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StoreProductCollaborator | |
def initialize(product_or_id, store_or_id) | |
# I use this pattern everywhere. I would like to abstract it, but | |
# can't think of a good name for the abstraction. | |
@product = Product.find(product_or_id) unless product_or_id.is_a? Product | |
@store = Store.find(store_or_id) unless store_or_id.is_a? Store | |
end | |
# Intended usage examples: | |
# sp1 = StoreProductCollaborator.new(42, 13) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATA.each_line do |line| | |
puts line if line =~ /metasyntactic/ .. line =~ /regular/ | |
end | |
__END__ | |
blah | |
blarg | |
bleem | |
here are some metasyntactic variables | |
foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2) Creating a document as the owner of the bucket behaves like a successful create should create the document | |
Failure/Error: before { @file = api_create @bucket, @key } | |
JSON::ParserError: | |
706: unexpected token at '"{\"key\":\"jwstntycxp\"}"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- ruby -*- | |
require 'test/unit/assertions' | |
class Object | |
def method_missing *args | |
true | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- ruby -*- | |
# This is a fully-functional set of donkey patches that will break | |
# Ruby so badly that it makes all of the Ruby Koans pass right out of | |
# the box. ALl you need to do is patch edgecase.rb with this line: | |
# | |
# require File.expand_path(File.dirname(__FILE__) + '/donkey_patches') | |
# | |
# so it's the first line of the file. Then save this file as |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10:09:09 dbrady@shinything:~/projects (git:develop:928475c) ruby-1.9.2-p290 | |
∫ cd adsel | |
rspec: No such file or directory | |
0.00 real 0.00 user 0.00 sys | |
Usage: | |
db database_file {{key}} {{value}} # set | |
db database_file {{key}} # get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I just created the pants/ folder and put this .rvmrc in it: | |
# | |
# rvm use ruby-1.9.2 | |
# | |
# Note that rake 0.8.7 is the only gem in my global gemset, so | |
# rspec ISN'T EVEN INSTALLED NOW. | |
15:19:50 dbrady@shinything:~/devel/pants ruby-1.9.2-p290@coffer | |
∫ . .rvmrc | |
Using /Users/dbrady/.rvm/gems/ruby-1.9.2-p290 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# After updating rvm, it is surprised and alarmed by .rvmrc files. | |
# It doesn't recognize them as trusted, and then crashes after | |
# approving them. Which means EVERY time I cd inside a project with | |
# an .rvmrc file, this happens: | |
# | |
# (Note that I am in ruby-1.9.2-p290@adsel. The 'coffer' directory | |
# has an .rvmrc file which specifies ruby-1.9.2-p180@coffer.) | |
15:05:52 dbrady@shinything:~/devel ruby-1.9.2-p290@adsel | |
∫ cd coffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Does RVM now use some kind of file db system to remember .rvmrc files? | |
# The beginning of the (rather long) error message makes me wonder... | |
15:44:00 dbrady@shinything:~ | |
∫ cd devel/coffer | |
rspec: No such file or directory | |
0.00 real 0.00 user 0.00 sys | |