This file contains 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
// Run `npm i mongo` and run this test program after filling in the variables | |
// below. Run it against a replicaset with a sharded collection, with your | |
// MongoS process running on the same host as the script. | |
// You should // see start and finish messages from fxCountWithLog. | |
// Now do an rs.stepDown() on the replicaset primary. You should see an error | |
// message and the script should continue. So that's fine. | |
// Wait until the Replicaset settles down. Now on the new | |
// replicaset primary, do: |
This file contains 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
{ | |
"coffeescript_error": { | |
"level": "error" | |
}, | |
"duplicate_key": { | |
"level": "error" | |
}, | |
"empty_constructor_needs_parens": { | |
"level": "error" | |
}, |
This file contains 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
// a tiny adaptation of the cluster example at http://nodejs.org/api/cluster.html | |
// 1. save as test.js | |
// 2. run with "./node test.js > pid.log" | |
// 3. from another shell do "siege -t1m -c 50 http://localhost:8000" | |
// 5. wait for the siege to finish | |
// 6. ctrl-c the node process | |
// 7. sort pid.log | uniq -c | |
// The left side is # of requests served, the right side is pid. | |
// If it's balanced (as it is for me on the 2.6.32 linux kernel) then yay! |
This file contains 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('../') | |
var fs = require('fs') | |
var Schema = mongoose.Schema; | |
CheckItem = new Schema({ | |
name: { type: String }, | |
type: { type: String }, | |
pos: { type: Number }, | |
}); |
This file contains 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
--- a/socket.io/lib/manager.js Mon Nov 28 10:46:16 2011 -0500 | |
+++ b/socket.io/lib/manager.js Mon Nov 28 10:49:24 2011 -0500 | |
@@ -466,12 +466,13 @@ | |
* @api private | |
*/ | |
-Manager.prototype.onClientDisconnect = function (id, reason) { | |
+Manager.prototype.onClientDisconnect = function (id, reason, local) { | |
for (var name in this.namespaces) { | |
this.namespaces[name].handleDisconnect(id, reason, typeof this.roomClients[id][name] !== 'undefined'); |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>jQuery UI Sortable - Connect lists</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script> | |
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css"> | |
<style> | |
#sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; } |
This file contains 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 IndexedGuy = new mongoose.Schema({ | |
name: { type: String, index: true } | |
}); | |
mongoose.model('IndexedGuy', IndexedGuy); | |
mongoose.connect("mongodb://localhost/test-crash"); | |
mongoose.model('IndexedGuy').find({ | |
_id: { |
This file contains 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
require.paths.unshift("../../lib"); | |
var sys = require('sys'), | |
Buffer = require('buffer').Buffer, | |
BSON = require('./bson').BSON, | |
Buffer = require('buffer').Buffer, | |
BSONJS = require('mongodb/bson/bson').BSON, | |
BinaryParser = require('mongodb/bson/binary_parser').BinaryParser, | |
Long = require('mongodb/goog/math/long').Long, | |
ObjectID = require('mongodb/bson/bson').ObjectID, |
This file contains 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
// Modified from node-mongodb-native example | |
sys = require("sys"); | |
var Db = require('mongodb').Db, | |
Connection = require('mongodb').Connection, | |
Server = require('mongodb').Server, | |
// BSON = require('mongodb').BSONPure; | |
BSON = require('mongodb').BSONNative; | |
var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; |
This file contains 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
// Assumes a privatekey.pem and certificate.pem in this directory | |
// Probably have to run as root to start on port 443 | |
// See http://www.silassewell.com/blog/2010/06/03/node-js-https-ssl-server-example/ for ssl cert setup | |
var https = require('https'); | |
var fs = require('fs'); | |
var url = require('url'); | |
var sslOpts = { | |
key: fs.readFileSync(__dirname + '/privatekey.pem'), | |
cert: fs.readFileSync(__dirname + '/certificate.pem') |
NewerOlder