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
You're not testing shards! | |
Please set the MONGOOSE_SHARD_TEST_URI env variable. | |
e.g: `mongodb://localhost:27017/database | |
Sharding must already be enabled on your database | |
․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․ | |
․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․ | |
You're not testing replica sets! | |
Please set the MONGOOSE_SET_TEST_URI env variable. |
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
// --- Dependancies --- | |
var _ = require('underscore'); | |
var mongoose = require('mongoose'); | |
// Any function that makes an update to a mongoose model that has an Array field can | |
// use this to catch version errors, and retry the update at most two times | |
var catchVersionErr = function () { | |
var updateFunc, callback, context, args = _.toArray(arguments); | |
context = args.shift(); |
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 RingOfPower = function (action, freq) { | |
if (typeof action === "undefined" || typeof freq === "undefined") { | |
throw new Error("must provide a function and an interval"); | |
} | |
this.action = action; | |
this.frequency = freq; | |
}; | |
RingOfPower.prototype.wield = function () { | |
clearInterval(this.interval); |
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
# clean everything up | |
echo "killing mongod and mongos" | |
killall mongod | |
killall mongos | |
echo "removing data files" | |
rm -rf data/config | |
rm -rf data/shard* | |
# For mac make sure rlimits are high enough to open all necessary connections | |
ulimit -n 2048 |
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 UserSchema = require(__dirname + '/user-schema'); | |
var DatabasePool = function () { | |
this.dbs = {}; | |
}; | |
// gets a connection to a specific mongo uri string, or | |
// creates it if it doesn't exist, or isn't connected | |
// Then attaches "User" Model to the connection |
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
∆ ∆ ∫ | |
˚Ú˚ ÒÒÒ | |
¯¯¯ | | |
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
// reassigning an argument | |
function argReassign1(a) { | |
a = a || {}; | |
} | |
// not reassigning an argument | |
function argReassign2(a) { | |
if (a === void 0) var a = {}; | |
} |
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
const express = require("express"); | |
const session = require("express-session"); | |
const cors = require("cors"); | |
const app = express(); | |
app.use(cors({ | |
origin: ["http://localhost:3000"], credentials: true | |
} | |
)); |
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 lim = function (num) { | |
if (num === void 0) num = 100; | |
var series = [100, 50, 25]; | |
var next = function () { | |
var lastTerm = series[series.length - 1]; | |
var secondToLastTerm = series[series.length - 2]; | |
// notice that, since we started above with the first three terms, that the fliping back and forth between adding | |
// and subtracting is handled here ↓, i.e. `secondToLastTerm - lastTerm` is alternating negative and positive |
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> | |
<title>Chain Height</title> | |
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet"> | |
</head> | |
<body> | |
<!-- | |
Make sure your Docker daemon is running |
OlderNewer