Skip to content

Instantly share code, notes, and snippets.

View niccottrell's full-sized avatar
🏠
Working from home

Nicholas Cottrell niccottrell

🏠
Working from home
View GitHub Profile
// Inline Labels
// -------------------------------------------------- //
$('input, textarea').each(function() {
// load the corresponding label
var $self = $(this);
var $label = $("label[for='" + $self.attr("id") + "']").
if ($label.text(); {
@niccottrell
niccottrell / etckeeper.sh
Last active December 23, 2015 08:49 — forked from zhovner/etckeeper.sh
# After etckeeper installation
/etc/etckeeper/etckeeper.conf VCS="git"
etckeeper init && etckeeper commit
# ------
git config --global user.name "My Machine"
git config --global user.email "etckeeper@my.machine"
@niccottrell
niccottrell / functions.js
Created April 6, 2012 16:48 — forked from RedBeard0531/functions.js
Min, Max, Sum, Count, Avg, and Std deviation using MongoDB MapReduce
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
function map() {
emit(1, // Or put a GROUP BY key here
{sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count:1,
diff: 0, // M2,n: sum((val-mean)^2)
});