Skip to content

Instantly share code, notes, and snippets.

View shimondoodkin's full-sized avatar

Shimon Doodkin shimondoodkin

View GitHub Profile
// var sys = require('sys'); // enable for debugging this module
function replace(a, b)
{
if (!b) return a;
var key;
for (key in b) a[key] = b[key];
return a;
} this.replace=replace;
function add(a, b)
var _ = require('merger'); // lets do: _.extend(same,otherobjexts), _.clone(obj) - creates new reference, see source to understand //
var sys = require('sys');
var doubletemplate = require('deps/nodejs-meta-templates/doubletemplate'); //load double teplate module
var httputils = require('httputils');
var ObjectID= require('deps/node-mongodb-native/lib/mongodb/bson/bson').ObjectID;
var step=require('deps/step/lib/step');
/*
+tables - collections
\/
/var/www/nodejs-mongodb-app/cachedfiles_page.js:282
var buf=new Buffer(data,'utf8');
^
TypeError: Bad argument
at /var/www/nodejs-mongodb-app/cachedfiles_page.js:282:18
at fs:83:13
at node.js:255:9
var fs = require('fs'); // allaws to open files
var fs = require('fs');
var http = require('http');
var Buffer = require('buffer').Buffer;
var gif;
fs.readFile(__filename, function (err, data)
{
if (err) throw err;
gif = new Buffer(data, 'utf8');
});
the blog is in comments below
var sys = require("sys"),
fs = require('fs'),
url = require('url'),
http = require("http"),
multipart = require("./lib/multipart");
var name, filename, file,file2;
http.createServer(function (request, response) {
switch (url.parse(request.url).pathname) {
var sys = require("sys"),
fs = require('fs'),
url = require('url'),
http = require("http"),
multipart = require("./lib/multipart");
http.createServer(function (request, response) {
switch (url.parse(request.url).pathname) {
//thanks to creationix - large protion of the code here is learned from his connect library.
var querystring = require('querystring');
var sys = require('sys');
var multipart = require("deps/multipart-js/lib/multipart");
var fs = require('fs');
this.postdecoders =
{
'application/x-www-form-urlencoded': querystring.parse,
@shimondoodkin
shimondoodkin / postproblem.js
Created August 16, 2010 23:33
<shimondoodkin> i have a problem with http if i define the on end and on data callbacks after like 120 ms it does not call callbacks or maybe if it is clouse inside a clousre, the object looks ok but it does not fire the events [01:52] <bradleymeck> is t
var http = require('http');
var url = require('url');
//var sys = require('sys');
var mylog="log:\r\n";
/*
<shimondoodkin> i have a problem with http if i define the on end and on data callbacks after like 120 ms it does not call callbacks or maybe if it is clouse inside a clousre, the object looks ok but it does not fire the events
[01:52] <bradleymeck> is the request done by 120ms?
[01:52] <shimondoodkin> it hangs
[01:52] <shimondoodkin> after a minute it fails
*/