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 ActiveRecord::Base | |
@@cache_store = nil | |
def self.cache_store | |
@@cache_store ||= ActionController::Base.cache_store | |
end | |
def self.caches(method_name, key = nil, options = {}, &block) | |
if key.is_a?(Hash) | |
options = key | |
key = nil |
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
options.scan(/\w+=\w+/).inject({}) { |h,opt| kv = opt.split('='); h[kv.first] = kv.last; h } | |
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
########## Why does the yield output outside the content_tag block? | |
# Method | |
def submit(*args) | |
block_output = yield | |
@template.content_tag(:div, :class => "save_actions") { | |
super(*args) + block_output | |
} | |
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 'net/http' | |
require 'uri' | |
class ScreenShooter | |
SCREEN_SHOOTER_URL = 'http://www.browsrcamp.com/' | |
class << self | |
def screenshot_for(url) | |
returning new(url) do |shooter| | |
shooter.shoot | |
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
<?php | |
class Foo | |
{ | |
protected $user = null; | |
public function __construct($user) | |
{ | |
$this->user = $user; | |
} |
NewerOlder