Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env ruby
require 'net/http'
require 'json'
begin
uri = URI('https://cdn.rawgit.com/github/gemoji/master/db/emoji.json')
resp = Net::HTTP.get_response(uri)
emoji = JSON.parse(resp.body)
num = [ARGV.first.to_i, 1].max
$stdout << emoji.map { |i| i['emoji'] }.sample(num).join(',') << "\n"
rescue Exception => e
$stdout << "ERROR: #{e}\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.