Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@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)
#
#!/usr/local/bin/ruby
require "hpricot"
require "net/http"
require "uri"
TUMBLR_USER = "user@example.com"
TUMBLR_PASS = "thepasswordlol"
TUMBLR_DOMAIN = "mytumblrsubdomain.tumblr.com"
ORIGINAL_DOMAIN = "http://myoriginaldomain.example.com/"
# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
module Ohm
module Expiring
def self.included(base)
base.instance_exec {
include InstanceMethods
extend ClassMethods
}
end