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
heroku config:set NODE_MODULES_CACHE=false | |
git commit -am 'rebuild' --allow-empty | |
git push heroku master | |
heroku config:unset NODE_MODULES_CACHE |
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
public class DataCenterAwareIdGenerator : MongoDB.Bson.Serialization.IIdGenerator | |
{ | |
public static int Machine { get; set; } | |
public static byte[] Pack(int timestamp, int machine, short pid, int increment) | |
{ | |
if ((machine & 0xff000000) != 0) | |
{ | |
throw new ArgumentOutOfRangeException("machine", "The machine value must be between 0 and 16777215 (it must fit in 3 bytes)."); |
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
//start mongod instances for replica set rs0 | |
mongod --port 27010 --dbpath data/rs0-0 --replSet rs0 --smallfiles --oplogSize 128 | |
mongod --port 27011 --dbpath data/rs0-1 --replSet rs0 --smallfiles --oplogSize 128 | |
//add primary | |
mongo --port 27010 | |
rsconf = { | |
_id: "rs0", | |
members: [ | |
{ |
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
//start 2 db instances | |
mongod --port 27010 --dbpath data/s-0 | |
mongod --port 27011 --dbpath data/s-1 | |
//start the config server | |
mongod --configsvr --dbpath data/configsvr --port 27015 | |
//start the router | |
mongos --configdb localhost:27015 --port 27017 |
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
//start mongod instances | |
mongod --port 27017 --dbpath data/rs0-0 --replSet rs0 --smallfiles --oplogSize 128 | |
mongod --port 27018 --dbpath data/rs0-1 --replSet rs0 --smallfiles --oplogSize 128 | |
mongod --port 27019 --dbpath data/rs0-2 --replSet rs0 --smallfiles --oplogSize 128 | |
//add primary | |
rsconf = { | |
_id: "rs0", | |
members: [ |
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 http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
}).listen(1337, "127.0.0.1"); | |
console.log('Server running at http://127.0.0.1:1337/'); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="3.5" | |
DefaultTargets="main" | |
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/> | |
<Target Name="createdb"> | |
<ItemGroup> | |
<SqlFiles Include="$(MSBuildProjectDirectory)\db\**\*.sql" /> | |
</ItemGroup> |