Skip to content

Instantly share code, notes, and snippets.

# Deflate for clients that support it.
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
@rgo
rgo / mysql_delete_tables.sh
Created September 21, 2010 14:49
MySQL delete all tables
#!/bin/bash
MYSQL="mysql -h HOST -u USERNAME -pPASSWORD -D DB_NAME"
$MYSQL -BNe "show tables" | awk '{print "set foreign_key_checks=0; drop table `" $1 "`;"}' | $MYSQL
unset MYSQL
@rgo
rgo / .rvmrc
Created October 21, 2010 09:57
.rvmrc example
rvm_gemset_create_on_use_flag=1
rvm gemset use project_name
@rgo
rgo / ubuntu_rails_stack_install.sh
Created November 13, 2010 17:26
Script to install rails stack in a ubuntu system (or debian based)
# Install vim with ruby support
sudo aptitude install vim-gnome
# Install things to compile
sudo aptitude install bison build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2-dev
# Database stuff
sudo aptitude install sqlite3 libsqlite3-dev
sudo aptitude install mysql-server mysql-client libmysqlclient-dev
@rgo
rgo / custom_env.rb
Created December 13, 2010 17:39
Load factory_girl and faker in Cucumber
require 'factory_girl'
require 'faker'
Dir.glob(File.join(File.dirname(__FILE__), '../../spec/factories/*.rb')).each {|f| require f }
@rgo
rgo / .autotest
Created December 14, 2010 17:09
Autotest for RSpec and Cucumber
module Autotest::GnomeNotify
# Time notification will be displayed before disappearing automatically
EXPIRATION_IN_SECONDS = 3
ERROR_STOCK_ICON = "gtk-cancel"
WARNING_STOCK_ICON = "gtk-dialog-warning"
SUCCESS_STOCK_ICON = "gtk-ok"
# Convenience method to send an error notification message
#
# [stock_icon] Stock icon name of icon to display
@rgo
rgo / .irbrc.rb
Created January 11, 2011 11:14 — forked from diecrf/.irbrc.rb
# IRBRC file by Iain Hecker, http://iain.nl
# put all this in your ~/.irbrc
require 'rubygems'
require 'yaml'
alias q exit
class Object
def local_methods
(methods - Object.instance_methods).sort
@rgo
rgo / gist:807426
Created February 2, 2011 08:49
How much space does my MySQL db?
SELECT table_schema "DB", sum( data_length + index_length ) / 1024 / 1024 / 1024 "Size (GB)" FROM information_schema.TABLES GROUP BY table_schema
/path/to/rails_apps/*/log/*.log {
daily
missingok
rotate 30
compress
delaycompress
sharedscripts
postrotate
find /path/to/rails_apps/* -name tmp -maxdepth 1 -type d -exec touch {}/restart.txt \;
endscript
@rgo
rgo / Gemfile
Created April 1, 2011 08:30
Add a gem in Gemfile without disturb your workmates
group :development do
gem 'foo' if Gem.available?('foo')
end