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
require 'RMagick' | |
class ArticleSet < ActiveRecord::Base | |
validates_presence_of :name | |
validates_length_of :name, :minimum => 3 | |
# creator | |
belongs_to :user | |
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
# this doesn't throw error, but now file gets uploaded, nothing stored in the blog_image string field (that's my mounted uploader where carrierwave should store the image identifier in) | |
img_path = "#{RAILS_ROOT}/tmp/sets/" | |
img_name = "set_#{self.id}_#{Time.now.to_i}.png" | |
# save composite image to PNG | |
template.write(img_path + img_name) # this works, it generates the desired PNG | |
#save and upload to s3 | |
tmp_image = File.open(img_path + img_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
# category.rb | |
class Category < ActiveRecord::Base | |
acts_as_nested_set | |
attr_accessible :name, :description, :lft, :rgt, :parent_id | |
has_many :categorizations | |
has_many :products, :through => :categorizations | |
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
# models/comment.rb | |
class Comment < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :commentable, :polymorphic => true | |
end | |
# models/post.rb | |
class Post < ActiveRecord::Base | |
belongs_to :post_category |
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
var gallery_item = Backbone.Model.extend({ | |
defaults: { | |
tags : "", | |
project_id : null, | |
image_full_url: null, | |
image_medium_url: null | |
} | |
}); | |
// Bindings to window obj |
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
var gallery_item = Backbone.Model.extend({ | |
defaults: { | |
tags : "", | |
project_id : null, | |
image_full_url: null, | |
image_medium_url: null | |
} | |
}); | |
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
<% for line_item in cart.line_items %> | |
<!-- HTML omitted --> | |
<!-- This link actually removes not only the line_item from cart, but also deletes the product...? . --> | |
<%= link_to "remove", line_item, :confirm => 'Remove from cart?', :method => :delete %> | |
<% 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
// $mq-mobile-portrait : 320px !default; | |
// $mq-mobile-landscape : 480px !default; | |
// $mq-tablet-portrait : 640px !default; -- changed because i want my blog content is around this wide, not 768. you should let content & design determine your breakpoints | |
// $mq-tablet-landscape : 1024px !default; | |
// $mq-desktop : 1382px !default; | |
$mq-mobile-portrait : 20em !default; | |
$mq-mobile-landscape : 30em !default; | |
$mq-tablet-portrait : 40em !default; | |
$mq-tablet-landscape : 64em !default; |
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
define (require) -> | |
Backbone = require "Backbone" | |
Question = require "./Question" | |
QuestionStageList = require "./stage/QuestionStageList" | |
# load tranlations via requirejs i18n module | |
Locales = require "i18n!src/shared_views/nls/Locales" | |
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
require.config({ | |
baseUrl: '/backbone-tests/', | |
paths: { | |
'jquery' : '/app/libs/jquery', | |
'underscore' : '/app/libs/underscore', | |
'backbone' : '/app/libs/backbone', | |
'mocha' : 'libs/mocha', | |
'chai' : 'libs/chai', | |
'chai-jquery' : 'libs/chai-jquery', | |
'models' : '/app/models' |
OlderNewer