Skip to content

Instantly share code, notes, and snippets.

View jasonmorganson's full-sized avatar

Jason Morganson jasonmorganson

View GitHub Profile
@drnic
drnic / mocha.rb
Created March 17, 2009 13:47
For mocha integration into Cucumber, add this file into features/support folder
# For mocha integration, add this file into features/support folder
require "mocha"
World(Mocha::Standalone)
Before do
mocha_setup
end
@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@shripadk
shripadk / gist:652819
Created October 29, 2010 03:10
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@indexzero
indexzero / base64.js
Created November 27, 2010 23:38
An extremely simple implementation of base64 encoding / decoding using node.js Buffers
//
// Super simple base64 encoding / decoding with node.js
//
var base64 = exports = {
encode: function (unencoded) {
return new Buffer(unencoded).toString('base64');
},
decode: function (encoded) {
return new Buffer(encoded, 'base64').toString('utf8');
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@tmahesh
tmahesh / measurePageloadTimes.js
Created February 18, 2011 00:56
How fast is my site? integrate boomerang and google analytics
<script type="text/javascript">
BOOMR.init({
beacon_url: "/boomerang.gif",
BW: {
enabled: false
}
});
BOOMR.subscribe('before_beacon', trackInAnalytics);
var pageType = "homepage"; // customize this
@xtian
xtian / html5boilerplate.jade
Last active December 23, 2023 15:05
HTML5 Boilerplate in jade
!!! 5
html(class='no-js')
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
title
meta(name='description', content='')
meta(name='viewport', content='width=device-width, initial-scale=1')
@nicholaides
nicholaides / jade_usage.js
Created April 1, 2011 16:20
How to use Jade client-side
window.Jade = require('jade');
JadeTemplates = {};
JadeTemplates["some_template"] = Jade.compile("li.feedback.exercise_item.checkbox\n input(type=\"hidden\", name=\"exercise[feedback_items_attributes][$order][_type]\", value=\"Checkbox\")\n\n - if (this.is_editing)\n != partial(\"item_actions\")\n\n .body\n .checkbox\n input(type=\"checkbox\", disabled, checked)\n\n .title\n - if (this.is_editing)\n input(name=\"exercise[feedback_items_attributes][$order][title]\", value=this.title, placeholder=\"E.g. &quot;I completed this exercise&quot;\", \"data-bvalidator\"=\"required\")\n\n - if (this.is_viewing)\n label= this.title\n");
JadeTemplates["exercises/_Image"] = Jade.compile("a.image(href=this.file_url)\n\timg(src=this.file_thumb_url)\n");
// defines the helpers "exercise_item" and "partial"