A Pen by Secret Sam on CodePen.
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
# FormBuilder for Ruby on Rails which produces HTML code compatible with Twitter Bootstrap | |
# horizontal forms styles (see here: http://twitter.github.com/bootstrap/base-css.html#forms) | |
# | |
# Features: | |
# * displays validation errors in-line | |
# * has custom option - label-text - to override default label text for an input | |
# | |
# Requirements: | |
# By default, Rails will wrap a field with validation error in an ugly div tag that breaks | |
# the layout. To override this behaviour, add |
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 Object | |
def to_boolean | |
compare_value = self.class == String ? self.downcase : self | |
case compare_value | |
when "no","false",false, "0", 0 | |
false | |
when "yes","true",true, "1", 1 | |
true | |
else | |
!!compare_value |
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
#!/usr/bin/env ruby | |
# pre-commit git hook | |
# will run rspec if and only if current branch is master | |
# script adapted from http://book.git-scm.com/5_git_hooks.html | |
# source : https://gist.github.com/1141992 | |
NO_COMMIT_MESSAGE = "\aDID NOT COMMIT YOUR FILES!" | |
FORMAT = :html |