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
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 |
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
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: | |
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
// 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; | |
}; |
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
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; |
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
#!/bin/sh | |
SJS=$(find . -name "*.sj") | |
for SJ in $SJS; do | |
DIR=$(dirname $SJ) | |
find $DIR -depth 1 -name "*.j" -delete | |
done |
NewerOlder