Skip to content

Instantly share code, notes, and snippets.

@pixeldesu
Created November 15, 2014 23:44
Show Gist options
  • Save pixeldesu/877cc78a2c60a9c87d0f to your computer and use it in GitHub Desktop.
Save pixeldesu/877cc78a2c60a9c87d0f to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "twitter"
# Twitter client configuration
client = Twitter::REST::Client.new do |config|
config.consumer_key = YOUR_KEYS_HERE
config.consumer_secret = YOUR_KEYS_HERE
config.access_token = YOUR_KEYS_HERE
config.access_token_secret = YOUR_KEYS_HERE
end
bottles = 99
loop do
if bottles > 2
text = "#{bottles} bottles of beer on the wall, #{bottles} bottles of beer.\nTake one down and pass it around, #{bottles - 1} bottles of beer on the wall."
bottles -= 1
elsif bottles > 1
text = "#{bottles} bottles of beer on the wall, #{bottles} bottles of beer.\nTake one down and pass it around, #{bottles - 1} bottle of beer on the wall."
bottles -= 1
elsif bottles > 0
text = "#{bottles} bottle of beer on the wall, #{bottles} bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall."
bottles -= 1
elsif bottles == 0
bottles = 99
text = "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, #{bottles} bottles of beer on the wall."
end
client.update text
sleep 15
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment