Skip to content

Instantly share code, notes, and snippets.

# S3 backend for paperclip plugin. Copy the file to:
# +config/initializers/+ directory
#
# Example configuration for CNAME bucket:
#
# has_attached_file :image,
# :s3_host_alias => "bucket.domain.tld",
# :url => ":s3_alias_url",
# :styles => {
# :medium => "300x300>",
From 8223ca815151ca228010fe2ced3796ef5ff904d6 Mon Sep 17 00:00:00 2001
From: Matthijs <[email protected]>
Date: Thu, 22 Apr 2010 14:11:33 +0200
Subject: [PATCH] Paperclip::Style.new should keep passed definition hash intact.
Also look at paperclip.rb:326. There is an instance-level cache, but the class-level definition hash will be altered.
---
lib/paperclip/style.rb | 1 +
test/style_test.rb | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletions(-)
<img id="ctl02_ctl00_ClubInfo_imgIcon" onmouseover="this.style.cursor = 'hand'" onclick="popUpWindow('&lt;html>&lt;head>&lt;title>&lt;/title>&lt;script type=&quot;text/javascript&quot;>function fitPic() { if (window.innerWidth){iWidth = window.innerWidth;iHeight = window.innerHeight;}else{iWidth = document.body.clientWidth;iHeight =document.body.clientHeight;}iWidth = document.images[0].width - iWidth;iHeight = document.images[0].height - iHeight;iWidth = iWidth + 30;iHeight = iHeight + 65;window.resizeBy(iWidth, iHeight); if (window.outerWidth){resizedWidth = window.outerWidth;resizedHeight = window.outerHeight;}else{resizedWidth = document.body.offsetWidth;resizedHeight =document.body.offsetHeight;}if(window.screen){var WndTop = (screen.availHeight - resizedHeight) / 2;var WndLeft = (screen.availWidth - resizedWidth ) / 2;self.moveTo(WndLeft,WndTop); if(resizedHeight&lt;screen.availHeight){if (document.body) {document.body.scroll=&quot;no&quot;}}};};&lt;/script>&lt;/head>&lt;body onload=&quot;fitPic();&q
map.resources :posts #=> /posts/2/comments
map.resources :comments #=> /comments
map.resources :posts do |post|
post.resources :comments #=> /posts/2/comments
end
map.resources :categories, :has_many => :posts #=> /categories/3/posts
map.resources :posts, :has_many => :comments #=> /posts/1/categories
dsfdsafsadfsdfsdf
>> regel = 'Welkom <%= t(:dames) %> en <%= t(:heren) %>. <%= t(:tot_ziens) %>.'
=> "Welkom <%= t(:dames) %> en <%= t(:heren) %>. <%= t(:tot_ziens) %>."
>> regel.scan(/t\W:(\w*)/)
=> [["dames"], ["heren"], ["tot_ziens"]]
>> regel.scan(/t\W:(\w*)/).flatten
=> ["dames", "heren", "tot_ziens"]
>> regels = regel + "\n" + regel + "\n" + regel + "\n" + regel
=> "Welkom <%= t(:dames) %> en <%= t(:heren) %>. <%= t(:tot_ziens) %>.\nWelkom <%= t(:dames) %> en <%= t(:heren) %>. <%= t(:tot_ziens) %>.\nWelkom <%= t(:dames) %> en <%= t(:heren) %>. <%= t(:tot_ziens) %>.\nWelkom <%= t(:dames) %> en <%= t(:heren) %>. <%= t(:tot_ziens) %>."
>> regel.scan(/t\W:(\w*)/).flatten
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function parse_git_branch {
ref=$(git-symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
Dit is een test
app = Merb::Rack::Application.new
request = fake_request({:request_uri => '/test'})
response = app.call(request.env)
p response
[200, {"Date"=>"Tue, 16 Sep 2008 14:38:16 +0200", "Content-Type"=>"text/html; charset=utf-8"}, "Hello There!"]
describe 'Car' do
describe "when starting" do
before :each do
@key = Key.new (or mock if Key.new requires too much setup code)
@car = Car.new(@key)
end
it "should insert key" do
@key.expects(:insert)
@car.start