Skip to content

Instantly share code, notes, and snippets.

var Conundrum = {
doIt: function() {return "did it"; },
doItCopy: function() {return this.doIt(); }
};
@chrisjpowers
chrisjpowers / tangled-spec.js
Created November 19, 2011 15:15
Example of tangled code for refactoring
describe("pressing the done button", function() {
var container, input, button, welcome;
beforeEach(function() {
container = $("div");
input = $("<input>", {"class": "name"});
button = $("<button>", {"class": "done"});
welcome = $("<div>", {"id": "welcome"});
container.append(input, button, welcome);
$("body").append(container);
});
@chrisjpowers
chrisjpowers / gist:3743662
Created September 18, 2012 15:10
JavaScript Syntax Question
// Do you prefer...
if (a) {
doA();
} else if (b) {
doB();
} else {
doC();
}
// or...