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 Hangman | |
DICTIONARY = %w(pangolin ecstatic oligarchy corridor) | |
MAX = 6 | |
def initialize(input=STDIN, output=STDOUT) | |
@input = input | |
@output = output | |
@guesses = 0 | |
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
# fibonacci.rb | |
class Euler | |
def fib(n) | |
curr = 0 | |
succ = 1 | |
n.downto(0) do |x| | |
curr, succ = curr + succ, curr | |
end | |
return curr |
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 File.expand_path(File.dirname(__FILE__) + '/edgecase') | |
# Greed is a dice game where you roll up to five dice to accumulate | |
# points. The following "score" function will be used calculate the | |
# score of a single roll of the dice. | |
# | |
# A greed roll is scored as follows: | |
# | |
# * A set of three ones is 1000 points | |
# |
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 File.expand_path(File.dirname(__FILE__) + '/edgecase') | |
# Greed is a dice game where you roll up to five dice to accumulate | |
# points. The following "score" function will be used calculate the | |
# score of a single roll of the dice. | |
# | |
# A greed roll is scored as follows: | |
# | |
# * A set of three ones is 1000 points | |
# |
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
Process: Pants [57731] | |
Path: /Users/bhays/Sites/todogroove/mac/pants/Pants.app/Contents/MacOS/Pants | |
Identifier: Pants | |
Version: ??? (???) | |
Code Type: X86-64 (Native) | |
Parent Process: macruby [57728] | |
Date/Time: 2011-07-02 16:39:27.576 -0600 | |
OS Version: Mac OS X 10.6.6 (10J567) | |
Report Version: 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
#WORKS | |
# -*- coding: UTF-8 -*- | |
require 'erb' | |
template = ERB.new <<-EOF | |
<% 0.times do %> | |
<% 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
JBoss Bootstrap Environment | |
JBOSS_HOME: /Users/bhays/torquebox-current/jboss | |
JAVA: java | |
JAVA_OPTS: -Djava.net.preferIPv4Stack=true -Dprogram.name=run.sh -Djava.library.path=/Users/bhays/torquebox-current/jboss/bin/native/lib64 | |
CLASSPATH: /Users/bhays/torquebox-current/jboss/bin/run.jar |
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
rake db:migrate | |
/Users/bhays/.rvm/gems/jruby-head/gems/rake-0.9.2.2/lib/rake/version.rb:2 warning: already initialized constant VERSION | |
/Users/bhays/.rvm/gems/jruby-head/gems/rake-0.9.2.2/lib/rake/version.rb:5 warning: already initialized constant MAJOR | |
/Users/bhays/.rvm/gems/jruby-head/gems/rake-0.9.2.2/lib/rake/version.rb:5 warning: already initialized constant MINOR | |
/Users/bhays/.rvm/gems/jruby-head/gems/rake-0.9.2.2/lib/rake/version.rb:5 warning: already initialized constant BUILD | |
/Users/bhays/.rvm/gems/jruby-head/gems/rake-0.9.2.2/lib/rake/version.rb:5 warning: already initialized constant PATCH | |
/Users/bhays/.rvm/gems/jruby-head/gems/rake-0.9.2.2/lib/rake/version.rb:6 warning: already initialized constant NUMBERS | |
/Users/bhays/.rvm/gems/jruby-head/gems/rake-0.9.2.2/lib/rake.rb:27 warning: already initialized constant RAKEVERSION | |
/Users/bhays/.rvm/gems/jruby-head/gems/rake-0.9.2.2/lib/rake/early_time.rb:17 warning: already initialized constant EARLY | |
/Users/bhays/.rvm/gems/jruby-head/gems/rake-0.9.2.2/lib/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
def exec_command(cmd) | |
IO.popen4( cmd ) do |pid, stdin, stdout, stderr| | |
trap("INT") do | |
puts "caught SIGINT, shutting down" | |
`taskkill /F /T /PID #{pid}` if windows? | |
end | |
stdin.close | |
[ | |
Thread.new(stdout) {|stdout_io| | |
stdout_io.each_line do |l| # This is the line throwing the error... 295 |
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 AnagramFinder | |
def find_anagrams(words) | |
output = [] | |
while (target_word = words.shift) | |
matches = [target_word] | |
words.reject! do |word| | |
matches << word if check_for_anagram(word, target_word) | |
end | |
output << matches | |
end |
OlderNewer