Skip to content

Instantly share code, notes, and snippets.

@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
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;
// 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;
};
@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:
@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 October 3, 2011 16:13 — forked from 140bytes/LICENSE.txt
Prefix notation calculator parser
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 October 3, 2011 16:14 — forked from 140bytes/LICENSE.txt
Prefix notation calculator interpreter
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 October 3, 2011 16:14 — forked from 140bytes/LICENSE.txt
Prefix notation calculator compiler
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 October 4, 2011 14:04 — forked from 140bytes/LICENSE.txt
Simple JavaScript REPL for the browser.
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 / peepcode.rb
Created November 1, 2012 17:25 — forked from gertig/peepcode.rb
A script to download all Peepcode screencasts with ruby
#!/usr/bin/env ruby
require 'mechanize'
@username = USERNAME
@password = PASSWORD
@download_path = DOWNLOAD_PATH
unless File.directory? @download_path
puts "@{download_path} doesn't exist!"