Skip to content

Instantly share code, notes, and snippets.


James J. Womack jameswomack

View GitHub Profile
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
View gist:6aa5a5179ba58ffc331e1ebb5db725a7
# from i8ramin -
# 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 / gist:813d70c72c2125e2b038294a753091b4
Created November 21, 2017 17:13 — forked from ivan-loh/gist:ee0d96c3795e59244063
Node.JS ( & pm2 ) Process Memory Limit
View gist:813d70c72c2125e2b038294a753091b4
# 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 /
Created April 12, 2017 15:54 — forked from branneman/
Better local require() paths for Node.js

Better local require() paths for Node.js


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 / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View npm-config-shorthands.js
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 / casper.js
Created April 25, 2014 00:50 — forked from anonymous/casper.js
Comparing the syntax of Nightwatch & Casper testing systems
View casper.js
var server = require('../..');
var port = server.httpListener.address().port;
var url = 'http://localhost:'+String(port);
casper.test.begin('titles', 2, function(test){
.waitForSelector('header#header', function(){
test.assertSelectorHasText('.timeZoneTitle:nth-child(1), :not(.timeZoneTitle) + .timeZoneTitle', 'Tokyo');
jameswomack /
Last active December 14, 2015 07:29 — forked from smathy/gzip.conf
Setup for AO
brew uninstall pcre
mkdir -p ~/Documents/src/pcre_previous
sudo mv /usr/local/lib/libpcre* ~/Documents/src/pcre_previous
gem install passenger