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
--trace --default 1.9.2 | |
rvm 0.1.38 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/] | |
+ [[ -z '' ]] | |
+ [[ ! -z ruby-1.9.2-preview3 ]] | |
+ rvm_action=use | |
+ [[ ! -z '' ]] | |
+ [[ ! -z '' ]] | |
+ [[ 2 -gt 0 ]] |
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
# ruby -v | |
/usr/local/bin/ruby: 2: source: not found | |
/usr/local/bin/ruby: 2: source: not found | |
/usr/local/bin/ruby: 2: source: not found | |
/usr/local/bin/ruby: 2: source: not found | |
/usr/local/bin/ruby: 2: source: not found | |
/usr/local/bin/ruby: 2: source: not found | |
/usr/local/bin/ruby: 2: source: not found | |
/usr/local/bin/ruby: 2: source: not found | |
/usr/local/bin/ruby: 2: source: not found |
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
$ sudo bundle install | |
/opt/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.beta.1/lib/bundler/source.rb:166:in `block (2 levels) in cached_specs': undefined method `spec' for nil:NilClass (NoMethodError) | |
from /opt/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.beta.1/lib/bundler/source.rb:165:in `each' | |
from /opt/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.beta.1/lib/bundler/source.rb:165:in `block in cached_specs' | |
from /opt/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.beta.1/lib/bundler/source.rb:164:in `each' | |
from /opt/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.beta.1/lib/bundler/source.rb:164:in `cached_specs' | |
from /opt/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.beta.1/lib/bundler/source.rb:144:in `block in fetch_specs' | |
from /opt/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.beta.1/lib/bundler/index.rb:5:in `build' | |
from /opt/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.beta.1/lib/bundler/source.rb:142:in `fetch_specs' | |
from /opt/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.beta.1/lib/bundler/source.rb |
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 Context | |
def initialize(variables) | |
variables.each do |name, value| | |
instance_variable_set("@#{name}", value) | |
end | |
end | |
def run(code, start_line) | |
context = init_context | |
load_variables(context) |
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 -wKU | |
def program_moves(map, moves, modes) | |
%w[L L R R balance] # FIXME: replace with bot logic | |
end | |
require "socket" | |
# USAGE: bot [-r] [BOT_NAME [BOT_PASSWORD [HOST]]] | |
register = ARGV.delete("-r") |
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
input = [ 1, 2, 3, 4, 5, 8, 9, 11, 12, 13, 15 ] | |
# divide the input into runs of consecutive numbers | |
last = input.first | |
s = input.slice_before(lambda { |i| [i != last + 1, (last = i)].first }) | |
# replace runs of 3 or more with first-last | |
p s.map {|runs| runs.size < 3 ? runs : "#{runs.first}-#{runs.last}"} | |
.flatten | |
.join(', ') # => 1-5, 8, 9, 11-13, 15 |
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
require "go/gtp/board" | |
describe Go::GTP::Board do | |
before :all do | |
@string = <<-END_BOARD.gsub(/^ {4}/, "") | |
A B C D E F G H J | |
9 . . . . . . . . . 9 | |
8 . . . . . . . . . 8 | |
7 . . X . . . + . . 7 | |
6 . . . . . . . . . 6 |
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
module Go | |
class GTP | |
class Board | |
STONES = {"X" => "black", "O" => "white"} | |
def initialize(board_string) | |
@string = board_string | |
@array = nil | |
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
<a href="http://reddirtrubyconf.com/?source=speaker"><img src="http://reddirtrubyconf.com/images/125x125_speaker.png" style="width: 125px; height: 125px; margin: 5px; border: 0px;"></a> |
OlderNewer