Skip to content

Instantly share code, notes, and snippets.

View rails_switch_branch.py
#!/usr/local/bin/python
"""
To use this script, you must be in the root directory of a Rails project that
is using git. You should also make sure that your directory does not contain any
uncommitted changes. Then run:
$ python rails_switch_branch.py name_of_another_branch
Running the above will do the following:
View Gemfile
gem 'omniauth'
gem 'omniauth-facebook'
gem 'clearance'
View osx-for-hackers.sh
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@bashcoder
bashcoder / gist:1673964
Created Jan 25, 2012 — forked from darcyclark/gist:1384630
sending emails asynchronously from Padrino via Resque
View gist:1673964
# put this in /lib/resque.rb
require 'mail'
module Emailer
class Send
@queue = :issue_mailer
def self.perform(addressee, subject, body)
View Import
namespace :spree do
desc "Export Products to CSV File"
task :export_products => :environment do
require 'fastercsv'
products = Product.find(:all)
puts "Exporting to #{RAILS_ROOT}/products.csv"
FasterCSV.open("#{RAILS_ROOT}/products.csv", "w") do |csv|
csv << ["id", "name", "description","sku", "master_price" ]
@bashcoder
bashcoder / track_spree
Created Feb 16, 2012
TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
View track_spree
#!/usr/bin/env zsh
# 1304046900 TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
# To be placed in the root of your app.
old_commit="29e3d4f707bdb047a6fabc2543247139027b06fb"
parts=(
core/app/views
@bashcoder
bashcoder / spec_helper.rb
Created Feb 28, 2012
simpleconv fails to run automatically under guard & spork
View spec_helper.rb
require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
require 'simplecov'
SimpleCov.start 'rails' do
@bashcoder
bashcoder / setup-statsd.sh
Created Nov 13, 2012 — forked from collegeman/setup-statsd.sh
Turn an Ubuntu 10.04 linode into a StatsD/Graphite server
View setup-statsd.sh
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
View pre-commit
#!/bin/sh
# Pre-commit hook that crushes PNG files in order to reduce their size.
if ! which -s pngcrush
then
echo "Please install pngcrush to reduce png images size before commit"
exit 1;
fi
for file in `git diff --cached --name-only | grep ".png\$"`
View 0. nginx_setup.sh
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY!
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#