Skip to content

Instantly share code, notes, and snippets.

View tow8ie's full-sized avatar
🦉
Maybe up too late.

Tobias Adam tow8ie

🦉
Maybe up too late.
View GitHub Profile
@tow8ie
tow8ie / gist:6164101
Created August 6, 2013 12:40
Example of how to compose RSpec matchers.
RSpec::Matchers.define :my_composed_matcher do |expected|
match do |actual|
begin
expect(actual).to be_some_fancy_aspect_of(expected)
true
rescue RSpec::Expectations::ExpectationNotMetError => error
false
end
end
end
@tow8ie
tow8ie / gist:5628951
Created May 22, 2013 16:30
Bash watch-Skript von @blindgaenger
ww () {
local config=".watch"
local target='.'
local changes=
if [[ $# -eq 1 ]]
then
$target = $1
fi
echo "watching $target"
cd $target
@tow8ie
tow8ie / leap_year.coffee
Created April 16, 2013 09:07
CoffeeScript function to calculate a leap year.
# Taken from http://en.wikipedia.org/wiki/Leap_year#Algorithm
isLeapYear = (year) ->
if year % 400 == 0 then true
else if year % 100 == 0 then false
else if year % 4 == 0 then true
else false
@tow8ie
tow8ie / gist:3953688
Created October 25, 2012 16:06
JavaScript Inheritance Patterns
@tow8ie
tow8ie / gist:1430598
Created December 4, 2011 16:26
Error while installing cdargs via homebrew
Error: undefined local variable or method `xcode_version' for cdargs:Cdargs
Please report this bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue
/usr/local/Library/Homebrew/formula.rb:354:in `handle_llvm_failure'
/usr/local/Library/Homebrew/formula.rb:268:in `brew'
/usr/local/Library/Homebrew/build.rb:53:in `install'
/usr/local/Library/Homebrew/build.rb:27
/usr/local/Library/Formula/cdargs.rb:28
@tow8ie
tow8ie / gist:1181986
Created August 30, 2011 20:51
Unicorn
/
.7
\ , //
|\.--._/|//
/\ ) ) ).'/
/( \ // /
/( J`((_/ \
/ ) | _\ /
/|) \ eJ L
@tow8ie
tow8ie / answers.rb
Created May 3, 2011 12:35
Rack Nested Params Parsing Quiz
# See https://github.com/rack/rack/blob/master/test/spec_utils.rb
# and http://www.ruby-forum.com/topic/215584
# for further details and historical explanation
"x[y][z]=1" # => {"x" => {"y" => {"z" => "1"}}}
"x[y][z][]=1" # => {"x" => {"y" => {"z" => ["1"]}}}
"x[y][z]=1&x[y][z]=2" # => {"x" => {"y" => {"z" => "2"}}}
@tow8ie
tow8ie / gist:710264
Created November 22, 2010 17:07
Pattern for including JS-DOM-Snippets into HTML
<script type="text/template" id="item-template">
<div class="todo <%= done ? 'done' : '' %>">
<div class="display">
<input class="check" type="checkbox" <%= done ? 'checked="checked"' : '' %> />
<div class="todo-content"></div>
<span class="todo-destroy"></span>
</div>
<div class="edit">
<input class="todo-input" type="text" value="" />
</div>
after 'deploy', 'git:tag'
after 'deploy:migrations', 'git:tag'
namespace :git do
desc "tags the deployed version and pushes it to the git repo"
task :tag, :except => { :no_release => true } do
cmd = "git tag #{rails_env}/#{Time.now.strftime("%Y_%m_%d-%H_%M-%Z")} && git push --tags"
system(cmd)
end
end
-# Ist es so im Quelltext?
%a(href="/") Selbermachen - Das Heimwerkerlexikon
%ul
%li
Hefte
%li
Abonnement
%li
CD-Roms