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
bag do | |
field :title, :hint => {:size => 40}, :search => { | |
:sortable => true, | |
:as => :name | |
# Thinking Sphinx options in here | |
} | |
end |
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 SetupDatabase < ActiveRecord::Migration | |
def self.up | |
create_table :categories do |t| | |
t.bag_for :category | |
t.references :sector | |
t.timestamps | |
end | |
add_bag_indexes_for(:categories) | |
end | |
end |
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 File.expand_path(File.dirname(__FILE__) + '/acceptance_helper') | |
describe "Finding a phone" do | |
before do | |
5.times { make_phone! } | |
5.times { Plan.make } | |
@phones = Phone.find(:all) | |
@plan = Plan.find(:all) |
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
[[NSArray arrayWithObjects:...]; | |
is actually just | |
[[[NSArray alloc] initWithObjects:...] autorelease]; | |
It's a convenience method that means you don't need to release it since it's in the autorelease pool. |
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
# AViewController.h | |
@interface AViewController : UIViewController | |
{ | |
} | |
@property(readwrite, retain) NSString *aString; | |
@property(readwrite, assign, getter=isReady) BOOL ready; | |
# AViewController.m | |
@implementation AViewController |
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 Node | |
addToStage: -> | |
console.log "Add node to stage" |
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 CreateMedia < ActiveRecord::Migration | |
def self.up | |
create_table :media do |t| | |
t.string :name, :null => false | |
t.text :description | |
t.references :asset, :null => false | |
t.timestamps | |
end | |
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
APPLICATION[:version] == '1.0.1' | |
APPLICATION[:language] == 'en-uk' |
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
module WardenStub | |
def warden | |
@_warden ||= mock | |
end | |
def user | |
@_user ||= mock(User) | |
end |
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 EmailForm | |
EMAIL_REGEX = /\A[\w\.%\+\-]+@(?:[A-Z0-9\-]+\.)+(?:[A-Z]{2,4}|museum|travel)\z/i | |
class Errors < Array | |
def on(method) | |
unless blank? | |
error = find{|error| error[0].to_sym == method.to_sym} | |
return error[1] unless error.blank? | |
end |
NewerOlder