Skip to content

Instantly share code, notes, and snippets.

@karuppasamy
Created September 4, 2019 08:09
Show Gist options
  • Select an option

  • Save karuppasamy/088abe51e22b5b513edb825dadfb83a2 to your computer and use it in GitHub Desktop.

Select an option

Save karuppasamy/088abe51e22b5b513edb825dadfb83a2 to your computer and use it in GitHub Desktop.

Revisions

  1. karuppasamy created this gist Sep 4, 2019.
    5 changes: 5 additions & 0 deletions country_flag_by_country_code
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    // ruby
    (->code { code.codepoints.map { |cp| cp + 127397 }.pack('U*') }).('GB') => "🇬🇧"

    // javascript
    (code => String.fromCodePoint(...[...code].map(c => 127397 + c.charCodeAt())))('GB') => "🇬🇧"