Skip to content

Instantly share code, notes, and snippets.

@tlrobinson
tlrobinson / LICENSE.txt
Created October 3, 2011 16:02 — forked from 140bytes/LICENSE.txt
Prefix notation calculator lexer
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Tom Robinson <http://tlrobinson.net/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tlrobinson
tlrobinson / LICENSE.txt
Created May 17, 2011 08:23 — forked from 140bytes/LICENSE.txt
a JavaScript hash-map kind of thing
Copyright (c) 2011 Tom Robinson, http://tlrobinson.net/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
// EXAMPLE 2: async response
// AJSGI using Q promise manager
var app = function (env) {
var response = Q.defer();
setTimeout(function () {
response.resolve({ status: 200, headers: {}, body: ["foobar"] });
}, 1000);
return response.promise;
};
exports.ContentLengthMiddleware = function (app) {
return function (request) {
return Q.when(app(request), function (response) {
var stream = new StreamIO();
Q.when(body.forEach(stream.write), function () {
var content = stream.read();
response.headers['Content-length'] = content;
response.body = [content];
return response;
@tlrobinson
tlrobinson / gist:176000
Created August 27, 2009 01:13 — forked from anonymous/gist:175999
strip extra .j files from a Objective-J build
#!/bin/sh
SJS=$(find . -name "*.sj")
for SJ in $SJS; do
DIR=$(dirname $SJ)
find $DIR -depth 1 -name "*.j" -delete
done