Skip to content

Instantly share code, notes, and snippets.

@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
@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 / .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 / 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 / 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 / .rvmrc
Created October 21, 2010 09:57
.rvmrc example
rvm_gemset_create_on_use_flag=1
rvm gemset use project_name
@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
# 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
Given /^I will confirm on next step$/ do
begin
evaluate_script("window.alert = function(msg) { return true; }")
evaluate_script("window.confirm = function(msg) { return true; }")
rescue Capybara::NotSupportedByDriverError
end
end
@rgo
rgo / Gemfile
Created May 23, 2010 01:31 — forked from indirect/Gemfile
# include at least one source and the rails gem
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
gem 'sqlite3-ruby', :require => 'sqlite3'
# Devise 1.0.2 is not a valid gem plugin for Rails, so use git until 1.0.3
# gem 'devise', :git => 'git://github.com/plataformatec/devise.git', :ref => 'v1.0'
group :development do
# bundler requires these gems in development