Skip to content

Instantly share code, notes, and snippets.

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/}")"
}
>> 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
dsfdsafsadfsdfsdf
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
<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
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(-)
# 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>",
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");
@mlangenberg
mlangenberg / gist:713368
Created November 24, 2010 09:11
/etc/service/foo/run
#!/bin/sh
while [ true ]
do
sleep 1
echo "Hello"
done
/**
* 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