This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* requires substack/node-binary and dependencies (npm install binary) */ | |
/* also don't forget node.js */ | |
var net = require('net'); | |
var Binary = require('binary'); | |
exports.attach = function attach(server) { | |
if ('number' == typeof server) { | |
var port = server; | |
server = net.createServer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var b = require('bindify') | |
// first make a function that does \ a b -> \ c -> b(a c) | |
var compose_2 = b(b, null | |
, Function.prototype.call | |
, b._1 | |
, b._wrap(b._this) | |
, nested_b(nested_b, null | |
, b._0 | |
, b._wrap(b._this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
BoxBlur - a fast almost Box Blur For Canvas | |
Edited by Yorick to make it faster in modern browsers | |
Version: 0.3 | |
Author: Mario Klingemann | |
Contact: [email protected] | |
Website: http://www.quasimondo.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// works as a CLI similar to the browserify one, but prints a space-separated list of dependencies for the arguments you give. | |
// requires browserify (obviously), JSONStream and event-stream. | |
var JSONStream = require('JSONStream') | |
, child_process = require('child_process') | |
, path = require('path') | |
, es = require('event-stream') | |
var parser = JSONStream.parse([true]) | |
var cwd = process.cwd() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function router() { | |
function router(method, url) { | |
var r = get_routes(method), rl = r.length | |
for (var i = 0; i < rl; ++i) { | |
if (r[i].type == 'string') { | |
if (r[i].url == url) | |
return [[url], r[i].callback] } | |
else { | |
var route = r[i] | |
if (route.type == 'regexp') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form onsubmit="myAuth.login(), false"> | |
<input type="text" name="name" id="auth_name" autocomplete="on"> | |
<input type="password" name="password" id="auth_passwd" autocomplete="off"> | |
<input type="submit" value="Log In"> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifdef VERBOSE | |
Q = | |
E = @true | |
else | |
Q = @ | |
E = @echo | |
endif | |
CFILES := $(shell find src -mindepth 1 -maxdepth 4 -name "*.c") | |
CXXFILES := $(shell find src -mindepth 1 -maxdepth 4 -name "*.cpp") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// keeps track of connections to a http server and closes them when the server closes. | |
function LinkedList() { | |
this.start = null | |
this.end = null } | |
LinkedList.prototype.add = function(data) { | |
var ref = { data: data, next: null, prev: null } | |
if (!this.start) this.start = ref | |
if (this.end) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Warn when you're about to tweet "thanks to me" | |
// @namespace http://localhost/ | |
// @version 0.1 | |
// @description Add an alert whenever someone types "thanks to me" | |
// @match http://twitter.com/* | |
// @match https://twitter.com/* | |
// ==/UserScript== | |
(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function RPS(noPlayers, proto) { | |
var obj = Object.create(proto || RPS.prototype) | |
obj.players = noPlayers | |
obj.score = {} | |
obj.moves = {} | |
for (var i = 0; i < noPlayers; i++) { | |
obj.score[i] = 0 | |
obj.moves[i] = [] } | |
return obj } |
OlderNewer