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 / 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 / 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 / .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 / 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 / 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 / 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 / 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 / nodeInstallMake
Created March 28, 2014 17:51
How to install nodejs on ARM chipset
$ cd /opt/node
#if don't have that dir created yet
$ mkdir -p /opt/node
$ wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
$ tar -xvf node-v0.10.26.tar.gz
$ cd node-v0.10.26
$ ./configure
$ sudo make
# note above make takes forever to build
$ sudo make install
@bingeboy
bingeboy / abtest
Created April 8, 2014 05:40
Apache AB benchmark test
#if you are on osx and use brew tap formula needed.
$ ab -n 10000 -c 100 http://yahoo.com/
# this will make 10,000 requests with 100 concurrent connections.
@bingeboy
bingeboy / testResults.md
Last active August 29, 2015 13:58
Express vs Restify Apache Benchmark Results

#Express vs Restify Apache Benchmark Results

###Test

$ ab -n 10000 -c 100 http://localhost:3000/

###Versions Details node v0.10.26