Skip to content

Instantly share code, notes, and snippets.

@stefanoverna
Created June 5, 2012 23:39
Show Gist options
  • Select an option

  • Save stefanoverna/2878853 to your computer and use it in GitHub Desktop.

Select an option

Save stefanoverna/2878853 to your computer and use it in GitHub Desktop.
Traccia Talk
require 'ostruct'
require 'bundler'
Bundler.require
include CommandLineReporter
result = RestClient.get "http://www.reddit.com/hot.json"
items = JSON.parse(result)["data"]["children"].map do |item|
OpenStruct.new(item["data"])
end
table(:border => true) do
row header: true, color: :yellow do
column "#" , width: 2 , align: "right"
column "Story" , width: 70
column "Pts/Comms." , width: 10 , align: "right"
column "URL" , width: 20
end
items[0...5].each_with_index do |item, index|
row do
column index + 1
column item.title
column "#{item.score}/#{item.num_comments}"
column Googl.shorten(item.url).short_url
end
end
end
# Launchy.open items.first.url
source :rubygems
gem 'command_line_reporter'
gem 'json'
gem 'googl'
gem 'rest-client', require: 'rest_client'
gem 'launchy'

Questi sono i file minimi per testare il funzionamento del sistema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment