This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const removeDiacritics = (function() { | |
const map = { | |
A: '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F', | |
AA: '\uA732', | |
AE: '\u00C6\u01FC\u01E2', | |
AO: '\uA734', | |
AU: '\uA736', | |
AV: '\uA738\uA73A', | |
AY: '\uA73C', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// travel tickets | |
// Output order of travels, from start to end | |
var cities = 'Seattle, San Francisco, Austin, New York, Los Angeles, Portland, Chicago, Shanghai'.split(', '); | |
var count = 150; | |
var trip = []; | |
for (var i = 0; i < count; i++) { | |
var start = pickRand(cities); | |
var end = pickRand(cities); | |
while (end === start) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lookups = { | |
1: [''], | |
2: ['a', 'b', 'c'], | |
3: ['d', 'e', 'f'], | |
4: ['g', 'h', 'i'], | |
5: ['j', 'k', 'l'], | |
6: ['m', 'n', 'o'], | |
7: ['p', 'q', 'r', 's'], | |
8: ['t', 'u', 'v'], | |
9: ['w', 'x', 'y', 'z'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const coins = [100,25,10,5,1]; | |
const optimal = coinCount(48); | |
console.log(coinCount(25, without(coins, 25))); | |
console.log( | |
optimal.map(n => coinCount(n)).join('\n') | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MovingAverage(size) { | |
this.buckets = []; | |
while (1 + size--) { | |
this.buckets.push(0); | |
} | |
this.i = 0; | |
this.average = 0; | |
} | |
MovingAverage.prototype.add = function add(n) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function nodePromise(fn) { | |
return new Promise((resolve, reject) => { | |
fn((err, res) => err ? reject(err) : resolve(res)); | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="style.css"> | |
<style> | |
textarea { | |
width: calc(100% - .5em); | |
height: 50vh; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"emoji": "๐", | |
"name": "GRINNING FACE", | |
"code": "U+1F600" | |
}, { | |
"emoji": "๐", | |
"name": "GRINNING FACE WITH SMILING EYES", | |
"code": "U+1F601" | |
}, { | |
"emoji": "๐", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var emojis = ["๐","๐","๐","๐","๐","๐ ","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","โบ๏ธ","๐","๐ค","๐","๐ค","๐ค","๐","๐","๐ถ","๐","๐","๐ฃ","๐ฅ","๐ฎ","๐ค","๐ฏ","๐ช","๐ซ","๐ด","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐ค","๐ฒ","๐ท","๐ค","๐ค","โน๏ธ","๐","๐","๐","๐","๐ค","๐ข","๐ญ","๐ฆ","๐ง","๐จ","๐ฉ","๐ฌ","๐ฐ","๐ฑ","๐ณ","๐ต","๐ก","๐ ","๐","๐ฟ","๐น","๐บ","๐","โ ๏ธ","๐ป","๐ฝ","๐พ","๐ค","๐ฉ","๐บ","๐ธ","๐น","๐ป","๐ผ","๐ฝ","๐","๐ฟ","๐พ","๐","๐","๐","๐ฆ","๐ฆ๐ป","๐ฆ๐ผ","๐ฆ๐ฝ","๐ฆ๐พ","๐ฆ๐ฟ","๐ง","๐ง๐ป","๐ง๐ผ","๐ง๐ฝ","๐ง๐พ","๐ง๐ฟ","๐จ","๐จ๐ป","๐จ๐ผ","๐จ๐ฝ","๐จ๐พ","๐จ๐ฟ","๐ฉ","๐ฉ๐ป","๐ฉ๐ผ","๐ฉ๐ฝ","๐ฉ๐พ","๐ฉ๐ฟ","๐ด","๐ด๐ป","๐ด๐ผ","๐ด๐ฝ","๐ด๐พ","๐ด๐ฟ","๐ต","๐ต๐ป","๐ต๐ผ","๐ต๐ฝ","๐ต๐พ","๐ต๐ฟ","๐ถ","๐ถ๐ป","๐ถ๐ผ","๐ถ๐ฝ","๐ถ๐พ","๐ถ๐ฟ","๐ฑ","๐ฑ๐ป","๐ฑ๐ผ","๐ฑ๐ฝ","๐ฑ๐พ","๐ฑ๐ฟ","๐ฎ","๐ฎ๐ป","๐ฎ๐ผ","๐ฎ๐ฝ","๐ฎ๐พ","๐ฎ๐ฟ","๐ฒ","๐ฒ๐ป","๐ฒ๐ผ","๐ฒ๐ฝ","๐ฒ๐พ","๐ฒ๐ฟ","๐ณ","๐ณ๐ป","๐ณ๐ผ","๐ณ๐ฝ","๐ณ๐พ","๐ณ๐ฟ","๐ท","๐ท๐ป","๐ท๐ผ","๐ท๐ฝ","๐ท๐พ","๐ท๐ฟ","โ๏ธ","๐ธ","๐ธ๐ป","๐ธ๐ผ","๐ธ๐ฝ","๐ธ๐พ","๐ธ๐ฟ","๐","๐๐ป","๐๐ผ","๐๐ฝ","๐๐พ","๐๐ฟ","๐ต๏ธ","๐ต๏ธ๐ป","๐ต๏ธ๐ผ","๐ต๏ธ๐ฝ","๐ต๏ธ๐พ","๐ต๏ธ๐ฟ","๐ ","๐ ๐ป","๐ ๐ผ","๐ ๐ฝ","๐ ๐พ","๐ ๐ฟ","๐ฐ","๐ฐ๐ป","๐ฐ๐ผ","๐ฐ๐ฝ","๐ฐ๐พ","๐ฐ๐ฟ","๐ผ","๐ผ๐ป","๐ผ๐ผ","๐ผ๐ฝ","๐ผ๐พ","๐ผ๐ฟ","๐","๐๐ป","๐๐ผ","๐๐ฝ","๐๐พ","๐๐ฟ","๐","๐๐ป","๐๐ผ","๐๐ฝ","๐๐พ","๐๐ฟ","๐","๐๐ป","๐๐ผ","๐๐ฝ","๐๐พ","๐๐ฟ","๐","๐ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<input type="file" id="files" name="files[]" multiple /> | |
<output id="list"></output> | |
<script> |