Skip to content

Instantly share code, notes, and snippets.

var testTimeout;
module = function(name, mocks) {
QUnit.module(name, {
setup: function() {
if (mocks) {
if (mocks.setup) {
mocks.setup.apply(this, arguments);
}
$.each(mocks, function(url, mock) {
if (/setup|teardown/.test(url)) {
module("user", {
"/resolve?url=http://soundcloud.com/forss": "/fixtures/forss.json",
"/users/183/playlists": {
responseStatus: 500,
responseText: "servererror",
responseTime: 1
}
});
@jzaefferer
jzaefferer / .bash_profile
Last active September 27, 2015 14:48
git-bash addons
# excerpt, I've got my stuff in my file
source ~/.git-completion.bash
source ~/.git-flow-completion.bash
export PS1='\w $(vcprompt)\$ '
alias s="git status"
alias d="git diff"
Function.prototype.debounce = function(threshold) {
threshold = threshold || 100;
var func = this;
var timeout;
return function() {
var obj = this,
args = arguments;
clearTimeout(timeout);
timeout = setTimeout(function() {
func.apply(obj, args);

You prolly heard of Brook's law before:

adding manpower to a late software project makes it later

While that is, in Brook's words, a "outrageous oversimplification", it captures a lot value. And as with most things, taking a step back by generalzing it, yields some interesting results.

Consider the recommendation (see for example slide 46 here) that anyone with experience with venture capital funding will give you: Only take funding when you don't need it. In this context, you should use funding to grow a company that already works. If you need money just to keep it running, you might as well stop.

Kind of similar to Brook's law, isn't it? But still, its kind of unintuitive. Let's try another example:

@jzaefferer
jzaefferer / server.js
Created March 26, 2012 09:54
Backbone app server - server static files or index.html
var connect = require('connect');
var httpPort = 8090;
var httpHost = "localhost";
var staticDir = __dirname;
var staticFiles = /\.(?:js|jpg|png|gif|json|css|ico|html|manifest|mp3|txt)(?:\?.+)?$/;
function route(app) {
app.get(/.*/, function(request, response, next) {
if (!(staticFiles).test(request.url)) {
@jzaefferer
jzaefferer / gist:5154172
Last active December 14, 2015 21:49 — forked from rxaviers/gist:5154163
Mar 13 07:24:13 nc02 download.jqueryui.com[28643]: { core: 'on', widget: 'on', mouse: 'on', position: 'on', draggable: 'on', droppable: 'on', resizable: 'on', selectable: 'on', sortable: 'on', accordion: 'on', autocomplete: 'on', button: 'on', datepicker: 'on', dialog: 'on', menu: 'on', progressbar: 'on', slider: 'on', spinner: 'on', tabs: 'on', tooltip: 'on', effect: 'on', 'effect-blind': 'on', 'effect-bounce': 'on', 'effect-clip': 'on', 'effect-drop': 'on', 'effect-explode': 'on', 'effect-fade': 'on', 'effect-fold': 'on', 'effect-highlight': 'on', 'effect-pulsate': 'on', 'effect-scale': 'on', 'effect-shake': 'on', 'effect-slide': 'on', 'effect-transfer': 'on', 'theme-folder-name': 'smoothness', scope: '' }
Mar 13 01:48:58 nc02 download.jqueryui.com[30196]: User request exception:
TypeError: Cannot call method 'components' of undefined
at Object.Builder (/var/www/download.jqueryui.com/lib/builder.js:51:27)
at /var/www/download.jqueryui.co
var fs = require( "fs" ),
request = require( "request" ),
xml2js = require( "xml2js").parseString,
exec = require( "child_process" ).exec,
pages = [1, 2, 3, 4, 5, 6, 7],
team = "core";
pages.forEach(function(page) {
request.get("http://jquery.org/updates/category/" + team + "/feed/atom/?paged=" + page, function(request, response, body) {
xml2js(body, {explicitArray: false}, function( err, result ) {
@jzaefferer
jzaefferer / commit-message.md
Last active March 13, 2016 15:45
GitHub PR boilerplate
var restify = require('restify');
var drc = require('./lib/');
function respond(req, res, next) {
var name = req.params.name;
var repo = drc.parseRepo(name);
var term = repo.index.official ? repo.localName : repo.remoteName;