- Initially install your pry-rails to group development on your apps Gemfile
group :development do
# ..
gem 'pry-rails'
# ..
end
require "bigdecimal" | |
# List of our individual pricing rules | |
TAX = ->(val) { val + val*0.05 } | |
FEE = ->(val) { val + 1 } | |
PREMIUM = ->(val) { val + 10 } | |
DISCOUNT = ->(val) { val * 0.90 } | |
ROUND_TO_CENT = ->(val) { val.round(2) } | |
# One presenter | |
PRESENT = ->(val) { val.to_f } |
group :development do
# ..
gem 'pry-rails'
# ..
end
<<APP>> change this variables |
error_page 400 404 405 =200 @40*_json; | |
location @40*_json { | |
default_type application/json; | |
return 200 '{"code":"1", "message": "Not Found"}'; | |
} | |
error_page 500 502 503 504 =200 @50*_json; | |
location @50*_json { |
Method lookup is a simple affair in most languages without multiple inheritance. You start from the receiver and move up the ancestors chain until you locate the method. Because Ruby allows you to mix in modules and extend singleton classes at runtime, this is an entirely different affair.
I will not build contrived code to exemplify the more complicated aspects of Ruby method lookup, as this will only serve to confuse the matter.
When you pass a message to an object, here is how Ruby finds what method to call:
h = { | |
'a' => :a_value, | |
'b' => nil, | |
'c' => false | |
} | |
h.fetch('a', :default_value) #=> :a_value | |
h.fetch('b', :default_value) #=> nil | |
h.fetch('c', :default_value) #=> false | |
h.fetch('d', :default_value) #=> :default_value |
A timeline of the last four years of detecting good old window.localStorage
.
October 2009: 5059daa
/* | |
|--------------------------------------------------------------------- | |
| 1. Szybkie zaznaczanie | |
|--------------------------------------------------------------------- | |
| Ctrl + D - zaznaczanie kolejnych elementow | |
| ALt + F3 - zaznaczenie wszystkich elementow | |
| PPm + Shift - zaznaczanie kolumnami | |
|--------------------------------------------------------------------- | |
| 2. Wyszukiwanie polecen i plikow | |
|--------------------------------------------------------------------- |
ul | |
{ | |
list-style: none; | |
padding: 0; | |
margin: 0; | |
} |