Skip to content

Instantly share code, notes, and snippets.

View nummi's full-sized avatar
😺
Working from home

Jerry Nummi nummi

😺
Working from home
View GitHub Profile
function getFlagEmoji(countryCode) {
const codePoints = countryCode
.toUpperCase()
.split('')
.map(char => 127397 + char.charCodeAt());
return String.fromCodePoint(...codePoints);
}
;(function () {
const on = window.addEventListener
let parent = null
const _post = function () {
parent.postMessage(
{
type: 'FRAME_HEIGHT',
height: document.documentElement.scrollHeight,
},
@nummi
nummi / machine.js
Created February 3, 2021 17:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@nummi
nummi / machine.js
Created January 4, 2021 18:07
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
export default class DidLoadElement extends HTMLElement {
constructor() {
super();
const shadow = this.attachShadow({ mode: "open" });
}
static get observedAttributes() {
return ["loaded"];
}
@nummi
nummi / iOS-colors.css
Created July 16, 2019 03:15
iOS Colors
.theme--light {
--SystemRed: rgba(255, 59, 48, 1);
--SystemOrange: rgba(255, 149, 0, 1);
--SystemYellow: rgba(255, 204, 0, 1);
--SystemGreen: rgba( 52, 199, 89, 1);
--SystemTeal: rgba( 90, 200, 250, 1);
--SystemBlue: rgba( 0, 122, 255, 1);
--SystemIndigo: rgba( 88, 86, 214, 1);
--SystemPurple: rgba(175, 82, 222, 1);
--SystemPink: rgba(255, 45, 85, 1);
@nummi
nummi / preview.sh
Created June 24, 2019 16:31 — forked from searls/preview.sh
A script I wrote to preview a build directory (in my case Hugo's `public` folder, but adjust to taste).
#!/bin/sh
port=${1-1919}
# 1. Navigate to the built folder & start a server in it
cd public
python -m SimpleHTTPServer "$port" &
server_pid=$!
# 2. Trap any killing of this process so that we kill the backgrounded server
import { helper } from '@ember/component/helper';
import { htmlSafe } from '@ember/string';
export function matchDigits([value, max, pad]) {
max = max.toString();
value = value.toString();
return htmlSafe(
value.length >= max.length ? value : new Array(max.length - value.length + 1).join(pad) + value
);
}
@nummi
nummi / easing.css
Created August 29, 2018 05:48 — forked from bendc/easing.css
Easing CSS variables
:root {
--ease-in-quad: cubic-bezier(.55, .085, .68, .53);
--ease-in-cubic: cubic-bezier(.550, .055, .675, .19);
--ease-in-quart: cubic-bezier(.895, .03, .685, .22);
--ease-in-quint: cubic-bezier(.755, .05, .855, .06);
--ease-in-expo: cubic-bezier(.95, .05, .795, .035);
--ease-in-circ: cubic-bezier(.6, .04, .98, .335);
--ease-out-quad: cubic-bezier(.25, .46, .45, .94);
--ease-out-cubic: cubic-bezier(.215, .61, .355, 1);
/// <reference path="../../../../node_modules/@types/jszip/index.d.ts" />
const JSZIP_URL = 'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.5/jszip.min.js';
function loadJSZip() {
return new Promise((resolve, reject) => {
vsRequire([JSZIP_URL], (script) => {
resolve(script);
});
});