-
Speklappen
-
Uien
-
Zout
-
Peper
-
Sambal
-
Ketjap
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
" Save session and close vim by pressing SQ. | |
" When you open vim again, without arguments, it opens the saved session. | |
nmap SQ <ESC>:mksession! ~/.vim/Session.vim<CR>:wqa<CR> | |
function! RestoreSession() | |
if argc() == 0 "vim called without arguments | |
execute 'source ~/.vim/Session.vim' | |
end | |
endfunction |
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
# CSS colors supported by all major browsers. | |
# Source: http://www.w3schools.com/CSS/css_colornames.asp | |
module Colors | |
extend self | |
def alice_blue; "#f0f8ff"; end | |
def antique_white; "#faebd7"; end | |
def aqua; "#00ffff"; end | |
def aquamarine; "#7fffd4"; end | |
def azure; "#f0ffff"; 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
1) | |
'User should get all active users' FAILED | |
expected any? to return false, got true | |
./spec/models/user_spec.rb:26: |
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 | |
named_scope :all, lambda { |*options| options.first || {} } | |
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
# This a sample YML file from Rails 2.3. The objective is to propose a yml based on this | |
# one which will reduce error messsages duplication, as outline in this post: | |
# | |
# http://groups.google.com/group/rails-i18n/browse_thread/thread/3085a78831ed8fae | |
# | |
# Proposals are available below and also check the forks at the right. | |
en: | |
activerecord: | |
models: | |
admin: "Admin" |
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 File.join(File.dirname(__FILE__), 'config', 'environment') | |
require 'ya2yaml' | |
module PrettyYaml | |
class << self | |
def write(filename, hash) | |
File.open(filename, "w") do |f| | |
f.write(yaml(hash)) | |
end | |
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
var MyClass = new Function(); | |
MyClass.prototype = { | |
/** | |
* bind(Function) -> Function | |
* | |
* The problem with jQuery is that jQuery methods change +this+ inside their | |
* callbacks. This looses your reference to the current object. Pass the | |
* callback-function to +bind+ and it fixes it for you. | |
* |
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
# Without Symbol#to_proc | |
[1, 2, 3].map { |it| it.to_s } | |
[3, 4, 5].inject { |memo, it| memo * it } | |
# With Symbol#to_proc | |
[1, 2, 3].map(&:to_s) | |
[3, 4, 5].inject(&:*) |
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
# Writing Genesis in Ruby, for http://www.whatdigitalrevolution.com/?p=119 | |
God = "God" | |
def God.performs &acts | |
instance_eval &acts | |
end | |
def God.create *stuff | |
"#{self} created #{stuff.join(' and ')}." |