Skip to content

Instantly share code, notes, and snippets.

@phyous
Created December 16, 2013 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phyous/7983685 to your computer and use it in GitHub Desktop.
Save phyous/7983685 to your computer and use it in GitHub Desktop.
The world's simplest twitter client
#!/usr/bin/env ruby
########################
# The world's simplest twitter client
# 1- Get an API key form https://dev.twitter.com with read/write access, enter details below @'ENTER_HERE'
# 2- gem install twitter
# 3- ./post
# 4- Start posting
########################
require "rubygems"
require "twitter"
TWITTER_CONSUMER_KEY = 'ENTER_HERE'
TWITTER_CONSUMER_SECRET = 'ENTER_HERE'
TWITTER_ACCESS_TOKEN = 'ENTER_HERE'
TWITTER_ACCESS_SECRET = 'ENTER_HERE'
Twitter.configure do |config|
config.consumer_key = TWITTER_CONSUMER_KEY
config.consumer_secret = TWITTER_CONSUMER_SECRET
config.oauth_token = TWITTER_ACCESS_TOKEN
config.oauth_token_secret = TWITTER_ACCESS_SECRET
end
client = Twitter::Client.new
# Set Tab and Window title for terminal
TAB_NAME = "TWITTER STREAM"
puts "\e]1;#{TAB_NAME}\a"
puts "\e]2;#{TAB_NAME}\a"
system "clear" unless system "cls"
while true
post = gets
break if post == "exit\n"
next if post == "\n"
client.update(post)
puts "..."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment