Skip to content

Instantly share code, notes, and snippets.

#!/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:
@bashcoder
bashcoder / Gemfile
Last active August 29, 2015 14:07 — forked from stevebourne/Gemfile
gem 'omniauth'
gem 'omniauth-facebook'
gem 'clearance'
#!/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 January 25, 2012 01:15 — forked from darcyclark/gist:1384630
sending emails asynchronously from Padrino via Resque
# put this in /lib/resque.rb
require 'mail'
module Emailer
class Send
@queue = :issue_mailer
def self.perform(addressee, subject, body)
@bashcoder
bashcoder / Import
Created February 16, 2012 15:35 — forked from BDQ/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 February 16, 2012 16:35
TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
#!/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 February 28, 2012 18:11
simpleconv fails to run automatically under guard & spork
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 November 13, 2012 07:03 — forked from collegeman/setup-statsd.sh
Turn an Ubuntu 10.04 linode into a StatsD/Graphite server
# 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
@bashcoder
bashcoder / pre-commit
Created February 17, 2013 05:23 — forked from dgageot/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\$"`
# 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)
#