Skip to content

Instantly share code, notes, and snippets.

namespace :secret do
desc "Generate config/session_key_secret if it does not exist"
task :generate_file do
session_key_sec_file = "#{RAILS_ROOT}/config/session_key_secret"
if File.exists?(session_key_sec_file)
puts "File #{session_key_sec_file} already exists. Nothing to do."
else
puts "Generating #{session_key_sec_file}... "
exec "rake --silent secret > #{session_key_sec_file}"
class Hash
def except(*blacklist)
self.reject {|key, value| blacklist.include?(key) }
end
def only(*whitelist)
self.reject {|key, value| !whitelist.include?(key) }
end
end
// as seen on http://jetlogs.org/2007/09/03/jquery-select-boxes-and-change-events/
var message = new Array();
message[1] = "You have selected first item";
message[2] = "You have selected the second item";
message[3] = "You have selected the last item";
Consider this:
I have developed a feature on a branch (F) that is merged into a staging branch (S) using `--no-ff`.
Meanwhile, the master branch (M) has evolved:
I--------M
\
\---S
\ /
F
jQuery(function() {
$("#badge").badge({
user_name: 'awendt',
user_id: 4158038,
show: 12,
link_text: "All my photos on 23 Photo Sharing"
});
});
@awendt
awendt / scooby-doo.rb
Created September 24, 2010 13:09 — forked from fronx/scooby-doo.rb
def scooby(&block)
`say #{yield}`
end
scooby do
"be-doo-be-doo"
end
source 'http://rubygems.org'
gem 'rails', '3.0.3'
group :development do
gem 'ruby-prof', '< 0.9.0'
gem 'rack-contrib' #, :require => 'rack/contrib'
end
@awendt
awendt / snippet.js
Created May 13, 2011 21:24
How to get the GPS coordinates from Google Maps
prompt('',gApplication.getMap().getCenter());
@awendt
awendt / github.rb
Created July 11, 2011 11:53
Open the GitHub repository for the current working dir (assuming their names match)
#!/usr/bin/env ruby
url = "https://github.com/#{%x(git config github.user).chomp}/#{File.basename(Dir.pwd)}"
exec "/usr/bin/open #{url}"
@awendt
awendt / custom.css
Created September 2, 2011 07:32
Like und +1 mit Datenschutz
.custom img#plusone {
cursor: pointer;
}
.custom #fbl {
cursor: pointer;
color:#2361A1;
font:0.65em Verdana, sans-serif;
border: 1px solid #CAD4E7;
border-radius: 3px;