Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View arunoda's full-sized avatar
👨‍🍳
Cooking something new

Arunoda Susiripala arunoda

👨‍🍳
Cooking something new
View GitHub Profile
@arunoda
arunoda / app.js
Created April 7, 2011 08:13
MongoDB Helper using QBox
var mongo = require("./mongoHelper").connect("localhost", 27017, "test");
mongo.collection("collname", function(coll) {
});
var http = require('http');
var sys = require('sys');
function request()
{
var host = 'google.com';
var client = http.createClient(443, host, true);
var request = client.request('GET', '/',
{'host': host});
request.end();
var redis = require('redis');
var cli = redis.createClient();
cli.on('error', function(err) {
console.log('Err:' + err);
});
function addWorker() {
console.log('adding worker again');
cli.blpop('nl', 0, function(err, data) {
var redis = require('redis');
var cli = redis.createClient();
cli.on('error', function(err) {
console.log('Err:' + err);
});
function addWorker() {
console.log('adding worker again');
cli.blpop('nl', 0, function(err, data) {
db.insert({data: 1000}, function(err) {
//do something when inserted
})
console.log("I don't wait");
info it worked if it ends with ok
verbose cli [ 'node', '/usr/local/bin/npm', 'install', '-g' ]
info using npm@1.0.10
info using node@v0.4.5
verbose config file /home/arunoda/.npmrc
verbose config file /usr/local/etc/npmrc
silly exec /usr/local/bin/node "/usr/local/lib/node_modules/npm/bin/npm-get-uid-gid.js" "nobody" 1000
silly output from getuid/gid {"uid":65534,"gid":1000}
silly output from getuid/gid
verbose into /usr/local/lib [ '.' ]
@arunoda
arunoda / System Info
Created September 12, 2011 11:35
Node HTTP Proxy Benchmark
OS: Ubuntu 10.10
NodeJS: v0.4.10
RAM: 2GB
Processer: Core 2 Duo 2.0 Ghz
@arunoda
arunoda / gist:1229406
Created September 20, 2011 15:26
Java Script Data Structures
// Arrays
var aaa = [];
// Stack
var aa = [10];
aa.push(20);
aa.pop(); //gets 20
@arunoda
arunoda / pre.sh
Created October 18, 2011 20:20
Nariya Server
rake
@arunoda
arunoda / strict.js
Created October 29, 2011 04:22
Strict Mode Test
function a() {
"use strict"
function b() {
console.log(arguments.callee.caller);
}
b();
}
a();