Skip to content

Instantly share code, notes, and snippets.

View danheberden's full-sized avatar

Dan Heberden danheberden

View GitHub Profile

gith

githOOKS - simple node server that responds to github post-receive events

Getting Started

Install the module with: npm install gith

// create a gith server on port 9001
var gith = require('gith').create( 9001 );

gith

githOOKS - simple node server that responds to github post-receive events

Getting Started

Install the module with: npm install gith

// create a gith server on port 9001
var gith = require('gith').create( 9001 );
@danheberden
danheberden / reuse_object.js
Created March 21, 2012 17:54
Reusable object pattern
/* This is an fn that can:
a) make new objects by itself or with the new keyword using some kind of identifier
b) return a cached object if an object with the same identifier is requested
c) is, itself, one of these objects
d) no id is a global ID
e.g.
var foo = new maker('baz');
var foo1 = maker('baz');
maker('baz') === foo; // true
maker('baz') === foo1; // true
function s:setupWrapping()
set wrap
set wrapmargin=2
set textwidth=72
endfunction
" md, markdown, and mk are markdown and define buffer-local preview
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
@danheberden
danheberden / gist:1726609
Created February 2, 2012 23:59
Simple Object Contructor With fn
// New Object Template
(function(){
var thing = window.Thing = function( a ) {
return new window.Thing.fn.init( a );
};
thing.fn = thing.prototype = {
constructor: thing,
init: function( a ){
// init the 'thing'
@danheberden
danheberden / mojax.js
Last active September 29, 2015 17:48
mock ajax for the jqueries
// Mojax
// Copyright (c) 2011 Dan Heberden
// Dual licensed under the MIT and GPL A
var randomStrings = [ "Joe", "Bill", "Steve", "Mark", "Joanne", "Megan", "Kristy", "Suzie" ];
$.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
if ( /^\/?mock-ajax/.test( originalOptions.url ) ) {
// make new deferred and save any success/error handlers
var dfd = new $.Deferred(),
success = options.success,
#!/bin/bash
PHP_SCRIPT=/usr/bin/php-fastcgi
FASTCGI_USER=www-data
FASTCGI_GROUP=www-data
PID_DIR=/var/run/php-fastcgi
PID_FILE=/var/run/php-fastcgi/php-fastcgi.pid
RET_VAL=0
case "$1" in
<script>(function(){var a=/jqversion=([\d\w\.]+)/.exec(location.search),b=a&&a[1],c;if(b){c="code.jquery.com/jquery-"+b}else{c="ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min"}document.write('<script src="//'+c+'.js"><\/script>')})()</script>
<script>window.jQuery||document.write('<script src="/scripts/jquery-1.7.0.min.js"><\/script>' )</script>
var verMatch = /jqversion=([\w\.]+)/.exec( location.search );
var version = verMatch && verMatch[1];