z, ? | toggle help (this) |
space, → | next slide |
shift-space, ← | previous slide |
d | toggle debug mode |
## <ret> | go to slide # |
c, t | table of contents (vi) |
f | toggle footer |
r | reload slides |
n | toggle notes |
p | run preshow |
Date date = new java.util.Date(2012, 7, 21);
Date date = new java.util.Date(2012, 7, 21);
// August 21st
Date date = new java.util.Date(2012, 7, 21);
// August 21st, 3912
Date date = new java.util.Date(2012, 7, 21);
// August 21st, 3912
// days start from 1
// months start from 0
// years start from 1,900
lightning = Date.new 2012, 7, 21
lightning = Date.new 2012, 7, 21
#=> July 21st, 2012
# days start from 1
# months start from 1
# years start from 1
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
eurucamp - lightning
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
eurucamp - lightning
#=> 27 days
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
eurucamp - lightning
#=> 27 days
lightning..eurucamp
#=> Range of Dates
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
case Date.today
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
case Date.today
when Date.new...lightning then :before
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
case Date.today
when Date.new...lightning then :before
when lightning...eurucamp then :between
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
case Date.today
when Date.new...lightning then :before
when lightning...eurucamp then :between
when eurucamp..Date::Infinity then :after
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
case Date.today
when Date.new...lightning then :before
when lightning...eurucamp then :between
when eurucamp..Date::Infinity then :after
end
#=> :between
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).each do |date|
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).each do |date|
puts date
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).each do |date|
puts date
end
# 2012-07-21
# 2012-07-22
# 2012-07-23
# …
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).all? &:friday?
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).all? &:friday?
#=> false :(
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).count &:friday?
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).count &:friday?
#=> 4 \o/
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).select &:friday?
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).select &:friday?
#=> July 27th, August 3rd, August 10th, August 17th
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).each_cons(2) do |lower, upper|
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).each_cons(2) do |lower, upper|
puts "#{lower} - #{upper}"
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).each_cons(2) do |lower, upper|
puts "#{lower} - #{upper}"
end
# 2012-07-21 - 2012-07-22
# 2012-07-22 - 2012-07-23
# 2012-07-23 - 2012-07-24
# 2012-07-24 - 2012-07-25
# 2012-07-25 - 2012-07-26
# 2012-07-26 - 2012-07-27
# 2012-07-27 - 2012-07-28
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).partition do |date|
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
(lightning..eurucamp).partition do |date|
date.saturday? or date.sunday?
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
weekend, weekday = (lightning..eurucamp).partition do |date|
date.saturday? or date.sunday?
end
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
weekend, weekday = (lightning..eurucamp).partition do |date|
date.saturday? or date.sunday?
end
weekend
#=> July 21st, July 22nd, July 28th, July 29th,
# August 4th, August 5th, August 11th, August 12th
lightning = Date.new 2012, 7, 21
eurucamp = Date.new 2012, 8, 17
weekend, weekday = (lightning..eurucamp).partition do |date|
date.saturday? or date.sunday?
end
weekend
#=> July 21st, July 22nd, July 28th, July 29th,
# August 4th, August 5th, August 11th, August 12th
weekday
#=> the rest :(
class Date
def free?
saturday? or sunday? or (month == 8 and day == 15)
end
end
fun = %w(✈ ⚓ ⚛ ♥ ♫ ⚘ ✍ ✂ ⚔)
fun = %w(✈ ⚓ ⚛ ♥ ♫ ⚘ ✍ ✂ ⚔)
plans = ->(free) { free ? fun.sample : '⚒' }
fun = %w(✈ ⚓ ⚛ ♥ ♫ ⚘ ✍ ✂ ⚔)
plans = ->(free) { free ? fun.sample : '⚒' }
(lightning..eurucamp).chunk(&:free?).each do |free, dates|
end
fun = %w(✈ ⚓ ⚛ ♥ ♫ ⚘ ✍ ✂ ⚔)
plans = ->(free) { free ? fun.sample : '⚒' }
(lightning..eurucamp).chunk(&:free?).each do |free, dates|
puts dates.map { plans.(free) }.join ' '
end
fun = %w(✈ ⚓ ⚛ ♥ ♫ ⚘ ✍ ✂ ⚔)
plans = ->(free) { free ? fun.sample : '⚒' }
(lightning..eurucamp).chunk(&:free?).each do |free, dates|
puts dates.map { plans.(free) }.join ' '
end
# ⚛ ✈
fun = %w(✈ ⚓ ⚛ ♥ ♫ ⚘ ✍ ✂ ⚔)
plans = ->(free) { free ? fun.sample : '⚒' }
(lightning..eurucamp).chunk(&:free?).each do |free, dates|
puts dates.map { plans.(free) }.join ' '
end
# ⚛ ✈
# ⚒ ⚒ ⚒ ⚒ ⚒
fun = %w(✈ ⚓ ⚛ ♥ ♫ ⚘ ✍ ✂ ⚔)
plans = ->(free) { free ? fun.sample : '⚒' }
(lightning..eurucamp).chunk(&:free?).each do |free, dates|
puts dates.map { plans.(free) }.join ' '
end
# ⚛ ✈
# ⚒ ⚒ ⚒ ⚒ ⚒
# ✍ ♫
# ⚒ ⚒ ⚒ ⚒ ⚒
# ✈ ⚓
# ⚒ ⚒ ⚒ ⚒ ⚒
# ✂ ✍
# ⚒ ⚒
# ♥
# ⚒ ⚒