Skip to content

Instantly share code, notes, and snippets.

View igstan's full-sized avatar

Ionuț G. Stan igstan

View GitHub Profile
@igstan
igstan / schwartzian-transform.js
Created May 10, 2010 13:26
Schwartzian transform in JavaScript
/**
* See http://en.wikipedia.org/wiki/Schwartzian_transform
*
* @author Ionut G. Stan - http://igstan.ro
* @license BSD License
*/
var schwartzianSort = (function () {
var decorate = function (sortKey) {
return function (item) {
return [item[sortKey](), item];
if (! Array.prototype.zip) {
Array.prototype.zip = function (other) {
var result = [],
length = Math.min(this.length, other.length);
for (var i=0; i<length; i++) {
result.push([this[i], other[i]]);
}
return result;
DELIMITER $$
DROP PROCEDURE IF EXISTS `SELECT_EXCLUDE_FROM` $$
CREATE PROCEDURE `SELECT_EXCLUDE_FROM`(IN exclude VARCHAR(64), IN table_name VARCHAR(64))
BEGIN
DECLARE fields VARCHAR(1024);
SELECT
CONCAT('`', GROUP_CONCAT(`COLUMN_NAME` SEPARATOR '`, `'), '`')

Observe that for the programmer, as for the chef, the urgency of the patron may govern the scheduled completion of the task, but it cannot govern the actual completion. An omelette, promised in two minutes, may appear to be progressing nicely. But when it has not set in two minutes, the customer has two choices--wait or eat it raw. Software customers have had the same choices.

The cook has another choice; he can turn up the heat. The result is often an omelette nothing can save--burned in one part, raw in another.

Frederick P. Brooks Jr. (The Mythical Man-Month)

/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
var arrayLike = function (a) {
if (!a.hasOwnProperty("length")) {
return false;
}
if (a.length === 0) {
return true;
}
return a[0] !== undefined && a[a.length - 1] !== undefined;
# PHPUnit recipe for kicker
require 'osx/cocoa'
recipe :phpunit do
process do |files|
execute "phpunit"
end
end
# take control of the growl notifications
git filter-branch --env-filter 'export GIT_AUTHOR_EMAIL="email@address.com"' HEAD
git filter-branch --env-filter 'export GIT_COMMITTER_EMAIL="email@address.com"' HEAD
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
-moz-binding: url(firefox.xml#load-mozilla-css);
}
</style>
</head>
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="load-mozilla-css">
<implementation>
<constructor>
<![CDATA[
var link = document.createElement("link");
link.setAttribute("rel", "stylesheet");
link.setAttribute("type", "text/css");