Skip to content

Instantly share code, notes, and snippets.

View dom111's full-sized avatar
⌨️

Dom Hastings dom111

⌨️
View GitHub Profile
@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[$_])
#!/usr/bin/perl
use strict;
use Getopt::Long;
my $size = 48;
my $dict = 'dict';
my ($name, $board_file, $reprocess_frequencies, $print_board, $print_html, $print_help);
my $help = qq{Hexiled word-tile simulator
This file has been truncated, but you can view the full file.
aal
aalii
aam
aani
aardvark
aardwolf
aaron
aaronic
aaronical
aaronite
javascript:(function(){var a={},b=null,c=null,d=null,e=null,f={},g={color:"#f08",background:"#bbb",shadow:"#fff",fallback:!1},h=window.devicePixelRatio>1,i=function(){var a=navigator.userAgent.toLowerCase();return function(b){return-1!==a.indexOf(b)}}(),j={ie:i("msie"),chrome:i("chrome"),webkit:i("chrome")||i("safari"),safari:i("safari")&&!i("chrome"),mozilla:i("mozilla")&&!i("chrome")&&!i("safari")},k=function(){for(var a=document.getElementsByTagName("link"),b=0;a.length>b;b++)if("icon"===a[b].getAttribute("rel")||"shortcut icon"===a[b].getAttribute("rel"))return a[b];return!1},l=function(){for(var a=document.getElementsByTagName("link"),b=document.getElementsByTagName("head")[0],c=0;a.length>c;c++)("icon"===a[c].getAttribute("rel")||"shortcut icon"===a[c].getAttribute("rel"))&&b.removeChild(a[c])},m=function(a){l();var b=document.createElement("link");b.type="image/x-icon",b.rel="icon",b.href=a,document.getElementsByTagName("head")[0].appendChild(b)},n=function(){return e||(e=document.createElement("canvas
$_=lc<>;die" -
"x3if/[kmvwx]/i;y/chiou/kmvwx/;$i.=(/[acefgopqsz\?0235-9]/?' _ ':$"x3),$m.=(/[abce-hlmopqstuy045689]/?'!':$").(/[abdefhkmnp-twyz\-\?2-689]/?'_':$").(/[adhijopquyz\?0-4789]/?'!':$"),$p.=(/[a-hj-prtuwxz\?0268]/?'!':$").(/[b-egjklostuw-z0235689]/?'_':$").(/[abdg-jmnoqsu-y013-9]/?'!':$")for/./g;print"$i
$m
$p
"
@dom111
dom111 / terminal-colour-data.txt
Created August 21, 2015 11:39
Bash terminal data
0 = #000000 = 0 0 0
1 = #800000 = 0 100 25
2 = #008000 = 120 100 25
3 = #808000 = 60 100 25
4 = #000080 = 240 100 25
5 = #800080 = 300 100 25
6 = #008080 = 180 100 25
7 = #c0c0c0 = 0 0 75
8 = #808080 = 0 0 50
9 = #ff0000 = 0 100 50
@dom111
dom111 / detail.txt
Last active September 25, 2015 17:50
n=1
(Just a space, starting square, never expect this!)
n=4
VNZNT
IFOSN
# Change settings here - colour assumes Bash-like ANSI supported terminal
$colour = 1;
$testing = 0;
$n=<>;
$n+=!($n%2);
@l=split//,'??EEEEEEEEEEEEAAAAAAAAAIIIIIIIIIOOOOOOOONNNNNNRRRRRRTTTTTTLLLLSSSSUUUUDDDDGGGBBCCMMPPFFHHVVWWYYKJXQZ';
if($testing){
map{$m=$_-1;$r[$m]=[map'.',1..$n]}1..$n;
}
santa([['Alice', 'Bob'], ['Carla', 'Dan', 'Erin'], ['Frank'], ['Gary']], {"Bob":["Frank"]});
santa([
[0, 0, 1, 1, 1, 1, 1],
[0, 0, 0, 0, 0, 1, 0],
[1, 1, 0, 0, 0, 1, 1],
[1, 1, 0, 0, 0, 1, 1],
[1, 1, 0, 0, 0, 1, 1],
[1, 1, 1, 1, 1, 0, 1],
[1, 1, 1, 1, 1, 1, 0]
]);