This file contains hidden or 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
var mongodb = require('mongodb') | |
, Db = mongodb.Db | |
, Server = mongodb.Server | |
, ReplSetServers = mongodb.ReplSetServers; | |
var mode = process.argv.slice(2)[0] || 'server'; | |
var mongoConfig = { | |
replset : { |
This file contains hidden or 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
var mongodb = require('mongodb') | |
, Db = mongodb.Db | |
, Server = mongodb.Server | |
, ReplSetServers = mongodb.ReplSetServers; | |
var mode = process.argv.slice(2)[0] || 'server'; | |
var mongoConfig = { | |
replset : { |
This file contains hidden or 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
var mongoose = require('mongoose'); | |
var File = new mongoose.Schema({ | |
servername : { type: String, index: { unique: true } } | |
, originalname : String | |
}); | |
var FileModel = mongoose.model('File', File); |
This file contains hidden or 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
var mongoose = require('mongoose'); | |
var mongoConfig = { | |
servers : [ | |
'localhost:27017/test-replset' | |
, 'localhost:27018' | |
, 'localhost:27019' | |
] | |
, options : { |
This file contains hidden or 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
function openFile(db, filename, callback) { | |
var gs = new mongodb.GridStore(db, filename, "r"); | |
gs.open(function(err, gs) { | |
if(err) { | |
callback(err, gs); | |
return; | |
} | |
callback(null, gs); |
This file contains hidden or 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
modules.exports = function (app) { | |
var requirejs = require("requirejs"); | |
var path = require("path"); | |
requirejs.config({ | |
baseUrl: path.join(app.config.paths.root, "public/js") | |
}); | |
app.require_public = requirejs; |
This file contains hidden or 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
var express = require("express"), | |
app = express(); | |
app.configure(function(){ | |
app.use(express.static(__dirname + '/public')); | |
}); | |
app.listen(13000); |
This file contains hidden or 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
Statistical profiling result from v8.log, (49355 ticks, 90 unaccounted, 0 excluded). | |
[Unknown]: | |
ticks total nonlib name | |
90 0.2% | |
[Shared libraries]: | |
ticks total nonlib name | |
36960 74.9% 0.0% /lib/x86_64-linux-gnu/libc-2.17.so | |
6486 13.1% 0.0% /usr/local/bin/node |
This file contains hidden or 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
/* | |
* Tests run on Ubuntu Server 12.04 LTS x86-64 | |
*/ | |
/*****************************************************************************/ | |
/* DISK */ | |
/*****************************************************************************/ | |
/* 15 GB File Random IO */ | |
#sysbench --test=fileio --file-total-size=15G prepare |
This file contains hidden or 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
function is_gmail(email, callback) { | |
var email_host_regex = /.*@(.+)$/; | |
var gmail_servers_regex = /(\.google\.com|\.googlemail\.com)$/i; | |
var m = email_host_regex.exec(email); | |
if(m && m.length > 1) { | |
var host = m[1] && m[1].toLowerCase(); | |
if(host == "gmail.com") { | |
return callback(null, true); | |
} else { | |
dns.resolveMx(host, function(err, result) { |
OlderNewer