Skip to content

Instantly share code, notes, and snippets.

beer = 3
while beer > 1
# Repeat what's in here as long as it's TRUE that the counter is greater than zero
puts "#{beer} bottles of beer on the wall, #{beer} bottles of beer! Take one down and pass it around,"
beer = beer - 1
if beer > 1
puts "#{beer} bottles of beer on the wall."
else
@racbarn
racbarn / gist:926502
Created April 18, 2011 23:21
better beers
beer = 5
while beer > 0
# Repeat what's in here as long as it's TRUE that the counter is greater than zero
puts "#{beer} bottles of beer on the wall, #{beer} bottles of beer! Take one down and pass it around,"
beer = beer - 1
if beer > 0
puts "#{beer} bottles of beer on the wall."
else
@racbarn
racbarn / gist:926499
Created April 18, 2011 23:19
final 99 beers
beer = 5
while beer > 0
# Repeat what's in here as long as it's TRUE that the counter is greater than zero
puts "#{beer} bottles of beer on the wall, #{beer} bottles of beer! Take one down and pass it around,"
beer = beer - 1
puts "#{beer} bottles of beer on the wall."
end
puts 'There are no bottles of beer on the wall, no bottles of beer, you can\'t take any down or pass \'em around, there are no bottles of beer on the wall.'
@racbarn
racbarn / toc.rb
Created April 18, 2011 22:36
Table of contents
line_width = 25
puts 'Table of Contents'.center(line_width)
puts 'Chapter 1: Getting Started'.ljust(line_width) + 'page 1'.rjust(line_width)
puts 'Chapter 2: Numbers'.ljust(line_width) + 'page 9'.rjust(line_width)
puts 'Chapter 3: Letters'.ljust(line_width) + 'page 13'.rjust(line_width)
@racbarn
racbarn / gist:902782
Created April 5, 2011 00:31
new gist
require 'rubygems'
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
@racbarn
racbarn / gist:902769
Created April 5, 2011 00:23
one more time...
require 'rubygems'
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
@racbarn
racbarn / gist:902744
Created April 5, 2011 00:10
almost there
require 'rubygems'
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
@racbarn
racbarn / gist:902631
Created April 4, 2011 22:46
and now...
require 'rubygems'
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
@racbarn
racbarn / gist:902623
Created April 4, 2011 22:41
the whole thing :)
require 'rubygems'
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
def run
puts "Welcome to the JSLTwitter Client"
command = ""
until command == "q"
puts "Enter Command:"
input = gets.chomp
command = input.split.first
message = input.split[1..-1].join(" ")