Skip to content

Instantly share code, notes, and snippets.

@jzaefferer
jzaefferer / check-packages.js
Created February 18, 2021 15:20
Automatically check if installed packages are up-to-date, before start and lint scripts, and on `git pull`; MIT License, Copyright Jörn Zaefferer
#!/usr/bin/env node
//@ts-check
const { execSync } = require('child_process')
const mainPackage = require('../package.json')
const packageLock = require('../package-lock.json')
const outdated = []
Object.keys(mainPackage.dependencies)
.concat(Object.keys(mainPackage.devDependencies))
.forEach(packageName => {
try {
@jzaefferer
jzaefferer / Validation.jsx
Created June 6, 2018 18:53
React with jQuery Validation Plugin
/* eslint-disable prefer-arrow-callback */
import $ from 'jquery'
import 'jquery-validation'
import PropTypes from 'prop-types'
import React from 'react'
/**
*
* @author Algorithm and Datastructures Team SS2016
* @version 1.0
*
*/
import java.lang.RuntimeException;
public class MyHashMap {
/**
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;
@jzaefferer
jzaefferer / commit-message.md
Last active March 13, 2016 15:45
GitHub PR boilerplate
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 / 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
@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)) {

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:

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);