Skip to content

Instantly share code, notes, and snippets.

View dom111's full-sized avatar
⌨️

Dom Hastings dom111

⌨️
View GitHub Profile
[
["Maisie",0,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,0,1,1,1,0,1,0,0,1,1,0,0,1,1,1,1,0,1,0,1,0,1,0,0,1,1,0,0,0,1,0,1,0,1,1,0,0,1,1,1,1,0,1,0,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,1,0,1,0,0,1,1,1,0,0,1,1,0,0,0],
["Emilia",0,0,1,0,1,1,0,1,1,1,1,1,1,0,1,1,0,1,1,0,1,0,1,0,0,1,1,1,0,0,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,1,0,0,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,1,1,1,1],
["Willow",1,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,1,1,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,0,0,0,1,0,1,1,0,0,1,1,1,0,1,1,1,0,0,1,1,0],
["Ronnie",1,1,1,0,1,0,1,1,1,0,0,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,0,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1,1,1,1,0,1,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1],
["Scarlett",1,0,1,1,0,1,0,1,1,0,1,1,1,0,0,1,1,1,1,0,1,0,1,0,0,1,1,1,1,1,1,0,0,0,1,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,1,1,1,1,0,0,1,1,1,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);i++){if(!a[i/x|0]){a[i/x|0]=[]}a[i/x|0].push((i%x)==(i/x|0)?0:Math.random()>0.5?1:0)};
JSON.stringify(a);
// names from http://www.independent.co.uk/news/uk/home-news/baby-names-top-100-most-popular-boys-and-girls-names-10459074.html
// because I'm unimaginative!
[
["Aaron",0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
["Abigail",1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
["Adam",1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@dom111
dom111 / fuzzyMatch.js
Last active December 18, 2015 19:39
A (slightly better than the last) go at implementing fuzzy matching in a similar way to the Sublime Text command palette.
(function() {
var z = function(a, s, k){
var a = a.concat(), // copy array
r = [], // create empty array
v,m,l, // containers
e = RegExp('^.*?' + (s.split('').join('.*?')), 'i'); // build fuzzy RE
// iterate all elements
while (l = a.pop()) {
// if we have a key specified, use that
@dom111
dom111 / gist:7517540
Last active July 25, 2016 12:47
Less minified version of answer submission for http://codegolf.stackexchange.com/questions/15301/tut-language-translator Needs a lot of work so saving here
$t = e0bub0kut0dud0i0fuf0jug0hash0ay0jag0kak0lul0mum0nun0o0pup0kwak0rut0sus0tut0yu0vuv0waks0eks0yak0zuz;
@t = split "0", $t."0\U$t";
@s = ("a".."z","A".."Z");
while (<>) {
($-, $_) = split/ /, $_, 2; # split to list with a maximum length of two
# $- is auto-cast as int and sets the mode
%l = map {
# build the lookup, flipping the keys/values depending on mode
($- ? $t[$_] : $s[$_]) => ($- ? $s[$_] : $t[$_])
0000000: 7573 6520 494f 3a3a 556e 636f 6d70 7265 use IO::Uncompre
0000010: 7373 3a3a 4775 6e7a 6970 2071 7728 6775 ss::Gunzip qw(gu
0000020: 6e7a 6970 293b 6775 6e7a 6970 5c27 1f8b nzip);gunzip\'..
0000030: 0800 5c56 b457 0003 4d5b 4b6f 1b3b b3fc ..\V.W..M[Ko.;..
0000040: 2bdc dde5 e1cc f0b9 bcc1 0982 0304 4e60 +.............N`
0000050: c00b af02 3e6d 7d96 257f 2329 be3e bffe ....>m}.%.#).>..
0000060: 5635 4772 920d 8b9a 19be 9add 554d fa7f V5Gr........UM..
0000070: 55ef 3d56 adfe f757 faef 25a9 1c7a 6f19 U.=V...W..%..zo.
0000080: e88b aaba b7de 502c 1fe9 a0b2 c783 09e8 ......P,........
0000090: abea 15ff f9c3 3755 7caf d9a2 f874 dc57 ......7U|....t.W
$input = "A fff9d0 A_aqua b8ffeb A_B d0fefe A_cyan b7fffa A_E fdfdfe A_G c7fdb5 A_gold fdde6c A_L_G b1fc99 A_lavender eecffe A_lilac e4cbff A_lime befd73 A_lime_G b1ff65 A_magenta d767ad A_mauve fed0fc A_N b1916e A_O ffa756 A_olive b9cc81 A_olive_G b1d27b A_P ffcfdc A_peach ffe5ad A_R d9544d A_rose fdc1c5 A_salmon ffb19a A_sky_B bdf6fe A_teal 82cbb2 A_turquoise a5fbd5 A_U b790d4 A_violet ceaefa A_Y ffff84 acid_G 8ffe09 adobe bd6c48 algae 54ac68 algae_G 21c36f almost_black 070d0d amber feb308 amethyst 9b5fc0 apple 6ecb3c apple_G 76cd26 apricot ffb16d aqua 13eac9 aqua_B 02d8e9 aqua_G 12e193 aqua_marine 2ee8bb aquamarine 04d8b2 army_G 4b5d16 asparagus 77ab56 aubergine 3d0734 auburn 9a3001 avocado 90b134 avocado_G 87a922 azul 1d5dec azure 069af3 B 0343df B/E 758da3 B/G 0f9b8e B/U 5a06ef B_B 2242c7 B_E 607c8e B_G 137e6d B_U 5729ce B_violet 5d06e9 B_with_a_hint_of_U 533cc6 baby_B a2cffe baby_G 8cff9e baby_P ffb7ce baby_poo ab9004 baby_poop 937c00 baby_poop_G 8f9805 baby_puke_G b6c406 baby_shit_G 889717 baby_shit_N
@dom111
dom111 / .js
Created November 11, 2016 14:27
n=prompt(),i=1,i/=801**.5-28
for(a=[1,0];--n;i=1/(i-(i|0)))a.unshift(a[1]+a[0]*(i|0))
alert(a[n]) //g:2+s;ssnspnt [i]#,