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
| ## DOES THIS MAKE SENSE / IS VALID | |
| class Foo < ActiveRecord::Base | |
| has_many :bar | |
| has_many :baz, :through => :bar | |
| end | |
| class Bar < ActiveRecord::Base | |
| belongs_to :baz | |
| 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
| require 'gdata' | |
| require 'json' #parsing | |
| cal = GData::Client::Calendar.new | |
| cal.source = "innovatis_gdata_test" | |
| cal.clientlogin("your@email.com", "YOUR_PASSWORD") | |
| #now authenticated | |
| #pull list of calendars which the currently logged in user can access. in json | |
| feed = cal.get("https://www.google.com/calendar/feeds/default/allcalendars/full?alt=jsonc") |
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
| (function(){ | |
| var inner_private_var; | |
| window.set_ipv = function(){ | |
| ipv = "herpaderp"; | |
| } | |
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 |