Skip to content

Instantly share code, notes, and snippets.

View rodrigopinto's full-sized avatar

Rodrigo Pinto rodrigopinto

  • Berlin, Germany
  • 07:04 (UTC +01:00)
View GitHub Profile
alias bi= 'bundle install'
alias bex='bundle exec'
alias gra='git remote add'
alias gp ='git push'
alias gl ='git pull'
alias gcm='git commit -m'
require 'hpricot'
class CustomizedErrorFormBuilder < ActionView::Helpers::FormBuilder
def label(method, text = nil, options = {})
text = text || method.to_s.humanize
object = @template.instance_variable_get("@#{@object_name}")
unless object.nil? || options[:hide_errors]
errors = object.errors.on(method.to_sym)
#...
ActionView::Base.default_form_builder = CustomizedErrorFormBuilder
#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)
<% form_for seu_model, :builder => CustomizedErrorFormBuilder do |form| %>
<% end %>
# rollback no seu branch local para a versão anterior
git reset --soft HEAD^
# rollback no github master.
# volte no seu clone local e até o ponto que deseja e rode
git push --force origin master
@rodrigopinto
rodrigopinto / integration.rake
Created May 17, 2011 01:51
basic configuration to use integration
ENV['SCM'] = 'git'
ENV['SKIP_TASKS'] = %w(
scm:update
test:rcov:units
test:rcov:units:verify
test:rcov:functionals
test:rcov:functionals:verify
test:selenium:server:start
test_acceptance
@rodrigopinto
rodrigopinto / generate migratio*.sh
Created July 14, 2011 17:42
rails analfabeto script/generate migratio kkkkk
g migratio update_sluggable_type_from_categoria_to_category
exists db/migrate
create db/migrate/20110714173922_update_sluggable_type_from_categoria_to_category.rb
@rodrigopinto
rodrigopinto / gist:1090325
Created July 18, 2011 18:56
Mais feio que encoxar a mãe no tanque...
FormFieldMask = {
money: {
event: 'keyup',
regex: /[^\d,]/g,
handler: function(event){
var field = event.target;
field.setValue(field.value.replace(FormFieldMask.money.regex, ''));
}
},
@rodrigopinto
rodrigopinto / gist:1092894
Created July 19, 2011 16:00
evalless !!
formFieldMasks = [
{
cssClass: 'money',
event: 'keyup',
handler: function(event){
var regex = /[^\d,]/g;
var field = event.target;
field.setValue(field.value.replace(regex, ''));
}
},
SELECT [shop].*
FROM [shop]
INNER JOIN [project_shop] ON ([shop].[shopid]=[project_shop].[shopid])
WHERE (([project_shop].[ProjectId] = 1000)
AND ((shopid in (select p.ShopId from Price p, Product p where p.ProductId = o.ProductId and o.ProjectId = 23849552638300)))