Just a reminder about git commands, enjoy!
git reset
| # Source : https://github.com/sferik/twitter/issues/517 | |
| def tw_follower_ids | |
| $client.follower_ids.to_a | |
| rescue Twitter::Error::TooManyRequests => error | |
| p error | |
| p 'tw_follower_ids sleep ' + error.rate_limit.reset_in.to_s | |
| sleep error.rate_limit.reset_in | |
| retry | |
| end |
| require 'csv' | |
| require 'twitter' | |
| def twitter_client | |
| @twitter_client ||= Twitter::REST::Client.new do |config| | |
| config.consumer_key = 'XXXXXX' | |
| config.consumer_secret = 'XXXXXX' | |
| config.access_token = 'XXXXXX' | |
| config.access_token_secret = 'XXXXXX' | |
| end |
###pry-rails' Source : https://github.com/rweng/pry-rails
Description : Use pry instead of irb when you call rails console. Pry is a powerful alternative to the standard IRB shell for Ruby. It features syntax highlighting, a flexible plugin architecture, runtime invocation and source and documentation browsing.
###pry-doc' Source : https://github.com/pry/pry-doc
| def abbrev_number(number,decimal) | |
| l=number.to_s.length - 1 | |
| "%.#{decimal}f%s"%[number.to_f/10**(l-l%3)," kMGTPE"[l/3]] | |
| end |
| require "rubygems" | |
| begin | |
| require 'sequel' | |
| rescue LoadError | |
| puts "Please run gem install sequel" | |
| exit! | |
| end | |
| DB = Sequel.connect(:adapter => 'mysql2', | |
| :host => '127.0.0.1', |
| #Simply to do this with rails but how to with ruby only | |
| #Parse | |
| dt = DateTime.parse(issue.updated_at.to_s) | |
| # Convert | |
| local_dt = dt.new_offset(DateTime.now.offset) | |
| # Display | |
| local_dt.strftime("%I:%M %p - %d-%b-%Y") |
| require 'socket' #=> true | |
| IPSocket::getaddress("www.google.com") #=> "74.125.79.147" |