See https://www.youtube.com/watch?v=4_RJu_TrqO0&feature=youtu.be&t=8h6m40s
$ ruby dilute.rb fib.rb
def fi n
if n < 3
1
else
fib(n-1 + ib(n
end
See https://www.youtube.com/watch?v=4_RJu_TrqO0&feature=youtu.be&t=8h6m40s
$ ruby dilute.rb fib.rb
def fi n
if n < 3
1
else
fib(n-1 + ib(n
end
// Creates a jQuery UI dialog on the fly, every time a link .user-link is clicked, | |
// dialog content will be loaded from the url specified by the clicked link | |
$(function(){ | |
$(".user-link").live('click', function(){ | |
var link = $(this); | |
$("<div><img src='" + BASEPATH + "images/small-spinner.gif' /> </div>") | |
.dialog({ | |
autoOpen: true, //for info, true is default | |
modal: true, |
#!/bin/sh | |
# Detects a forgotten console.log statement | |
# Could be made a pre-commit hook forcing the issue, but then adding jQuery.js becomes cumbersome | |
if $(git show HEAD | grep -q '^\+.*console\.log') | |
then | |
RED='\e[1;31m' | |
NC='\e[0m' | |
echo -e "${RED}WARNING:${NC}" | |
echo " You left in a console.log statement in your code, please reconsider commiting this" |
# this only gets cached in @admin if true | |
# how to cache this also in case of false? | |
def admin? | |
@admin ||= has_role? 'admin' | |
end | |
#is the following ok? |
class LowCoverReport < ActiveRecord::Base | |
# The other solution would fail for an empty list of countries | |
# If you don't need it you also can leave out the class variable | |
country_query = lambda{|o| {:conditions => ["country_id IN (?)", o.countries]} } | |
named_scope :for_user, country_query | |
named_scope :for_session, country_query |
word diffing: | |
git diff --word-diff | |
Slides presentation: http://git-tips.heroku.com/ <- no ninja's inside :-( | |
Useful commands: | |
git log --decorate --oneline --graph | |
git bundle # Especially useful for VPN etc. | |
Branches + merging: |