Skip to content

Instantly share code, notes, and snippets.

tinderfields / gist:8964407
Created February 12, 2014 21:00
Create rvm ruby version file
View gist:8964407
rvm --ruby-version --create use 2.1.0@swapper_scraper
tinderfields /
Last active December 26, 2015 09:49
Create backbone handlebar app with yeoman
brew update
brew install node
npm install -g yo
npm install -g generator-webapp
npm install -g generator-backbone
#If you are creating the app
mkdir appname && cd $_
yo backbone --template-framework=handlebars appname
tinderfields / spotlight
Created May 23, 2013 12:59
Disable / enable spotlight indexing
View spotlight
sudo mdutil -a -i off
sudo mdutil -a -i on
tinderfields / gist:5494658
Created May 1, 2013 10:45
Linux / rails performance checks
View gist:5494658
sudo apt-get install sysstat
mpstat -P ALL
# Memory
# Passenger
tinderfields / gist:5238440
Created March 25, 2013 16:29
Dump and restore a Postgres database
View gist:5238440
# Backup
pg_dump -U db_user -h localhost -xcO db_name | bzip2 - - > db/db_name.sql.bz2
# Restore
# Delete database then recreate then
bunzip2 -f db/db_name.sql.bz2
psql -U db_user -h localhost db_name < db/db_name.sql
tinderfields / gist:2688605
Last active October 4, 2015 19:47
Setup a new rails project using rvm and git
View gist:2688605
# Upgrade RVM
rvm get stable
# Get latest Ruby
rvm install 2.1.0
# Create and use gemset
mkdir project
cd project
rvm --ruby-version --create use 2.1.0@swapper_scraper
tinderfields / gist:2419518
Created April 19, 2012 08:02
Replace human readable dates in strings with mysql dates
View gist:2419518
string.gsub(/\"(\d+)\/(\d+)\/(\d+)\"/, "\"$3-$2-$1\"")
View capistrano_database_yml.rb
# = Capistrano database.yml task
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <>
# Copyright:: 2007-2010 The Authors
tinderfields / delayed_job_monit_capistrano.rb
Created September 22, 2010 15:26
Capistrano setup Monit for DelayedJob
View delayed_job_monit_capistrano.rb
set :monit_app_services, %w(delayed_job)
namespace :delayed_job do
desc "Restart the delayed_job process"
task :restart, :roles => :app do
sudo "RAILS_ENV=#{default_stage} #{current_path}/script/delayed_job restart"
namespace :monit do
tinderfields / Log SQL queries from within the console
Created September 9, 2010 16:46
Setup rails console logging
View Log SQL queries from within the console
ActiveRecord::Base.logger =