Skip to content

Instantly share code, notes, and snippets.

View progging's full-sized avatar
💭
🍕

robin progging

💭
🍕
View GitHub Profile
@progging
progging / my.gitconfig
Created January 23, 2020 09:43
awesome-git-aliases
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"
@progging
progging / groupByMultipleProps.js
Created May 22, 2019 08:10
Group by multiple properties using lodash
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);
@progging
progging / fuzzy.js
Created May 15, 2019 05:58
Simple fuzzy string matcher
/*
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;