Skip to content

Instantly share code, notes, and snippets.

@yurynix
yurynix / mongodb_capped_collection_tail.js
Last active September 20, 2015 08:53
A test for tailed cursor
var MongoClient = require('mongodb').MongoClient
, assert = require('assert')
, cappedCollectionName = "capped_test";
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function createTailedCursor(db, callback) {
function Data(a, b, c) {
this.a = a;
this.b = b;
this.c = c;
}
/* Statics */
Data.getBufferDesc = function Data_getBufferDesc() {
// avoid new instance here, but i'm lazy.
return [
{ type: 'UInt32BE', size: 32 },
@yurynix
yurynix / gist:ab192ffb016308f47ce6
Created October 23, 2014 09:38
diff --git a/main_good.js b/main_bad.js
diff --git a/main_good.js b/main_bad.js
index 22979ef..9521811 100644
--- a/main_good.js
+++ b/main_bad.js
@@ -1054,124 +1054,4 @@ function hasOwnProperty(obj, prop) {
}
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./support/isBuffer":4,"_process":3,"inherits":2}],4:[function(require,module,exports){
-module.exports = function isBuffer(arg) {
var AsyncStateManager = require('../managers/asyncStateManager');
var AsyncComponentMixin = {
componentWillMount: function AsyncComponentMixin_componentWillMount() {
var self = this;
var asyncStateGetter = this.constructor.getInitialAsyncState;
var asyncStateKey = asyncStateGetter.name;
// ====> AsyncStateManager should not be module / global, it should be tied to request
if ( AsyncStateManager.hasData(asyncStateKey) ) {