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
/* Download button */ | |
@-webkit-keyframes downloadButton { | |
from { box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25), 0 2px 10px rgba(0,68,204,.5); } | |
50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25), 0 2px 25px rgba(0,68,204,.9); } | |
to { box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25), 0 2px 10px rgba(0,68,204,.5); } | |
} | |
@-moz-keyframes downloadButton { | |
from { box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25), 0 2px 10px rgba(0,68,204,.5); } | |
50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25), 0 2px 25px rgba(0,68,204,.9); } | |
to { box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25), 0 2px 10px rgba(0,68,204,.5); } |
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
// Create the path (with only the top-left corner rounded) | |
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:imageView.bounds | |
byRoundingCorners:UIRectCornerTopLeft | |
cornerRadii:CGSizeMake(10.0, 10.0)]; | |
// Create the shape layer and set its path | |
CAShapeLayer *maskLayer = [CAShapeLayer layer]; | |
maskLayer.frame = imageView.bounds; | |
maskLayer.path = maskPath.CGPath; |
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_destroy :ensure_not_referenced_by_any_line_item | |
def ensure_not_referenced_by_any_line_item | |
if line_items.count.zero? | |
return true | |
else | |
errors[:base] << "Line Items Present" | |
return false | |
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
<% [:notice, :error, :alert].each do |level| %> | |
<% unless flash[level].blank? %> | |
<div class="alert <%= flash_class(level) %>"> | |
<a class="close" href="#">×</a> | |
<%= content_tag :p, flash[level] %> | |
</div> | |
<% 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
RAILS_ENV=production rake db:setup | |
# produces the error below.....hmmm.....it's a no-worky | |
psql:/yourprojectpath/yourproject/db/structure.sql:29: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory | |
# hstore postgresql extension needs to be installed, so.... | |
sudo apt-get install postgresql-contrib | |
# now your extension should be available to enable so log in with psql | |
psql -d yourproject_production -U yourdbuser -W |
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 render_erb(template_path, params) | |
view = ActionView::Base.new(ActionController::Base.view_paths, {}) | |
class << view | |
include ApplicationHelper | |
end | |
view.render(:file => "#{template_path}.html.erb", :object => params) | |
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
# http://matthewhutchinson.net/2010/10/27/rails-3-subdomain-validation-activemodeleachvalidator | |
# subdomain_validator.rb (place in your lib/ or extra/ load path) | |
class SubdomainValidator < ActiveModel::EachValidator | |
def validate_each(object, attribute, value) | |
return unless value.present? | |
reserved_names = %w(www ftp mail pop smtp admin ssl sftp) | |
reserved_names = options[:reserved] if options[:reserved] | |
if reserved_names.include?(value) | |
object.errors[attribute] << 'cannot be a reserved name' |
OlderNewer