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
# Put this file under Rails.root /lib | |
class CssColourValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
return false unless value | |
record.errors[attribute] << (options[:message] || 'is not a valid CSS colour') unless ::HexadecimalColourValidator.matches?(value) or ::WebSafeColourValidator.matches?(value) | |
end | |
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
package lib | |
{ | |
/* | |
* AS3 Wrapper for jsonp | |
* Hack around flash's cross-domain security policy for | |
* loading json on remote servers. ONLY works when flash is in a browser. | |
* | |
* example: | |
* JSONP.get("http://api.twitter.com/statuses/user_timeline.json", | |
* "{screen_name:'puppybits', count:'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
" Execute open rspec buffer | |
" Thanks to Ian Smith-Heisters | |
function! RunSpec(args) | |
if exists("b:rails_root") | |
if filereadable(b:rails_root . "/Gemfile") | |
let spec = "bundle exec rspec" | |
elseif filereadable(b:rails_root . "/script/spec") | |
let spec = b:rails_root . "/script/spec" | |
else | |
let spec = "rspec" |