Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am jauco on github.
  • I am jauco (https://keybase.io/jauco) on keybase.
  • I have a public key ASD9YOcwPvQM5klEAt2Is6PLIw68O0X_g9lTSzvOWUpPmgo

To claim this, I am signing this object:

@jauco
jauco / elevator.js
Last active Aug 29, 2015
Elevator saga
View elevator.js
//level 9
//level 9
{
init: function(elevators, floors) {
function reorderDestinationqueue(q) {
var qnew = [];
var alreadyInQueue = {};
for (var i=0; i < q.length ; i++) {
if (!alreadyInQueue[q[i]]) {
qnew.push(q[i]);
View keybase.md

Keybase proof

I hereby claim:

  • I am jauco on github.
  • I am jauco (https://keybase.io/jauco) on keybase.
  • I have a public key whose fingerprint is F404 1AEC 660A 74A5 4134 3D78 2C16 53D0 B24C 9377

To claim this, I am signing this object:

@jauco
jauco / Blueprint.cs
Created Oct 12, 2011
A object templator for your unittests, like factorygirl
View Blueprint.cs
using System;
namespace Blueprint {
public class Blueprint<T> {
Func<IdGenerator, T> constructor;
//IdGenerator is static, so all objects of type T will have a different Id
private static IdGenerator idgen = new IdGenerator();
public Blueprint(Func<IdGenerator, T> constructor) {
@jauco
jauco / params.js
Created Jun 12, 2010
Jquery plugin for passing paramaters to scripts without dirtying the global scope
View params.js
//Jquery plugin to for passing paramaters to scripts without dirtying the global scope
"use strict";
(function createGetScriptParameters($) {
$.getScriptParameters = function getParams() {
//From the comments on http://bit.ly/dw5eYp
var scripts = document.getElementsByTagName("script"),
thisScript = scripts[scripts.length - 1], //Get the current script tag
paramString = "{" + thisScript.innerHTML.replace(/[\r\n]+\s*\/\//g, '') + "}";
@jauco
jauco / gist:201307
Created Oct 4, 2009
Design by contract in javascript
View gist:201307
//Design by contract function
function $contracted(pre, post, func){
return function(){
var paramsAsArray,
funcName,
retVal;
paramsAsArray = Array.slice(arguments)
funcName = func.toString().substr('function '.length);
funcName = funcName.substr(0, funcName.indexOf('('));//strip of everything, but the name