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 Album < ActiveRecord::Base | |
has_many :assets | |
belongs_to :user | |
def self.formatted | |
all.map do |album| | |
{:id => album.id, | |
:name => album.name} | |
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
var Core = (function($) { | |
var self; | |
// private methods: | |
var mathTest = function(method, arr) { | |
return Math[method].apply(Math, arr); | |
}; | |
return { |
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
Core.registerModule('utilities', function(sandbox) { | |
}); | |
return { | |
init: function() { | |
sandbox.listen('make-draggables', this.makeDraggables, true); | |
} | |
}; |
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 Core = (function($) { | |
return { | |
modules: {}, | |
addModule: function(module_name, fn) { | |
// create new sandbox for module | |
var sandbox = new Sandbox(module_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
class Dog | |
def initialize(options = {}) | |
@name = options[:name] | |
@color = options[:color] | |
@breed = options[:breed] | |
@hair = options[:hair] | |
@size = options[:size] | |
end | |
def description |
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
#import <Cocoa/Cocoa.h> | |
@interface Dog : NSObject { | |
NSString *name; | |
NSString *color; | |
NSString *hair; | |
NSString *size; | |
NSString *breed; | |
} | |
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
<%- content_tag :li, :id => "dropdown_#{dropdown.id}" do %> | |
<%= dropdown.name %> | |
<%- unless dropdown.filtered_webpages.length.zero? -%> | |
<ul class="sortable"> | |
<%= hidden_field_tag "webpages[dropdown_#{dropdown.id}]", :id => nil %> | |
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
accepts_nested_attributes_for :photo | |
def image_file=(new_image_file) | |
# "image/jpeg; charset=binary" --> jpeg | |
server_format = File.mime_type?(new_image_file).match(/^.*\/([^\;]*)/).captures.first.upcase | |
set_photo(server_format, :image_file => new_image_file) | |
end | |
def image_file_url=(new_image_file_url) |
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 PdfFile < ActiveRecord::Base | |
belongs_to :result_list | |
has_attached_file :attachment, :path => "pdf/:id/:basename.:extension" | |
before_post_process :set_file_name | |
def generate_labels(params) | |
unless job_finish.nil? |
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 'spec_helper' | |
describe ResultList do | |
before(:all) do | |
ResultList.all.map(&:destroy) | |
Contact.all.map(&:destroy) | |
@result_list = ResultList.create! | |
5.times do |