This file contains 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
# nama_loop.rb | |
# | |
def mod_nama(n) | |
return "Nama Team" if (n % 35) == 0 | |
return "Team" if (n % 7) == 0 | |
(n % 5) == 0 ? "Nama" : "#{n}" | |
end | |
nama_array = [] |
This file contains 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
<html> | |
<head> | |
<title>Le wagon</title> | |
<meta charset="utf-8"></meta> | |
<link href="https://fonts.googleapis.com/css?family=Open+Sans|Raleway" rel="stylesheet"> | |
<link rel="stylesheet" href="style.css"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css"> | |
</head> | |
<body> |
This file contains 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
license: mit |
This file contains 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
beatles = ["john", "ringo", "ringo", "seb"] | |
# beatles = [1, 2, 3, 4, 5, 6, 3] | |
# index => 0 1 2 | |
# | |
# p beatles | |
# beatles[2] = "george" | |
# p beatles |
This file contains 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
sentence1 = "Oh my god" | |
sentence2 = "What the fcccc" | |
def acron(sentence) | |
result = "" | |
sentence.split(" ").each do |word| | |
result += word[0].upcase | |
end | |
return result | |
end |
This file contains 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 flatten_array(array) | |
array.to_s.tr('[]', '').split(',').map(&:to_i) | |
end |
This file contains 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
class Fish | |
attr_accessor :array | |
attr_reader :id, :origin, :color | |
@@array = [] | |
def initialize(attr = {}) | |
@name = attr[:name] | |
@id = @@array.empty? ? 0 : @@array.size | |
@@array << self |