Skip to content

Instantly share code, notes, and snippets.

View nornagon's full-sized avatar

Jeremy Rose nornagon

View GitHub Profile
@nornagon
nornagon / foo.test.js
Created February 21, 2011 03:15
Run node.js tests, each in their own node process.
var assert = require('assert')
, path = require('path')
function some_helper(foo) {
assert.equal(foo, 4)
}
module.exports = {
'test array length': function (test) {
some_helper([1,2,3,4].length)
<html>
<head>
<title>blah</title>
<script src="../socket.io/socket.io.js"></script>
<script src="jquery-1.4.4rc2.js"></script>
<script src="main.js"></script>
<style>
canvas#canvas {
position: absolute;
left: 0;
from foo import *
initialise()
print my_var
@nornagon
nornagon / require.js
Created January 23, 2010 04:45
asynchronous require() for JavaScript. Uses prototype.js.
var require = (function () {
var _required = {};
return (function (url, callback) {
if (typeof url == 'object') {
// we've (hopefully) got an array: time to chain!
if (url.length > 1) {
// load the nth file as soon as everything up to the n-1th one is done.
require(url.slice(0,url.length-1), function () {
require(url[url.length-1], callback);
});