Skip to content

Instantly share code, notes, and snippets.

@rodrigomaia
rodrigomaia / annotations_on_rails
Created August 9, 2013 12:23
Criando annotations em Rails
# encoding: UTF-8
class ActionController::Base
@@comportamento = nil
@@metodos_anotados = {}
before_filter do |controller_instance|
invoca_metodos_da_anotation(controller_instance)
end
@rodrigomaia
rodrigomaia / bug_my_sql_not_brew_rails
Created July 30, 2013 14:10
Erro do mysql não instalado pelo brew, com o rails
Problema:
mysql2.rb:8:in `require': dlopen(/Users/rodrigo/.rvm/gems/ruby-1.9.3-p0@atlas/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Users/rodrigo/.rvm/gems/ruby-1.9.3-p0@atlas/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/rodrigo/.rvm/gems/ruby-1.9.3-p0@atlas/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle
Solução:
http://stackoverflow.com/questions/10557507/rails-mysql-on-osx-library-not-loaded-libmysqlclient-18-dylib
no meu, resolveu isso aqui:
MYSQL=/usr/local/mysql/bin
@rodrigomaia
rodrigomaia / install_prezto.sh
Created July 23, 2013 11:23
How to install and customize PREZTO
cd ~
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
zsh
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
chsh -s /bin/zsh
open .zpreztorc
@rodrigomaia
rodrigomaia / error_prezto_rvm.txt
Created July 23, 2013 09:59
Erro do prezto com rvm
error:
/Users/rodrigo/.rvm/scripts/initialize:42: __rvm_cleanse_variables: function definition file not found
/Users/rodrigo/.rvm/scripts/initialize:44: command not found: rvm_error
soluction:
rm -f ~/.zcompdump
@rodrigomaia
rodrigomaia / .zpreztorc
Created July 23, 2013 09:52
My Prezto Config
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
#
# General
#
@rodrigomaia
rodrigomaia / new_gist_file
Created May 14, 2013 11:02
RoR no Ubuntu
sudo apt-get install ruby1.9.1-dev zlib1g-dev build-essential openssl libssl-dev libyaml-dev libv8-dev sqlite3 libsqlite3-dev imagemagick
gem install rails
gem install execjs
@rodrigomaia
rodrigomaia / new_gist_file
Created May 2, 2013 14:44 — forked from billsinc/gist:1157544
Desinstalar o firebird
#!/bin/sh
echo "Clean Services"
echo "Clean User"
dscl localhost -delete /Local/Default/Users/firebird
echo "Clean Group"
dscl localhost -delete /Local/Default/Groups/firebird
if [ -f "/Library/StartupItems/Firebird" ]; then
echo "Remove SuperServer StartupItem"
rm -fr /Library/StartupItems/Firebird
fi

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@rodrigomaia
rodrigomaia / gist:4269207
Created December 12, 2012 16:20
my_engine/script/rails
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/atlas_ag/engine', __FILE__)
require 'rails/all'
require 'rails/engine/commands'
@rodrigomaia
rodrigomaia / gist:4260245
Created December 11, 2012 16:54
Getting Started with Engines
rails plugin new sudy_ag --full
# copiar as migrations pro hospedeiro
rake sudy_ag_engine:install:migrations
fonte: http://guides.rubyonrails.org/engines.html