Skip to content

Instantly share code, notes, and snippets.

View indexzero's full-sized avatar
🌎
Always bet on Open Source

Charlie Robbins indexzero

🌎
Always bet on Open Source
View GitHub Profile
$ node
> var url = require('url');
> var x = 'http://user:passwd@localhost:8080'
> var y = url.parse(x);
> y
{ href: 'http://user:passwd@localhost:8080',
protocol: 'http:',
slashes: true,
host: 'user:passwd@localhost:8080',
auth: 'user:passwd',
var journey = require('journey');
function quthorize (req, body, cb) {
// Put auth handler in here
};
var router = new (journey.Router)(function (map) {
map.path('/data', function () {
map.filter(function () {
// authorized stuff here
@indexzero
indexzero / addHeadUsage.js
Created November 19, 2010 21:18
Sample usage for the proposed addHead addition to ServerResponse
var http = require('http');
//
// Open Questions here:
// 1. Does writeHead always have to be called if setHeader is called?
// 2. Does writeHead always have to be called with a statusCode?
// 3. Can setHeader be called after writeHead?
// 4. Does setHeader take a statusCode?
//
http.createServer(function (req, res) {
@indexzero
indexzero / journey-and-node-static.js
Created November 20, 2010 20:18
An example of using Journey with Node-Static in node.js
var sys = require('sys'),
http = require('http'),
static = require('node-static'),
journey = require('journey');
exports.createRouter = function () {
return new (journey.Router)(function (map) {
//
// Version Binding
@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');
{
'We make sure we can talk to Twitter':
/* We'll be using same server for following requests. */
using('api.twitter.com')
.get('/help/test.json')
.expect(200, "ok", "/help/test.json returns 200 and ok")
.get('/help/test.txt')
/* Here we ignore response */
.expect(406, dc.ignore(), "/help/test.txt is not acceptable"),
$ ./deps/libcss/checkout-deps.sh
A libparserutils/build
A libparserutils/build/conv.pl
A libparserutils/build/Aliases
A libparserutils/build/Doxyfile
A libparserutils/build/make-aliases.pl
A libparserutils/test
A libparserutils/test/cscodec-8859.c
A libparserutils/test/regression
A libparserutils/test/regression/filter-badenc-segv.c
$ ./deps/libcss/build.sh
------------------- libwapcaplet -------------------
Architectures in the fat file: lib/libwapcaplet.a are: i386 x86_64
------------------- libparserutils -------------------
Architectures in the fat file: lib/libparserutils.a are: i386 x86_64
------------------- libcss -------------------
COMPILE: src/libcss.c
cc1: warnings being treated as errors
src/libcss.c: In function ‘css_initialise’:
src/libcss.c:31: warning: implicit declaration of function ‘parserutils_initialise’
$ ./deps/libcss/build.sh
------------------- libwapcaplet -------------------
Architectures in the fat file: lib/libwapcaplet.a are: i386 x86_64
------------------- libparserutils -------------------
Architectures in the fat file: lib/libparserutils.a are: i386 x86_64
------------------- libcss -------------------
COMPILE: src/libcss.c
src/libcss.c: In function ‘css_initialise’:
src/libcss.c:31: warning: implicit declaration of function ‘parserutils_initialise’
src/libcss.c:31: warning: nested extern declaration of ‘parserutils_initialise’

Game Engines

Name Latest Release Size (KB) License Type Unit Tests Docs Notes
The Render Engine 1.5.3 MIT Cross-browser; extensive API; open-source. 2
gameQuery 0.5.1 CC BY-SA 2.5 Designed to be used with jQuery
gTile 0.0.1 (2008-07-21) Tile based
Akihabara 1.3 GPL2/MIT Classic Repro Intended for making classic arcade-style games in JS+HTML5 3
The Javascript 2D Game Engine GPL Emphasis on gravity/physics/collision detection; uses HTML5 Canvas and ExplorerCanvas for IE support. Focus on limiting CPU usage. 4
The GMP Javascript Game Engine