Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active March 24, 2020 22:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save havenwood/4f665a37b146f3829fcaac75523d87ff to your computer and use it in GitHub Desktop.
Save havenwood/4f665a37b146f3829fcaac75523d87ff to your computer and use it in GitHub Desktop.
Country Emoji
COUNTRY_LETTERS = 'A'.upto('Z').with_index(127462).to_h.freeze
def country_emoji(iso)
COUNTRY_LETTERS.values_at(*iso.chars).pack('U*')
end
country_emoji('GB')
#=> "🇬🇧"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment