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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 fs = require('fs'); | |
var child_process = require('child_process'); | |
var spawn = child_process.spawn; | |
function openEditor(file) { | |
var cp = spawn(process.env.EDITOR, [file], { | |
customFds: [ | |
process.stdin, | |
process.stdout, | |
process.stderr |
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 currier = function(fn) { | |
var args = Array.prototype.slice.call(arguments, 1) | |
return function() { | |
return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, 0))) | |
} | |
} |
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
# Make the following directories so the relp set can log each db | |
mongod --replSet m101 --logpath "1.log" --dbpath /Users/bingeboy/Dropbox/mongodbClass/nodeClassAttempt2/hw6/hw6-5/data/shard0/rs1 --port 27017 --smallfiles --oplogSize 64 --fork | |
mongod --replSet m101 --logpath "2.log" --dbpath /Users/bingeboy/Dropbox/mongodbClass/nodeClassAttempt2/hw6/hw6-5/data/shard0/rs2 --port 27018 --smallfiles --oplogSize 64 --fork | |
mongod --replSet m101 --logpath "3.log" --dbpath /Users/bingeboy/Dropbox/mongodbClass/nodeClassAttempt2/hw6/hw6-5/data/shard0/rs3 --port 27019 --smallfiles --oplogSize 64 --fork | |
#make a config folder at the save level as the data folder | |
#make 3 config files, one for each server. | |
config = { _id: "m101", members:[ { _id : 0, host : "localhost:27017"}, { _id : 1, host : "localhost:27018"}, { _id : 2, host : "localhost:27019"} ] }; |
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
# remap C-b to C-a | |
set -g prefix C-a | |
unbind C-b | |
bind C-a send-prefix | |
#set index to 1 | |
set -g base-index 1 | |
set -g base-pane-index 1 | |
#split window horizontal |
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
document.addEventListener("touchmove", ScrollStart, false); | |
document.addEventListener("scroll", Scroll, false); | |
document.addEventListener("touchcancel", Scroll, false); | |
function ScrollStart() { | |
//hide back to top button now if it exists | |
} | |
function Scroll() { | |
//show back to top button now if scroll far enough |
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
> db.posts.getIndexes() | |
[ | |
{ | |
"v" : 1, | |
"key" : { | |
"_id" : 1 | |
}, | |
"ns" : "blog.posts", | |
"name" : "_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
$ git reset --hard | |
$ git pull | |
#might be aske to merge and leave a comment.... this defualt in osx is vim so type" :wq" to write and then quit vim. | |
$ git push <-- if you had anything commited you wanted to push the the repo. |
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 memoize = { | |
keys:{}, | |
set: function(key, value) { // set a key, value pair, return value | |
this.keys[key] = value; | |
return value; | |
}, | |
clear: function( ) { | |
this.keys = {}; // set in memoize keys, and return result | |
return this.key; |
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
Array.prototype.clone = function() { | |
return this.slice(0); | |
}; |