This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Caller | |
def self.exec_before( method_name) | |
@@before = method_name | |
end | |
def self.exec_after( method_name ) | |
@@after = method_name | |
end | |
def execute( &code ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Caller | |
def self.exec_before( method_name) | |
@@before = method_name | |
end | |
def self.exec_after( method_name ) | |
@@after = method_name | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
# Parser for parameters from terminal | |
# When you run a ruby script like $ ruby my_script.rb RAILS_ENV=production DATABASE=postgresql | |
# Usage in you my_script.rb file: | |
# >> p = ParseParams.new(ARGV, 'path/to/config_file.yml') | |
# >> p.params | |
class ParseParams | |
attr_accessor :params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%w(rb js erb).each do |format| | |
Dir.glob("app/**/*.#{format}").each do |file| | |
if File.file? file | |
puts file | |
f = File.open(file, "r:UTF-8") | |
text = f.read | |
new_text = text.gsub(/\t/, ' ') | |
File.open(file, "w:UTF-8") do |file| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails-0.10.0: Routing, Web Services, Components, Oracle | |
active support: | |
class e module attribute accessors: | |
Extends the class object with class and instance accessors for class attributes | |
Extends the module object with module and instance accessors for class attributes | |
inflectors: | |
The Inflector transforms words from singular to plural, class names to table names, modularized class names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change content of file /etc/hostname to | |
princessleia | |
# Add same hostname to /etc/hosts | |
127.0.0.1 localhost | |
127.0.0.1 princessleia | |
# The following lines are desirable for IPv6 capable hosts | |
::1 ip6-localhost ip6-loopback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this line to ~/.gitconfig | |
[alias] | |
lg = log --graph --format=format:'%C(yellow)%h%C(reset) %C(red)- %an%C(reset) - %C(white)%s%C(reset) %C(bold yellow)%d%C(reset) %C(green)(%ar)%C(reset)' --abbrev-commit --date=short | |
# via https://gist.github.com/fernandopso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIT_PS1_SHOWDIRTYSTATE=true | |
PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ ' | |
# via https://gist.github.com/fernandopso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#update ubuntu packager | |
sudo apt-get update | |
#### Dependencies | |
#Install following prerequisite libraries for our environment | |
sudo apt-get install libpcre3-dev build-essential libssl-dev libxml2 libxml2-dev libxslt-dev ncurses-dev | |
#Install image processing libraries, if necessary | |
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Transforms String in URL | |
function friendly_url(str, max) { | |
if (max === undefined) max = 32; | |
var a_chars = new Array( | |
new Array("a", /[áàâãªÁÀÂÃŪ]/g), | |
new Array("e", /[éèêÉÈÊ]/g), | |
new Array("i", /[íìîÍÌÎ]/g), | |
new Array("o", /[òóôõºÓÒÔÕ°Ö]/g), | |
new Array("u", /[úùûÚÙÛµÜü]/g), | |
new Array("c", /[çÇ¢©]/g), |