Skip to content

Instantly share code, notes, and snippets.

@remore
Last active December 16, 2015 22:09
Show Gist options
  • Save remore/5504939 to your computer and use it in GitHub Desktop.
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
# 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