2009/02/25

僕の残り短い20代をカウントするスクリプト

待って!まだ逃げていかないで、僕の20代!


#! /usr/bin/ruby

require 'time'
require 'rubygems'
gem 'twitter4r'
require 'twitter'
require 'pit'

require 'open-uri'
require 'kconv'

# Twitter4R バグ回避
require 'cgi'
class Hash
def to_http_str
self.map{|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join("&")
end
end

begin

tday = Date.today
bday = Date.new(2009,3,8)
zday = bday - tday

mess = "The one's twenties of smokeymonkey is " + zday.to_s + " another."

# Ej9F
config = Pit.get("Twitter")
cl = Twitter::Client.new(config)
cl.status(:post,mess)

rescue
print "RuntimeError: ", $!, "\n";
end