This file contains hidden or 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
activity_file_1 = ActivityFile.create!( :title => "ActivityFile 1", :date_issued => Date.parse( "2009-02-02" ), :size => 10, :content_type => "text/pdf", :filename => "temp1.pdf", :facility => facility ) | |
activity_file_2 = ActivityFile.create!( :title => "ActivityFile 2", :date_issued => Date.parse( "2009-01-12" ), :size => 10, :content_type => "text/pdf", :filename => "temp1.pdf", :facility => facility ) | |
activity_file_3 = ActivityFile.create!( :title => "ActivityFile 3", :date_issued => Date.parse( "2009-03-24" ), :size => 10, :content_type => "text/pdf", :filename => "temp1.pdf", :facility => facility ) | |
activity_file_4 = ActivityFile.create!( :title => "ActivityFile 4", :date_issued => Date.parse( "2009-02-24" ), :size => 10, :content_type => "text/pdf", :filename => "temp1.pdf", :facility => facility ) | |
activity_file_5 = ActivityFile.create!( :title => "ActivityFile 4", :date_issued => Date.parse( "2009-02-23" ), :size => 10, :content_type => "text/pdf", :filename => "temp1.pdf", :fac |
This file contains hidden or 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
$CALLBACK = nil | |
$i = 0 | |
class HotCode | |
def self.dispatcher(&block) | |
while(42) | |
sleep(0.25) | |
block.call | |
if($CALLBACK != block) |
This file contains hidden or 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
it "should return error 401 with bad key" do | |
get :list, :api_key => "My name is ryan and I'm a big jerkface who goes to Montreal and brags about how awesome the restaurants are" | |
response.status.should == "401" | |
end |
This file contains hidden or 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
{ :checklist => | |
{ :id => checklist.id, | |
:title => checklist.title, | |
:items => checklist.items | |
} | |
}.to_json |
This file contains hidden or 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 Post < ActiveRecord::Base | |
has_many :comments | |
end | |
class PostController < ApplicationController | |
def show | |
@post = Post.find(param[id]) |
This file contains hidden or 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 archive | |
dates = Post.date_counts(3).sort{|a,b| b <=> a} | |
@links = dates.map do |elem| | |
year, month = elem[0].split(/\//) | |
{:string => DateTime.strptime(elem[0], "%Y/%m").strftime("%B %Y"), :year => year, :month => month} | |
@links = @links[] | |
end | |
render | |
end |
This file contains hidden or 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
foo(0, 0, 0) -> %%funcbody | |
foo(3, [A:B], C) -> %%funcbody | |
foo(A, B, C) -> %%functionbody |
This file contains hidden or 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
namespace :db do | |
desc "Initialize the dev database" | |
task :init_dev => :environment do | |
user = User.find(1) | |
100.times do |i| | |
post = Post.create(:title => "Sample post ##{i+1}", |
This file contains hidden or 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
$("foo").load("herpaderp", function(){/*callback*/}); | |
//becomes | |
$("foo").load('herpaderp'); | |
& /* callback */ |