Skip to content

Instantly share code, notes, and snippets.

View patrick99e99's full-sized avatar

Patrick Collins patrick99e99

  • collinator studios
  • Saratoga Springs, Utah
View GitHub Profile
@patrick99e99
patrick99e99 / album.rb
Created March 19, 2011 05:22
album model
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
var Core = (function($) {
var self;
// private methods:
var mathTest = function(method, arr) {
return Math[method].apply(Math, arr);
};
return {
Core.registerModule('utilities', function(sandbox) {
});
return {
init: function() {
sandbox.listen('make-draggables', this.makeDraggables, true);
}
};
var Core = (function($) {
return {
modules: {},
addModule: function(module_name, fn) {
// create new sandbox for module
var sandbox = new Sandbox(module_name);
class Dog
def initialize(options = {})
@name = options[:name]
@color = options[:color]
@breed = options[:breed]
@hair = options[:hair]
@size = options[:size]
end
def description
#import <Cocoa/Cocoa.h>
@interface Dog : NSObject {
NSString *name;
NSString *color;
NSString *hair;
NSString *size;
NSString *breed;
}
<%- 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 %>
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)
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?
require 'spec_helper'
describe ResultList do
before(:all) do
ResultList.all.map(&:destroy)
Contact.all.map(&:destroy)
@result_list = ResultList.create!
5.times do