Created
July 13, 2016 04:50
-
-
Save zhuochun/2635899056e03caf4cd2bd54ad54ad4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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