Skip to content

Instantly share code, notes, and snippets.

@nicolasmlv
Created January 17, 2016 17:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolasmlv/2d79473bd93e1ec56f34 to your computer and use it in GitHub Desktop.
Save nicolasmlv/2d79473bd93e1ec56f34 to your computer and use it in GitHub Desktop.
## Hints for using emojione set with gemoji :
# replace images folder (images/emojione/unicode with https://github.com/Ranks/emojione/tree/master/assets/png)
# remove db/emojione.json
# bundle console ->
require 'JSON'
require 'open-uri'
emojione_json_url = "https://raw.githubusercontent.com/Ranks/emojione/master/emoji.json"
json_result = JSON.load(open(emojione_json_url)).map do |key, dict|
{
"emoji" => dict["unicode"].split('-').map { |code| [code.to_i(16)].pack('U') }.join(''),
"description" => dict["name"],
"aliases" => [ key ],
"tags" => dict["keywords"]
}
end
File.open("db/emojione.json","w") do |f|
f.write(json_result.to_json)
end
# I am able to use https://github.com/github/gemoji/pull/85/ to emojify unicode💩 to <img>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment