Skip to content

Instantly share code, notes, and snippets.

@tit
Last active August 29, 2015 14:16
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 tit/015da6835188e9179026 to your computer and use it in GitHub Desktop.
Save tit/015da6835188e9179026 to your computer and use it in GitHub Desktop.
Typograf
# encoding: utf-8
require 'unirest'
class String
def typograf
api_uri = 'http://www.typograf.ru/webservice/'
begin
response = Unirest.post api_uri, parameters: {text: self}
response.body
rescue
self
end
end
end
# Use Typograf from CLI
if __FILE__ == $0
if ARGV[0].nil?
puts 'usage: typograf text'
puts 'example: typograf "foo - bar"'
else
puts ARGV[0].typograf
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment