Skip to content

Instantly share code, notes, and snippets.

View jameswomack's full-sized avatar
📈

James J. Womack jameswomack

📈
View GitHub Profile
print("PMM is awesome");
Compress: yes
Static: yes
Cache-Control: yes
Express: yes
St: no
Cluster: yes
Transactions: 16053 hits
Availability: 100.00 %
Elapsed time: 9.25 secs
@jameswomack
jameswomack / index.js
Created May 8, 2014 00:44
requirebin sketch
// try requiring some modules from NPM and then hit Run
require('cat-picture')
if(foo) {
bar = foo.bar;
}
foo && (bar = foo.bar);
@jameswomack
jameswomack / recipe_shared_data.hbs
Created May 8, 2014 02:06
Rendr Handlebars Shared Data
<article class="recipe-view">
<section id="recipe-view-list">
{{view "shared/itemList" collection=itemCollection}}
</section>
<div id="detail-recipe-view">
{{view "recipe/detail" collection=itemCollection}}
</div>
@jameswomack
jameswomack / yo_man.zsh
Last active August 29, 2015 14:01
Node.js reliant repository creation script
init() {
local GITHUB_USERNAME=jameswomack
local AUTHOR_FULLNAME="James J. Womack"
mkcd $1
git init
echo "{
\"name\": \"$1\",
\"version\": \"0.0.0\",
@jameswomack
jameswomack / package.son
Created May 14, 2014 00:08
Post-npm-install jshint
{
"name": "jshint_post-install",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "curl -o .jshintrc https://raw2.github.com/airbnb/javascript/master/linters/jshintrc"
},
"author": "Sony",
@jameswomack
jameswomack / search_and_destroy.sh
Created May 22, 2014 01:48
Replace a ridiculous path with the root path using find & sed
LC_CTYPE=C find ./test/unit/ -type f -exec sed -i ".original" "s#'../../../../..#process.cwd() + '#g" {} \;
merges-introducing() {
local introducing;
if introducing=`git rev-parse $1`; then
shift
git rev-list --ancestry-path --parents --reverse $introducing...$2 \
| awk '{seen[$1]=1} NR>1 && !seen[$2] {print $1}' \
| xargs git show --oneline --no-patch
fi
}
@jameswomack
jameswomack / circular_json_with_type_information.js
Last active August 29, 2015 14:03
CircularJSON w/ Type Information
var CircularJSON = require('circular-json');
var jsdom = require("jsdom");
var $ = require("jquery")(jsdom.jsdom().createWindow());
var print = console.log;
var LocalStorage = {
store: {},
setItem: function (key, value) {
this.store[key] = CircularJSON.stringify(value);
@jameswomack
jameswomack / printing_filtered_tweet_elements.js
Created July 19, 2014 09:46
Filter Tweets on your Twitter profile page based on the amount of favorites they've received.
var kStatCount = 'data-tweet-stat-count';
var kScreenName = 'data-screen-name';
var kProfileTweet = '.ProfileTweet';
jQuery.fn.extend({
statCount: function() {
return parseInt(this.attr(kStatCount));
},
statCountIsGreaterThan: function(n) {
return this.statCount() > n;