Skip to content

Instantly share code, notes, and snippets.

View Crissov's full-sized avatar

Christoph Päper Crissov

  • Aachen, Germany
View GitHub Profile
@Crissov
Crissov / palette.js
Created May 26, 2017 10:23
Make a smaller palette of Emojione colors and find closest equivalents
// intended to be run with Node.js: `node palette.js > palette-conversion.txt`
const filename = 'emojione.sprites.png';
const colors = require('./palette.json'); // an array of objects, where each object has 3 numeric values "r", "g" and "b"
var neuquant = require('neuquant'); // https://github.com/devongovett/neuquant
var PNG = require('png-js'); // https://github.com/devongovett/png.js
PNG.decode(filename, function(pixels) {
// pixels is a 1D array (in RGBA order) of decoded pixel data
var pal = neuquant.getPalette(pixels, 1);
var ipal = [];
@Crissov
Crissov / transform.svg.md
Last active April 24, 2017 11:41
SVG transformations

Standardized

matrix(a, b, c, d, e, f) = [a b c d e f]
translate(tx, ty=0)      = [1 0 0 1 tx ty] 
scale(sx, sy=sx)         = [sx 0 0 sy 0 0]
rotate(α)                = [cos(α) sin(α) -sin(α) cos(α) 0 0]
rotate(α, cx=0, cy=0)    = [1 0 0 1 cx cy] [cos(α) sin(α) -sin(α) cos(α) 0 0] [1 0 0 1 -cx -cy]
skewX(α)                 = [1 0 tan(α) 1 0 0]
skewY(α) = [1 tan(α) 0 1 0 0]
@Crissov
Crissov / US-CA_twemoji.svg
Last active April 7, 2017 19:21
SVG Flag of California with an emoji Bear Face 🐻 from Twitter’s Twemoji
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Crissov
Crissov / fb-emoji-scraper.js
Last active August 15, 2018 16:34
Scrape Facebook emojis
let content_security_policy = "script-src 'self'; object-src 'self' https://www.facebook.com/"; // for running in Chrome's JS console
/* Let’s see which Unicode 10.0 emojis Facebook already supports.
<https://github.com/Crissov/unicode-proposals/issues/254#issuecomment-284831620> */
let myEmojis = new Map([
['1f6f7', 'U+1F6F7 🛷 SLED'],
['1f6f8', 'U+1F6F8 🛸 FLYING SAUCER'],
['1f91f', 'U+1F91F 🤟 I LOVE YOU HAND SIGN'],
['1f928', 'U+1F928 🤨 FACE WITH ONE EYEBROW RAISED'],
['1f929', 'U+1F929 🤩 GRINNING FACE WITH STAR EYES'],
['1f92a', 'U+1F92A 🤪 GRINNING FACE WITH CRAZY EYES'],
@Crissov
Crissov / ISO_3166-1_alpha-2_compatibility_codes.md
Last active November 13, 2022 05:23
Unicode emoji flag codes for countries that are no more.

UTR#51 actually uses Unicode CLDR region codes for legal/required pairs of Regional Indicator Symbol Letters U+1F1E6–FF, but they are virtually identical to current ISO 3166-1 alpha-2 code elements. Some codes, however, had once been part of ISO 3166 but have since been deleted (and either exceptionally or transitionally reserved) or are indeterminately reserved for compatibility with other international standards. Some exceptional reservations are part of CLDR. Most transitional reservations now have ISO 3166-3 alpha-4 codes, which Unicode does not intend to support. Indeterminate reservations have been very rarely assigned to new countries and this probably won’t happen again.

Anyhow, many of the currently re