This file contains 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
/* | |
https://stackoverflow.com/a/15252131/3619158 | |
The algorithm is very simple: loop through needle letters and check if they occur in the same order in the haystack: | |
*/ | |
String.prototype.fuzzy = function (s) { | |
var hay = this.toLowerCase(), i = 0, n = -1, l; | |
s = s.toLowerCase(); | |
for (; l = s[i++] ;) if (!~(n = hay.indexOf(l, n + 1))) return false; | |
return true; |
This file contains 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 items = [ | |
{ key1: "el200", key2: "id001", value: "bulb tumeric hell of hot chicken" }, | |
{ key1: "el200", key2: "id001", value: "iceland shaman fashion axe squid vice" }, | |
{ key1: "el200", key2: "id001", value: "pin venmo letterpress cloud bread" }, | |
{ key1: "el400", key2: "id002", value: "YOLO flexitarian, swag sriracha" }, | |
{ key1: "el500", key2: "id002", value: "health goth chillwave" } | |
]; | |
const grouped = _.groupBy(items, item => `"${item.key1}+${item.key2}"`); | |
console.log(grouped); |
This file contains 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
yeet = "!yeet(){ git add -A && git commit -m $@ && git push; }; yeet" | |
refresco = !git fetch --all --prune && git checkout master && git pull && git lastbranch | |
amend = commit --amend --no-edit | |
lastbranch = checkout @{-1} | |
qlog = log -10 --oneline --decorate | |
qbranch = "!qb(){ git checkout -b PREFIX$@; }; qb" | |
qcheckout = "!qc(){ git checkout PREFIX$@; }; qc" | |
qa = "!qa(){ git refresco && git branch --remote | grep $@ | sed 's/origin\\///' | xargs git checkout && git pull --rebase; }; qa" |