Skip to content

Instantly share code, notes, and snippets.

View unflores's full-sized avatar

A Flores unflores

View GitHub Profile
@unflores
unflores / Capfile
Created February 24, 2011 21:51 — forked from nstielau/Capfile
Generic cap deploy script
#Generic cap deploy script
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
##################################
# Edit these
set :application, "example_node_app"
set :node_file, ""
set :host, "public_domain_name"
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "id_rsa")] #your private ssh key
set :repository, "git@githubrepo_url"
@unflores
unflores / mongo_update.js
Created March 16, 2011 18:23
Update all template_id's which have 'paragraph' for a value
/******************************
//collection structure in mongo
{ _id: Object('kjlkjkljlkjlkjlkj'), name: 'val', pages:{'0':{'canvas_objects':{ '0':{ id: '0', template_id: 'paragraph', content: 'something}, ...}}, '1':{...} } },
{ _id: Object('kjlkjkljlkjlkjlkj'), name: 'val', pages:{'0':{'canvas_objects':{ '0':{ id: '0', template_id: 'paragraph', content: 'something}, ...}}, '1':{...} } },
{ _id: Object('kjlkjkljlkjlkjlkj'), name: 'val', pages:{'0':{'canvas_objects':{ '0':{ id: '0', template_id: 'paragraph', content: 'something}, ...}}, '1':{...} } }
*******************************/
var cursor = db.projects.find();
@unflores
unflores / Rakefile
Created March 25, 2011 19:25
File utility - removes unused files
desc "Checks files in app and public against everything in the images directory"
task :delete_unused_images do
unused_images.each do |image|
puts "#{red('[delete]')} #{image}"
`rm #{image}`
end
end
desc "Shows all unused images"
task :unused_images do
@unflores
unflores / gist:3181045
Created July 26, 2012 08:45
Find the new migrations
# can't diff two directories, make a file with the contents of the migrations dir before and after the previous deploy to find out what migrations need to be made for the next deploy
git ls-tree -r origin/master:db/migrate > migrations_last_deploy
git ls-tree -r origin/develop:db/migrate > migrations_current_branch
diff migrations_last_deploy migrations_current_branch
@unflores
unflores / README.markdown
Created August 10, 2012 07:30 — forked from greypants/README.markdown
RAILS 3: nav_link helper for adding 'selected' class to navigation elements

#Behold, the nav_link:

The nav_link helper works just like the standard Rails link_to helper, but adds a 'selected' class to your link (or its wrapper) if certain criteria are met. By default, if the link's destination url is the same url as the url of the current page, a default class of 'selected' is added to the link.

For full usage details, see: http://viget.com/extend/rails-selected-nav-link-helper

Drop nav_link_helper.rb into app/helpers in your Rails 3.x app and enjoy.

@unflores
unflores / sidekiq
Last active December 25, 2015 12:19 — forked from dyerc/sidekiq
#!/bin/bash
# sidekiq Init script for Sidekiq
# chkconfig: 345 100 75
#
# Description: Starts and Stops Sidekiq message processor for Stratus application.
#
# User-specified exit parameters used in this script:
#
# Exit Code 5 - Incorrect User ID
# Exit Code 6 - Directory not found
#!/bin/sh
# Setup 3 windows for my dev box
tmux new-session -d -s dev -c '/infra'
tmux rename-window 'docker'
tmux new-window -t dev:2 -d -c '/home/ubuntu/word_server' -n 'chef'
tmux new-window -t dev:3 -d -c '/home/ubuntu/word_server' -n 'chef-client'
@unflores
unflores / tmux setup
Last active January 27, 2016 14:49
I always forget this. I should probably include it in my home directory w defaults for setup
#!/bin/sh
tmux new-session -d -s dev -c '/infra'
# First window already created
tmux rename-window 'docker'
# Create all other windows
tmux new-window -t dev:2 -d -c '/home/ubuntu/server' -n 'chef'
tmux new-window -t dev:3 -d -c '/home/ubuntu/server' -n 'chef-client'
tmux new-window -t dev:4 -d -c '/infra/deployment/blog_austinflores/current' -n 'blog'
tmux new-window -t dev:5 -d -n 'prod' "ssh -i /home/ubuntu/.ssh/ user@place"
@unflores
unflores / better-nodejs-require-paths.md
Created February 26, 2016 11:45 — 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

@unflores
unflores / .gemrc
Created March 7, 2016 12:12 — forked from jch/.gemrc
gemrc example
# http://docs.rubygems.org/read/chapter/11
---
gem: --no-ri --no-rdoc
benchmark: false
verbose: true
update_sources: true
sources:
- http://gems.rubyforge.org/
- http://rubygems.org/
backtrace: true