Skip to content

Instantly share code, notes, and snippets.

@Pointy
Pointy / doT-option-radio.html
Created September 12, 2012 15:22
An approach with doT templates to handling the "option"/"radio" coding mess
<!--
This is the template source for the page containing a "select". In doT
templates the data object is by convention called "it" (though it can
be set to be anything). In this example, I'm inventing a field called
"choice", whose value would presumably have come from the server via
JSON (or whatever) as the property "choice" of the "it" parameter.
In the option elements you'll see the doT construct to fetch a value
from the "it" object, and you'll see that it involves what looks like
@Pointy
Pointy / gist:649960
Created October 27, 2010 20:52
function transmogrifier
Function.prototype.beforeConstruction = function(newFunc) {
var oldObj = this;
var rv = function() {
newFunc.apply(this, arguments);
oldObj.apply(this, arguments);
};
rv.prototype = oldObj.prototype;
return rv;
};