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
# At this checkout step indicator, all the checkout steps are turned into links. But how to | |
# turn *only* my completed steps into links? | |
# | |
# <jammanbo> state_machine has no memory. if you need to determine whether you have been | |
# in a state you need to design your machine so that that can be determined from the | |
# current state. | |
# | |
# ---------- | |
# | |
# Expected result: |
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
describe "GET #new" do | |
before do | |
@user = User.new | |
User.stub(:new).and_return(@user) | |
end | |
it "authorizes access" do | |
should_authorize(:new, @user) | |
get :new | |
ned |
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
$('#<%= dom_id(@match) %>').fadeOut(); |
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
#!/bin/bash | |
# Favicon and Apple Touch Icon Generator | |
# | |
# This bash script takes an image as a parameter, and uses ImageMagick to convert it to several | |
# other formats used on modern websites. The following copies are generated: | |
# | |
# * apple-touch-icon-114x114-precomposed.png | |
# * apple-touch-icon-57x57-precomposed.png | |
# * apple-touch-icon-72x72-precomposed.png |
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
public class MyClass | |
{ | |
public static void main(String args[]) | |
{ | |
System.out.println("Hello World".hashCode()); | |
} | |
} | |
=> -862545276 |
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
<p> | |
<b>Comment:</b> | |
<%= comment.body %> | |
</p> | |
<p> | |
<%= link_to 'Destroy Comment', [comment.post, comment], | |
:confirm => 'Are you sure?', | |
:method => :delete %> | |
</p> |
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 Member < ActiveRecord::Base | |
belongs_to :project | |
belongs_to :users | |
attr_accessible :project_id, :user_id | |
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
class Member < ActiveRecord::Base | |
belongs_to :project | |
belongs_to :users | |
attr_accessible :project_id, :user_id | |
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
class Manufacturer < ActiveRecord::Base | |
def self.selectable | |
result = [] | |
result << self.joins(:cars).joins(cars: :basic_articles).where(published: true, cars:{published: true}, basic_articles: {published: true, requires_extra: false}).map{ |r| r.id } | |
result << self.joins(:cars).joins(cars: :basic_articles).joins(cars: [basic_articles: :extras]).where(published: true, cars:{published: true}, basic_articles: {published: true, requires_extra: true}).map{ |r| r.id } | |
return self.where(id: result) | |
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
class Movie < ActiveRecord::Base | |
belongs_to :channel | |
validate :does_not_overlap, :valid_times | |
def self.from_xml(xml) | |
id = xml.attr('id') #parse movie id | |
channel = Channel.find_by_codename(xml.child.name) #get the channel from db | |
name = xml.child.xpath('name').text #get name | |
start_time = parse_time(xml.child.xpath('start_time').text) | |
end_time = parse_time(xml.child.xpath('end_time').text) |
OlderNewer