Skip to content

Instantly share code, notes, and snippets.

View brianarn's full-sized avatar

Brian Sinclair brianarn

View GitHub Profile
@brianarn
brianarn / django_settings.py
Created January 31, 2012 17:43 — forked from jcroft/django_settings.py
Preventing comment spam
COMMENTS_SECRET = 'any_old_string_you_like'
@brianarn
brianarn / gist:1463450
Created December 11, 2011 23:22 — forked from padolsey/gist:1463408
`given(d).define(m)` - an alternative to `define(d,m)`
function given(dependencies) {
return {
define: function(id, module) {
if (!module) {
// Assume the first arg is the module
module = id;
id = undefined;
}
return define(id, dependencies, module);
}
@brianarn
brianarn / blinkify.js
Created May 10, 2010 17:57
Bringin' blinkin' back
(function () {
var blinktags = document.getElementsByTagName('blink'), len = blinktags.length, vis = 'hidden', i;
if (len > 0) {
setInterval(function () {
for (i = 0; i < len; i++) blinktags[i].style.visibility = vis;
vis = vis === 'visible' ? 'hidden' : 'visible';
}, 500);
}
})();
@brianarn
brianarn / underscore_conditionals.js
Created May 4, 2010 22:37
Conditionals with underscore.js
// A means of using underscore.js to do templates with conditionals
// Inside of underscore's template, it returns a function that uses
// 'with' on a variable named obj, and you can touch into that using
// inline JS and <% %> wrappers
// A template with conditional display of last names:
var good = _.template("Hello: <%= name %> <% if (obj.lastname) { %> <%= lastname %> <% } %>");
// A template that tries to do that, but fails:
var bad = _.template("Hello: <%= name %> <% if (lastname) { %> <%= lastname %> <% } %>");
/**
* MooCrash
* A MooTools plugin to crash IE6
* v0.0.1
*
* Licensed under MIT license, so, y'know, feel free to take it
* http://www.opensource.org/licenses/mit-license.php
* Inspired by jQuery Crash, written because @jsconf asked for it
*
* Extending Browser, since that seems to be the right place for it.