This file contains hidden or 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
| guard 'rspec', :version => 2, :spec_paths => ["spec/models", 'spec/controllers'] do | |
| watch(%r{^spec/(models|controllers).+_spec\.rb$}) | |
| watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
| watch('spec/spec_helper.rb') { ["spec/controllers", 'spec/models'] } | |
| watch('spec/factories/*.rb') { ["spec/controllers", 'spec/models'] } | |
| watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
| watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } | |
| watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } |
This file contains hidden or 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
| window.validarCnpj = (cnpj) -> | |
| cnpj = cnpj.replace(/\/|\.|-/g,"") | |
| allEqual = /^(.)\1+$/ | |
| return if (cnpj.length < 14) || allEqual.test(cnpj) | |
| a = [] | |
| b = 0 | |
| c = [6,5,4,3,2,9,8,7,6,5,4,3,2] |
This file contains hidden or 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
| jQuery ($) -> | |
| $("div.control-group").focusout -> | |
| $this = $(this) | |
| if !$this.hasClass("error") | |
| $this.addClass("success") | |
| ClientSideValidations.formBuilders['SimpleForm::FormBuilder'].wrappers.bootstrap = | |
| add: (element, settings, message) -> | |
| wrapper = element.closest(".#{settings.wrapper_class}") | |
| if element.data('valid') != false |
This file contains hidden or 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
| build_package_patched() { | |
| # These three patches are included when RVM builds REE | |
| cd source | |
| wget 'https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/tcmalloc.patch' | |
| wget 'https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/stdout-rouge-fix.patch' | |
| wget 'https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/no_sslv2.diff' | |
| patch -p1 < tcmalloc.patch | |
| patch -p1 < stdout-rouge-fix.patch | |
| patch -p1 < no_sslv2.diff | |
| cd .. |
This file contains hidden or 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
| Rehearsal ------------------------------------------------------------- | |
| INSERTION STATIC : Tree 0.334000 0.000000 0.334000 ( 0.334000) | |
| INSERTION STATIC : Regexp 0.244000 0.000000 0.244000 ( 0.244000) | |
| MATCHING STATIC : Tree 1.297000 0.000000 1.297000 ( 1.297000) | |
| MATCHING STATIC : Regexp 13.382000 0.000000 13.382000 ( 13.382000) | |
| --------------------------------------------------- total: 15.257000sec | |
| user system total real | |
| INSERTION STATIC : Tree 0.045000 0.000000 0.045000 ( 0.045000) | |
| INSERTION STATIC : Regexp 0.106000 0.000000 0.106000 ( 0.106000) |
This file contains hidden or 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 'json' | |
| Virtus::Coercion::String.class_eval do | |
| def self.to_hash(value) | |
| JSON.parse(value) | |
| end | |
| end | |
| module MyApp | |
| module Attributes |
This file contains hidden or 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 'rubygems' | |
| require 'dm-core' | |
| require 'dm-migrations' | |
| DataMapper.setup(:default, 'sqlite::memory:') | |
| class Product | |
| include DataMapper::Resource | |
| property :id, Serial |
This file contains hidden or 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
| orm.map(Exhibit, "exhibits") do |exhibits, type| | |
| exhibits.field :id, type.serial | |
| exhibits.field :name, type.string(200) | |
| exhibits.field :zoo_id, type.integer | |
| exhibits.key :id | |
| end | |
| orm.map(ZooKeeper, 'zoo_keepers') do |zoo_keepers, type| | |
| zoo_keepers.field :id, type.serial |
This file contains hidden or 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 Address # Our custom, embedded-value type | |
| accessor :address => String | |
| accessor :address_2 => String | |
| accessor :city => String | |
| accessor :state => String | |
| accessor :zip_code => String | |
| orm.map_type do |signature, types| | |
| signature.from [self] | |
| signature.typecast_left method(:__load__) |
This file contains hidden or 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 Address # Our custom, embedded-value type | |
| orm.map_type do |signature, types| | |
| signature.from [self] | |
| signature.typecast_left method(:__load__) | |
| signature.to [types.string, types.string, types.string, types.string, types.string] | |
| signature.typecast_right method(:__dump__) | |
| end | |
| end | |
| class Zoo |
NewerOlder