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
# | |
# Validates format to CNH ( category permission to drive on Brazil) | |
# | |
validates_format_of :license_category, :with => /(^[ABCDE]{1}$)|(AB)/ | |
# | |
# Validates format to License Plate format to Brazil | |
# | |
validates_format_of :license_plate, :with => /([A-Z]{3})\-([0-9]{4})/ |
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
# | |
# Generating theme from web-app-theme | |
# | |
# | |
# Commnad to generate theme | |
# | |
script/generate theme --theme=name_theme | |
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
-module(fact). %% Definição do namespace, deve ter o mesmo nome do arquivo fact.erl | |
-export([fac/1]). %% Exporta a função, ou seja, torna a função acessível fora do módulo. | |
fac(0) -> 1; %% Define uma cláusula para o fatorial quando parâmetro passado for 0 | |
fac(N) -> N * fac(N-1). %% Define uma cláusula para o fatorial quando parâmetro passado for diferente de 0 |
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
rpinto@rpinto-desktop:~$ erl | |
Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] | |
Eshell V5.7.2 (abort with ^G) | |
1> |
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
Eshell V5.7.2 (abort with ^G) | |
1> c(factorial). | |
{ok,factorial} | |
2> factorial:fac(0). | |
1 | |
3> factorial:fac(5). | |
120 | |
4> |
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
-module(factorial). %% Definição do namespace, deve ter o mesmo nome do arquivo factorial.erl | |
-export([fac/1]). %% Exporta a função, ou seja, torna a função acessível fora do módulo. | |
fac(N) -> N * fac(N-1); %% Define uma cláusula para o fatorial quando parâmetro passado for diferente de 0 | |
fac(0) -> 1. %% Define uma cláusula para o fatorial quando parâmetro passado for 0 |
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
Eshell V5.7.2 (abort with ^G) | |
1> c(factorial). | |
./fact.erl:5: Warning: this clause cannot match because a previous clause at line 4 always matches | |
{ok,factorial} | |
2> |
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
#!/bin/bash | |
echo "Automated Setup for Ubuntu 10.04 LTS(Lucid) - REE + Rails with Nginx + Mercurial + postfix" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" |
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
#!/bin/bash | |
echo "Automated Setup for Ubuntu 10.04 LTS(Lucid) - REE + Rails with Nginx " | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" | |
echo "------------------------------------------------------------------" |
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
#... | |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
if html_tag =~ /<label/ | |
%|#{html_tag} <font class="error">#{[instance.error_message].join(', ')}</font>| | |
else | |
error_class = 'fieldWithErrors' | |
nodes = Hpricot(html_tag) | |
nodes.each_child do |node| | |
unless !node.elem? || node[:type] == 'hidden' || node.classes.include?(error_class) |
OlderNewer