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
<% select_options = %w{Enrolled Redeem Social}.collect {|opt| [opt, opt.downcase] } %> | |
<%= select_tag :dynamic_select, options_for_select(select_options, :selected => params[:type]), :prompt => 'All' %> |
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
rake aborted! | |
regexp buffer overflow | |
(in /Users/james/code/mynightuk/app/assets/stylesheets/application.css) | |
Tasks: TOP => assets:precompile | |
(See full trace by running task with --trace) | |
rake --trace assets:precompile RAILS_ENV=production 15.27s user 4.35s system 88% cpu 22.069 total |
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
# Cucumber test | |
Scenario: Sign up without entering Account name | |
When I navigate to the signup form | |
And I fill in every signup field except "Account name" | |
And I click the signup button | |
Then I should be shown an error message telling me to enter "Account name" | |
# Step definitions |
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
<!DOCTYPE html> | |
<!-- Helpful things to keep in your <head/> | |
// Brian Blakely, 360i | |
// http://twitter.com/brianblakely/ | |
--> | |
<head> | |
<!-- Disable automatic DNS prefetching. | |
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
## lib/test/test.rb | |
require 'lib/test/app/models/card' | |
require 'lib/test/exts/user' | |
## lib/test/exts/user.rb | |
module Test | |
module User | |
module ClassMethods |
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
it "should save latlng in db" do | |
@venue = Fabricate(:venue) | |
expect { Venue.find_address(@venue.id) }.to change(@venue, :latlng).to([51.5339146, 0.7840745000000001]) | |
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
# Example: | |
def example(class) | |
class.constantize.all | |
end | |
# Calling it: | |
example('person') |
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
def manage_thing(args={}) | |
args.each do |action, object| | |
case action | |
when :create | |
# create code | |
when :remove | |
# removal code | |
end | |
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
MacBook-Pro:turnstile-stable(1m|master) $ cap newrelic:notice_deployment -Snewrelic_desc="This is a test" | |
* executing `newrelic:notice_deployment' | |
* Getting log of changes for New Relic Deployment details | |
** Error creating New Relic deployment (undefined local variable or method `source' for #<Capistrano::Configuration::Namespaces::Namespace:0x0000010148e110>) | |
** /Users/james/.rvm/gems/ruby-1.9.2-p0@turnstile-stable/gems/capistrano-2.6.0/lib/capistrano/configuration/namespaces.rb:188:in `method_missing' | |
** /Users/james/.rvm/gems/ruby-1.9.2-p0@turnstile-stable/gems/newrelic_rpm-3.1.0/lib/new_relic/recipes.rb:28:in `block (3 levels) in <top (required)>' | |
** /Users/james/.rvm/gems/ruby-1.9.2-p0@turnstile-stable/gems/capistrano-2.6.0/lib/capistrano/configuration/execution.rb:139:in `instance_eval' | |
** /Users/james/.rvm/gems/ruby-1.9.2-p0@turnstile-stable/gems/capistrano-2.6.0/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly' | |
** /Users/james/.rvm/gems/ruby-1.9.2-p0@turnstile-stable/g |
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
# Email model | |
class EmailAddress < ActiveRecord::Base | |
belongs_to :emailable, :polymorhpic => true | |
validates_presence_of :address | |
validates_format_of :address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i | |
attr_accessible :address, :location | |
end |