Skip to content

Instantly share code, notes, and snippets.

@anoopsankar
anoopsankar / UnicodeFlag.swift
Created July 7, 2021 13:17
Find Unicode / Emoji flag based on country code in Swift 5
func unicodeFlag(countryCode: String) -> String {
// expects a 2-letter ISO code of the country
// Unicode flags are generated by taking the 2 letter ISO code of the country
// and mapping them to the regional indicator symbols. Font ligatures are used
// to make them into a single glymph. A more detailed explanation is available
// here -> https://esham.io/2014/06/unicode-flags
// This code is based on this stackoverflow answer for Java
// https://stackoverflow.com/questions/30494284/android-get-country-emoji-flag-using-locale/35849652#35849652

Keybase proof

I hereby claim:

  • I am anoopsankar on github.
  • I am anoop (https://keybase.io/anoop) on keybase.
  • I have a public key whose fingerprint is F892 85B1 B4F8 C9D2 AB79 D9D6 4EB3 E874 8C30 06FD

To claim this, I am signing this object:

@anoopsankar
anoopsankar / PKCSSigner.java
Last active December 11, 2015 11:38
PKCS#1 digital signature
private byte[] sign(byte[] data, PrivateKey privateKey) throws GeneralSecurityException {
Security.addProvider(new BouncyCastleProvider());
Signature signer = Signature.getInstance("SHA1withRSA", "BC");
signer.initSign(privateKey);
signer.update(data);
return signer.sign();
}
@anoopsankar
anoopsankar / css-flicker.html
Created September 5, 2012 08:52
CSS Flicker Full
<!DOCTYPE html>
<html>
<head>
<title>Flickering Text</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
@anoopsankar
anoopsankar / flicker-text.css
Created September 5, 2012 06:19
CSS Flicker
#text-block .flickr {
color: transparent;
text-shadow: white 0 0 1px;
-webkit-transition: text-shadow 0.2s ease-in-out;
-moz-transition: text-shadow 0.2s ease-in-out;
transition: text-shadow 0.2s ease-in-out;
}