Skip to content

Instantly share code, notes, and snippets.

@elan
Created September 17, 2009 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elan/188637 to your computer and use it in GitHub Desktop.
Save elan/188637 to your computer and use it in GitHub Desktop.
require 'uri'
require 'net/http'
uri = STDIN.gets(nil).strip.delete("\n\r")
unless uri.empty?
begin
escaped_uri = URI.escape("http://api.tr.im/v1/trim_simple?url=#{uri}")
STDOUT << Net::HTTP.get_response(URI.parse(escaped_uri)).body
rescue URI::InvalidURIError
# Do nothing.
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment