Skip to content

Instantly share code, notes, and snippets.

View schamane's full-sized avatar

Nazar Kulyk schamane

View GitHub Profile
[
'mongoose'
].forEach(function(path){
var module = require('./' + path);
for (var i in module)
exports[i] = module[i];
});
@schamane
schamane / uglifyjs-fix-fileread.patch
Created February 1, 2011 17:04
Fix if file was not readed
diff --git a/bin/uglifyjs b/bin/uglifyjs
index ad3866f..02f0268 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -105,7 +105,11 @@ out: while (args.length > 0) {
if (filename) {
fs.readFile(filename, "utf8", function(err, text){
- output(squeeze_it(text));
+ if(err) {
@schamane
schamane / extended_http_client
Created February 10, 2011 09:51
Overwrite http client for nodejs
#!/bin/env node
var util = require('util'),
http = require('http');
var Foo = function () {
Foo.super_.apply(this, arguments);
this._name = 'foo';
};
YUI().use('event', 'event-custom', 'yui2-dragdrop', 'yui2-datatable', function (Y) {
var YAHOO = Y.YUI2,
eventName = '"page:dataTableCreated';
Y.on(eventName, function(oDS, oDT){
Y.log(oDS);
Y.log(oDT);
});
@schamane
schamane / test-http-agent2.js.patch
Created February 20, 2011 14:40
nodejs 0.4.1 patch for the test-http-agent2.js simple test
diff --git a/test/simple/test-http-agent2.js b/test/simple/test-http-agent2.js
index eed1cb9..83e5670 100644
--- a/test/simple/test-http-agent2.js
+++ b/test/simple/test-http-agent2.js
@@ -5,9 +5,6 @@ var http = require('http');
var reqEndCount = 0;
var server = http.Server(function(req, res) {
- res.writeHead(200);
- res.end("hello world\n");
@schamane
schamane / node_yui3_express_example_error
Created April 4, 2011 17:40
Error with node-yui3 example for express
user@machine nodejs-yui3/examples/express $ node express.js
info: (get): URL: /usr/lib64/node/.npm/yui3-core/3.3.0/package/build/loader/loader-debug.js
info: (get): Loaded: /usr/lib64/node/.npm/yui3-core/3.3.0/package/build/loader/loader-debug.js
info: (loader): attempting to load oop, /usr/lib64/node/.npm/yui3-core/3.3.0/package/build/
info: (get): URL: /usr/lib64/node/.npm/yui3-core/3.3.0/package/build/oop/oop-min.js
info: (get): Loaded: /usr/lib64/node/.npm/yui3-core/3.3.0/package/build/oop/oop-min.js
info: (loader): attempting to load parallel, /usr/lib64/node/.npm/yui3-core/3.3.0/package/build/
info: (get): URL: /usr/lib64/node/.npm/yui3/0.5.33/package/lib/yui3-parallel.js
info: (get): Loaded: /usr/lib64/node/.npm/yui3/0.5.33/package/lib/yui3-parallel.js
info: (loader): attempting to load nodejs-dom, /usr/lib64/node/.npm/yui3-core/3.3.0/package/build/
@schamane
schamane / main.js
Created April 7, 2011 21:01
start it with : node main.js
var config = {
loadDir: {
base: __dirname + '/',
dirs: [ 'modules/' ]
}
};
require('yui3').YUI( config ).use('loader', 'dump', function(Y) {
Y.log("app starts", 'info');
@schamane
schamane / clone_all.sh
Created June 3, 2011 11:03
git clone all submodules
git submodule update --init --recursive
@schamane
schamane / getFuncNameForOOP.js
Created June 3, 2011 12:21
get function name from function self in oop
var C = function() {};
C.prototype.myFunctionName = function() {
var method, name;
for( method in this) {
if(!this.hasOwnProperty(method)){
if(this[method].toString() === arguments.callee.toString()){
name = method;
}
}
@schamane
schamane / node_net_pub_test.js
Created June 23, 2011 17:09
nodejs_net_server-client-publisher
var net = require('net'),
events = require('events'),
util = require('util'),
port = 8124,
localhost = "127.0.0.1",
Server, Client;
Client = function(id, socket) {
Client.super_.call(this);
this.id = id;