Skip to content

Instantly share code, notes, and snippets.

View jameswomack's full-sized avatar
📈

James J. Womack jameswomack

📈
View GitHub Profile
@jameswomack
jameswomack / gist:6aa5a5179ba58ffc331e1ebb5db725a7
Created July 21, 2023 07:59 — forked from lonnen/gist:3101795
git grep and git blame. two great tastes that taste great together
# from i8ramin - http://getintothis.com/blog/2012/04/02/git-grep-and-blame-bash-function/
# runs git grep on a pattern, and then uses git blame to who did it
ggb() {
git grep -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
# small modification for git egrep bash
geb() {
git grep -E -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
@jameswomack
jameswomack / gist:813d70c72c2125e2b038294a753091b4
Created November 21, 2017 17:13 — forked from ivan-loh/gist:ee0d96c3795e59244063
Node.JS ( & pm2 ) Process Memory Limit
# Plain Ol' Node
node --max-old-space-size=1024 app.js # increase to 1gb
node --max-old-space-size=2048 app.js # increase to 2gb
node --max-old-space-size=3072 app.js # increase to 3gb
node --max-old-space-size=4096 app.js # increase to 4gb
node --max-old-space-size=5120 app.js # increase to 5gb
node --max-old-space-size=6144 app.js # increase to 6gb
# For pm2
pm2 start app.js --node-args="--max-old-space-size=1024" # increase to 1gb
@jameswomack
jameswomack / better-nodejs-require-paths.md
Created April 12, 2017 15:54 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@jameswomack
jameswomack / 0_reuse_code.js
Last active August 29, 2015 14:26
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
exports.shorthands =
{ s : ["--loglevel", "silent"]
, d : ["--loglevel", "info"]
, dd : ["--loglevel", "verbose"]
, ddd : ["--loglevel", "silly"]
, noreg : ["--no-registry"]
, N : ["--no-registry"]
, reg : ["--registry"]
, "no-reg" : ["--no-registry"]
, silent : ["--loglevel", "silent"]
@jameswomack
jameswomack / casper.js
Created April 25, 2014 00:50 — forked from anonymous/casper.js
Comparing the syntax of Nightwatch & Casper testing systems
var server = require('../..');
var port = server.httpListener.address().port;
var url = 'http://localhost:'+String(port);
casper.test.begin('titles', 2, function(test){
casper
.start(url)
.waitForSelector('header#header', function(){
test.assertSelectorHasText('.timeZoneTitle:nth-child(1), :not(.timeZoneTitle) + .timeZoneTitle', 'Tokyo');
@jameswomack
jameswomack / chmod_passenger_directories.sh
Last active December 14, 2015 07:29 — forked from smathy/gzip.conf
Setup for AO
# http://trac.nginx.org/nginx/ticket/94
brew uninstall pcre
mkdir -p ~/Documents/src/pcre_previous
sudo mv /usr/local/lib/libpcre* ~/Documents/src/pcre_previous
gem install passenger