Skip to content

Instantly share code, notes, and snippets.

View pilgreen's full-sized avatar

Jay Pilgreen pilgreen

View GitHub Profile
@pilgreen
pilgreen / git lg
Last active June 6, 2025 14:01
`git lg` global config
git config --global alias.lg "log --color --graph --pretty=format:'%Cblue%h%Creset -%C(202)%d%Creset %s %Cgreen(%cr)' --abbrev-commit"
git config --global alias.lga "lg --exclude=gh-pages --branches"
@pilgreen
pilgreen / shuffle.js
Created March 4, 2016 15:24
The Fisher-Yates shuffle.
function shuffle(array) {
var m = array.length, t, i;
while (m) {
i = Math.floor(Math.random() * m--);
t = array[m];
array[m] = array[i];
array[i] = t;
}
return array;
}
@pilgreen
pilgreen / guid.js
Last active August 10, 2019 13:55
A simple javascript guid() function
function guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}