Skip to content

Instantly share code, notes, and snippets.

View rex's full-sized avatar

ᴘɪᴇʀᴄᴇ ᴍᴏᴏʀᴇ™ rex

View GitHub Profile
@rex
rex / rex-app.log
Last active December 18, 2015 13:59
rex-* ecosystem error tracking and history
λ ~/ rex-app
/usr/local/lib/node_modules/rex-git/lib/rex-git.js:47
, git_commands = _.rex_commands().git
^
TypeError: Object function (obj) {
if (obj instanceof _) return obj;
if (!(this instanceof _)) return new _(obj);
this._wrapped = obj;
} has no method 'rex_commands'
@rex
rex / NodeHelpers.js
Last active December 18, 2015 16:29
Awesome little helper methods to make life easier
/**
* These methods are written for and intended to be used within a Node.js environment.
* The only implied dependencies are the built-in Node.js API
*
* @author Pierce Moore <me@prex.io>
*/
/**
* In Node.js, this function expands the ~ character in a path that designates a user's home directory
*/
@rex
rex / rex-app.json
Last active December 18, 2015 20:38
A listing of sample rex.json files that will be used throughout the rex-* ecosystem to configure and maintain modules, files, and projects.
{
"app" : {
"name" : "Rex-App Test",
"version" : "0.1.0",
"root" : "~/Toolbox/"
},
"git" : {
"mongo" : "https://github.com/rex/rex-mongo.git",
"redis" : "https://github.com/rex/rex-redis.git",
"app" : "https://github.com/rex/rex-app.git",
@rex
rex / ProgrammaticValidator.js
Last active December 19, 2015 00:29
Validation plugin, using jQuery for plugin and Underscore mixins for functionality.
// In Router.js, whatever route needs validation
View({
events : {
'click #submit' : 'someFunction',
'click #another' : 'anotherFunction'
},
//Blahblahblah
validate : function(success, error, context) {
_.validate( this.validatorConfig, this.model.toJSON(), success, error, context )
@rex
rex / Handlebars_AMD.js
Last active December 19, 2015 16:19
Handlebars precompiled templates output using various different settings (all minified, though, for display)
/*
* handlebars dashboard.hb -f output.js -a
*/
define(['handlebars'], function(Handlebars) {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
return templates['dashboard.hb'] = template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {};
var buffer = "", stack1, self=this;
alias gll='git stash save --include-untracked && git pull --rebase origin $(current_branch) && git stash pop'
alias gs="git status -sb"
alias peek='git fetch origin $(current_branch) && git lg origin/$(current_branch)'
alias gaa='git add -u .'
alias gpp='echo "Starting push" && git push --all origin $(current_branch) && echo "Pushing Tags" && git push --tags origin $(current_branch) && echo "Push complete"'
alias gr='git reset'
alias grh='git reset --hard'
alias commit='echo "----------- COMMITTING TO BRANCH: $(current_branch) ----------" && gll && gaa && git commit'
alias sync='echo "----------- SYNCING BRANCH: $(current_branch) ------------" && git stash save --include-untracked && git pull --rebase origin $(current_branch) && git push origin $(current_branch) && git stash pop'
@rex
rex / RandexpCSV.rb
Last active December 30, 2015 21:39
Randexp Regex generators
require 'randexp'
#
# String of comma-separated values
#
/(\w{4,10}, ){2,6}\w{4,10}/.gen
# => "colport, antidrag, bahur, fatly"
# => "peak, prudential, pyke, Squaxon, oleous"
@rex
rex / Artist.csv
Last active December 30, 2015 21:39
7digital Import Row Formats
artistId name popularity tags image url
4 Amy Winehouse 0.68 pop,randb-soul,singer-songwriter,2000s http://cdn.7static.com/static/img/artistimages/00/000/000/0000000004_<$size$>.jpg http://www.7digital.com/artist/amy-winehouse/
@rex
rex / oneliners.zsh
Last active December 31, 2015 21:29
ZSH One-Liners
# List all Homebrew LaunchAgents (*.plist) files
grep -irl --include homebrew\*.plist "" /usr/local/opt
# Count all Homebrew LaunchAgents (*.plist) files
grep -irl --include homebrew\*.plist "" /usr/local/opt | wc -l
# List all registered Vagrant machines
vagrant global-status | ruby -lne 'STDIN.readlines.each {|line| line.match(/^[a-z0-9]{7}/) {|m| puts line } }'
@rex
rex / aws.zsh
Created May 2, 2014 17:07
AWS Shell One-Liners
#!/bin/zsh
# Determine the instance ID of the current instance
ec2-metadata | awk '/instance-id:/ {print $2}'
# Determine the 'type' of an instance based on the tags applied to it.
ec2-describe-tags | grep $(ec2-metadata | awk '/instance-id:/ {print $2}') | awk '/type/ {print $5}'