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 css_class(cat, name) | |
if cat == name | |
return "selected" | |
end | |
return "" | |
end | |
%a{ :href => name, :class => css_class(@category, name) | |
%span= name |
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
<%= user.avatar.exists? ? image_tag(user.avatar.url(:thumb)) : image_tag("/images/person.gif") %> |
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
server { | |
listen 80; | |
server_name www.domain.com; | |
rewrite ^/(.*) http://domain.com/$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name domain.com; | |
} |
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
describe Scorecard::Score::BusinessCapacityScore,"benchmark" do | |
before do | |
@business_capacity = Scorecard::Score::BusinessCapacityScore.new | |
@business_capacity.ues = false | |
@stream_fields = @business_capacity.assistance_type_stream_fields | |
end | |
@stream_fields.each do |stream_label| | |
it "should get the stream: #{stream_label}" do |
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
@@valid_fields = %w(fields in here) | |
named_scope :between, lambda{ |start_date, end_date, field_name| | |
field = (@@valid_fields.include?(field_name)) ? (field_name) : raise (ActiveRecord::StatementInvalid) | |
{ :conditions => ["#{field} >= ? AND #{field} <= ?", start_date, end_date]} | |
} |
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
PHP 5.3.0 (cli) (built: Jul 19 2009 00:34:29) | |
Copyright (c) 1997-2009 The PHP Group | |
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies |
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
class SomeClass < ActiveRecord::Base | |
include NumberToCurrency | |
end | |
module NumberToCurrency | |
def self.included(base) | |
base.extend ClassMethods | |
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
development: &global_settings | |
database: textual_development | |
host: 127.0.0.1 | |
port: 27017 | |
test: | |
database: textual_test | |
<<: *global_settings | |
production: |
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
## With this code instead of passing a file and being a file object in the params like: | |
## Parameters: {"commit"=>"Save changes", "authenticity_token"=>"CNHWuiMsSkwK4x3biFGogUnRU2kutvKuCfOTH2Y+PO4=", "painting"=>{"image"=>#<File:/tmp/RackMultipart20100102-3131-9c0z0-0>}} | |
## it passes just a name of the file like so: | |
## Parameters: {"action"=>"create", "authenticity_token"=>"atvaDTdf2yhQKea8t/VBhYyT2ENyK9B/ZYGQSRq9414=", "painting"=>{"title"=>"g", "height"=>"1", "picture"=>"Tweetie.gif", "width"=>"1"}, "controller"=>"admin/paintings"} | |
## Model |
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
before_filter :clear_flash | |
protected | |
def clear_flash | |
flash[:notice] = nil | |
end |
OlderNewer