Created
December 16, 2013 07:56
-
-
Save phyous/7983685 to your computer and use it in GitHub Desktop.
The world's simplest twitter client
This file contains hidden or 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
#!/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