Skip to content

Instantly share code, notes, and snippets.

@lezhangxyz
lezhangxyz / gist:1988823
Created March 6, 2012 20:37
JSHint Settings
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"node" : false,
#!/bin/sh
if [ ! -t 0 ]; then
echo >&2 'STDIN is not a terminal'
exit 1
fi
clear
cd "$(mktemp -d)"
function () {
console.log('hello world');
}
@lezhangxyz
lezhangxyz / gist:1601642
Created January 12, 2012 16:57
Grilled cheese recipe
You need-
2 slices of bread
butter (or, if you insist, some sort of buttery spread)
cheese of your choice (yellow cheese like colby or cheddar is most standard, but you can use about anything)
Butter one slice of bread, place it butter side down in a frying pan. Arrange cheese to cover bread in a relatively uniform thickness. Butter second piece of bread, place on top of cheese butter side up.
Now, there are multiple ways to cook it. My personal favourite, because I tend to wander away from the stove, is to put it on fairly low. (relative, because I don't know what your stove is aasdasdlike.) Check it periodically. If you hear it sizzling or you smell burning, you probably didn't check it soon enough.
When the cheese starts glistening and softening at the edges, flip it. Alternatively, periodically lift the sandwich and peer underneath. You want it a golden brown, darkness depending on personal taste. I prefer mine reasonably dark but not black in any way.
Flip, carefully. One way- Pick up sandwich on spatula
@lezhangxyz
lezhangxyz / gist:1571595
Created January 6, 2012 17:36
server.js
// Define node.js module dependencies
var express = require('express');
// Initialize API services
var app = express.createServer(express.logger());
// Set up static directories
app.configure(function(){
app.use('/',express.static(__dirname));
});
@lezhangxyz
lezhangxyz / gist:1571589
Created January 6, 2012 17:34
client.js
require(['libs/now/0.7.4/now'], function(Now) {
Now.pong = function(){
alert('pong!');
}
Now.ping();
}
@lezhangxyz
lezhangxyz / gist:1571573
Created January 6, 2012 17:30
Now.js AMD client
define(function() {
(function () {
var nowObjects = {};
var noConflict = function (uri, options) {
uri = uri || '';
if (nowObjects[uri]) {
return nowObjects[uri];
}
options = options || {};
@lezhangxyz
lezhangxyz / gist:1286248
Created October 14, 2011 04:32
Array option tags in Jade
// Objects is an array of items to populate options
select
- each object in objects
option #{object}
@lezhangxyz
lezhangxyz / gist:1273901
Created October 9, 2011 16:47
Volatile authentication sessions..
/* Requires */
// Set up connect-couchdb
var store = new ConnectCouchDB({
// Name of the database for sessions.
name: 'myreci-web-sessions',
// Optional. How often expired sessions should be cleaned up.
// Defaults to 600000 (10 minutes).
reapInterval: 600000,