Skip to content

Instantly share code, notes, and snippets.

View isaacs's full-sized avatar
🔮
only way out is through

isaacs isaacs

🔮
only way out is through
View GitHub Profile
/tmp/homebrew-flusspferd-0.9-gMPE/flusspferd-0.9/vendor/arabica/include/DOM/Simple/DocumentFragmentImpl.hpp:45: error: ‘construct_from_utf8’ is not a member of ‘Arabica::SAX::Taggle<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Arabica::default_string_adaptor<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >’
make[3]: *** [plugins/xml/CMakeFiles/xml_PLUGIN.dir/parser.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/usr/local/include/boost/fusion/container/vector/vector.hpp: In function ‘void __static_initialization_and_destruction_0(int, int)’:
/usr/local/include/boost/fusion/container/vector/vector.hpp:147: note: ‘<anonymous>.boost::fusion::vector<boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>::vec’ was declared here
make[2]: *** [plugins/xml/CMakeFiles/xml_PLUGIN.dir/all] Err
@isaacs
isaacs / one.js
Created February 7, 2010 07:28 — forked from tim-smart/one.js
Get(/^\/myroute/, function(request) {
...
});
Post(/^\/myroute/, function(request) {
...
});
Head(/^\/myroute/, function(request) {
...
var sys = require("sys");
// read from stdin
process.stdio.open();
process.stdio.addListener("data", function (data) {
sys.debug(data);
});
process.stdio.addListener("close", function () {
sys.debug("closing");
var tcp = require("tcp"),
http = require("http"),
sys = require("sys");
http.createServer(function (req,res) {
sys.debug("from http server: connect");
res.sendHeader(200, {});
res.sendBody("hi");
for (var i in req.headers) {
res.sendBody("\nHEADER "+i+": "+req.headers[i]+"\n");
@isaacs
isaacs / sax-test.js
Created February 16, 2010 01:36 — forked from tmpvar/sax-test.js
var sys = require("sys"), sax = require("../sax-js/lib/sax");
parser = sax.parser(false);
sax.EVENTS.forEach(function (ev) {
parser["on" + ev] = function (n) { sys.puts(ev + " " + sys.inspect(n)); };
});
parser.write("<span>Welcome,</span> to monkey land").close();
/*
$ node sax-test.js
opentag {
Object.deepCreate = function deepCreate (o) {
var n = Object.create(o);
for (var i in o) if (o.hasOwnProperty(i) && typeof o[i] === "object" && o[i]) {
n[i] = Object.deepCreate(o[i]);
}
return n;
};
o = {foo:{bar:1}};
n = Object.deepCreate(o);
commit d7ad45c231b369289f2b7ee20e494ae2b693fafb
Author: isaacs <[email protected]>
Date: Thu Feb 18 20:50:43 2010 -0800
Setting to undefined does not remove in-ness. Delete the stat watcher so that it won't be found upon trying to re-stablish a watch.
Otherwise, this fails:
process.watchFile("/etc/passwd", function () {});
process.unwatchFile("/etc/passwd");
function when (p, cb) {
if (p instanceof Promise) p.addCallback(function (d) { cb(d) });
else cb(p);
}
function AJSGItoEJSGI (app) { return function (req) {
var res = app(req);
when(res, function (res) {
if (res.body.forEach) {
// regular-style javascript
function foo (a,b,c,d) {
if (a > c) throw new Error("c must be teh greetest");
return a * b * c * d;
}
function b (d,e) {
if (e === d) throw new Error("must not be equal");
return e - d;
}
function( request, response ) {
/* Determine Encoding */
var isGzip = /gzip/.test( request.headers['accept-encoding'] ) ? true : false;
/* Extract Scope */
var sandbox = /\.+(.+)\.sb+/.exec( request.headers.host );
if ( sandbox !== null ) {
var scope = sandbox[1];