Skip to content

Instantly share code, notes, and snippets.

View bingeboy's full-sized avatar
🏠
Working from home

JP McGarrity bingeboy

🏠
Working from home
View GitHub Profile
@bingeboy
bingeboy / 0_reuse_code.js
Created March 7, 2014 20:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bingeboy
bingeboy / editor.js
Created February 28, 2014 04:20 — forked from Floby/editor.js
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
@bingeboy
bingeboy / Curry Prototype
Created February 25, 2014 15:10
Curry Prototype
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)))
}
}
@bingeboy
bingeboy / test from mongofb class
Created February 24, 2014 01:52
Mongo Shard Test
# 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"} ] };
@bingeboy
bingeboy / .tmux.conf
Last active August 29, 2015 13:56
tmux commands
# 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
@bingeboy
bingeboy / gist:8970478
Created February 13, 2014 05:55
backtotop tablet
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
@bingeboy
bingeboy / blog
Created February 9, 2014 23:52
MongoDB Week 4
> db.posts.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"ns" : "blog.posts",
"name" : "_id_"
},
@bingeboy
bingeboy / git flow thing at office
Created December 16, 2013 17:08
REPOSA SPECIAL
$ 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.
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;
@bingeboy
bingeboy / Array Clone Prototype
Created October 28, 2013 19:11
Array Clone Prototype
Array.prototype.clone = function() {
return this.slice(0);
};