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
a = 5 | |
case a | |
when 1..3 | |
puts "Is smaller or equal to three" | |
when 4..6 | |
puts "Is smaller or equal to six" | |
else | |
puts "Is BIG" | |
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
require 'date' | |
def xmas_count | |
if Time.now.month == 12 && Time.now.day >= 25 | |
(Date.today - Date.new(Time.now.year, 12, 25)).to_i | |
else | |
(Date.today - Date.new(Time.now.year-1, 12, 25)).to_i | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Blog</title> | |
<%= stylesheet_link_tag "application" %> | |
<%= javascript_include_tag "application" %> | |
<%= csrf_meta_tags %> |
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
<% content_for :header do %> | |
<%= javascript_include_tag "filters" %> | |
<% end %> | |
<h1>Show posts</h1> | |
<header> | |
<section id="statistics"> | |
<p>Currently <%= @posts.size %> in <%= @posts.map(&:category).uniq.size %> different categories.</p> | |
<p>Most recent category: <%= @posts.first.category %> | |
</section> |
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 'minitest/autorun' | |
require 'minitest/spec' | |
class ElementTest | |
attr_accessor :value | |
def ==(other) | |
value == other.value | |
end |
NewerOlder