Skip to content

Instantly share code, notes, and snippets.

@karuppasamy
Created September 4, 2019 08:09
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 karuppasamy/088abe51e22b5b513edb825dadfb83a2 to your computer and use it in GitHub Desktop.
Save karuppasamy/088abe51e22b5b513edb825dadfb83a2 to your computer and use it in GitHub Desktop.
Country flag by country code
// ruby
(->code { code.codepoints.map { |cp| cp + 127397 }.pack('U*') }).('GB') => "🇬🇧"
// javascript
(code => String.fromCodePoint(...[...code].map(c => 127397 + c.charCodeAt())))('GB') => "🇬🇧"
@karuppasamy
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment