Skip to content

Instantly share code, notes, and snippets.

View JEG2's full-sized avatar

James Edward Gray II JEG2

View GitHub Profile
We couldn’t find that file to show.
--trace --default 1.9.2
rvm 0.1.38 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
+ [[ -z '' ]]
+ [[ ! -z ruby-1.9.2-preview3 ]]
+ rvm_action=use
+ [[ ! -z '' ]]
+ [[ ! -z '' ]]
+ [[ 2 -gt 0 ]]
# 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
$ 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
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)
@JEG2
JEG2 / bot
Created August 19, 2010 18:58
#!/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")
@JEG2
JEG2 / gist:570556
Created September 8, 2010 18:22 — forked from pragdave/gist:570434
Trying to remove some noise, but I don't think I helped.
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
@JEG2
JEG2 / board_spec.rb
Created September 23, 2010 04:02
I wish all of these satisfy calls weren't needed to pass warnings
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
@JEG2
JEG2 / board.rb
Created September 23, 2010 15:02
module Go
class GTP
class Board
STONES = {"X" => "black", "O" => "white"}
def initialize(board_string)
@string = board_string
@array = nil
end
@JEG2
JEG2 / speaker_badge.html
Created February 8, 2011 16:16
A speaker badge for Red Dirt speakers.
<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>