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
def leap_year?(year) | |
if year % 400 == 0 | |
true | |
# yield calc minutes | |
elsif year.to_s[-2..-1] != "00" && year % 4 == 0 | |
true | |
# yield calc minutes | |
else | |
false |
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
def split_message(message) | |
lst = message.split("\n") | |
count = 1 | |
lst.each do |part| | |
puts "Line #{count}:" + part | |
puts "" | |
count += 1 | |
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
# under my_ruby_programs/test/minitest | |
require "minitest/autorun" | |
class TestTimesTable < Minitest::Test | |
def setup | |
@table = Table.new | |
end | |
def test_test |
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
def convert(x) | |
x.each do |b| | |
a = b / 60.0 / 60.0 / 24.0 / 365.0 * 12.0 | |
a = a.to_i | |
if a % 12 != 0 | |
months = a % 12 | |
months = " and #{months} months" | |
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
def transpose(lis) | |
arr1 = [] | |
arr2 = [] | |
lis.each do |x, y| | |
arr1 << x | |
arr2 << y | |
end | |
puts arr1.inspect |
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
app/models/group.rb | |
app/models/group/archive.rb | |
app/models/group/membership.rb |
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
def show | |
@group = Group.find(params[:id]) | |
@archive = Archive.new | |
@lift_type = ["Squat", "Bench", "Deadlift", "Overhead Press"] | |
@membership = Membership.where(group_id: (params[:id])) | |
end |
NewerOlder