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 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/}")" | |
} | |
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
>> 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 |
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
dsfdsafsadfsdfsdf |
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
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 |
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
<img id="ctl02_ctl00_ClubInfo_imgIcon" onmouseover="this.style.cursor = 'hand'" onclick="popUpWindow('<html><head><title></title><script type="text/javascript">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<screen.availHeight){if (document.body) {document.body.scroll="no"}}};};</script></head><body onload="fitPic();&q |
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
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(-) |
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
# 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>", |
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
var sys = require('sys'), | |
http = require('http'); | |
var client = http.createClient(666, '127.0.0.1'); | |
client.on('error', function() { | |
sys.log('error during http request'); | |
}) | |
setInterval(function() { | |
sys.log("trying http request"); |
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
#!/bin/sh | |
while [ true ] | |
do | |
sleep 1 | |
echo "Hello" | |
done |
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
/** | |
* Get the ISO week date week number | |
* Matthijs: implementation is not correct! | |
* Added so you can grasp the idea | |
*/ | |
Date.prototype.getWeek = function () { | |
// Create a copy of this date object | |
var target = new Date(this.valueOf()); | |
// ISO week date weeks start on monday |