Skip to content

Instantly share code, notes, and snippets.

@timothyandrew
timothyandrew / remspc.rb
Created October 14, 2011 11:37
remove spaces
#!/usr/bin/env ruby
str = " this is some text with spaces in it "
puts str.split.join
#Output: thisissometextwithspacesinit

README

Solve the XKCD Bridge puzzle

$ ./bridge-test.rb
Loaded suite ./bridge-test
Started
C and D crossed over in 2 minutes.
D crossed back in 1 minutes.
@timothyandrew
timothyandrew / README.md
Created October 12, 2011 13:29
Number in 'Words'

README

  • This ruby script converts a number to it's text form. For example, 542 is five hundred and forty two.

  • Use the download button above to grab a copy.

  • This requires a ruby version > 1.9

$ ruby -v 
@timothyandrew
timothyandrew / fbuzz.rb
Created September 16, 2011 15:04
FizzBuzz
#!/usr/bin/env ruby
for i in 1..100
if(i % 5 == 0 and i % 3 == 0)
puts "FizzBuzz"
elsif(i % 3 == 0)
puts "Fizz"
elsif(i % 5 == 0)
puts "Buzz"
else
@timothyandrew
timothyandrew / output.png
Created September 12, 2011 17:32
Codebrawl #10
output.png