Last active
December 16, 2015 22:09
-
-
Save remore/5504939 to your computer and use it in GitHub Desktop.
usage: curl -s http://api.stackoverflow.com/1.1/tags | gunzip | ruby add_ltsv_log_stackoverflow.rb
This file contains 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
# usage: curl -s http://api.stackoverflow.com/1.1/tags | gunzip | ruby add_ltsv_log_stackoverflow.rb | |
# note: works even with ruby 1.8.x | |
require 'SimpleJson_jp.rb' # downloaded from http://ruby-webapi.googlecode.com/svn/trunk/misc/SimpleJson/SimpleJson_jp.rb | |
src = ARGF.read | |
parser = JsonParser.new | |
json = parser.parse(src) | |
print Time.now.strftime("date:%Y-%m-%d\t") | |
json['tags'].each do |item| | |
print item['name'] + ":" + item['count'].to_s + "\t" | |
end | |
print "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment