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
#Using invert on the following should return: | |
invert([1,2,3,4,5]) == [-1,-2,-3,-4,-5] | |
invert([1,-2,3,-4,5]) == [-1,2,-3,4,-5] | |
invert([]) == [] |
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 invert(list) | |
list.map { |n| n *= -1 } | |
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 Dog | |
attr_accessor :name, :breed, :age | |
def initialize (name, breed, age) | |
@name = name | |
@breed = breed | |
@age = age | |
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
<script src="https://gist.github.com/LewisYoul/b95e0cc1adbe47616089fa4652f8b2d3.js"></script> |
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 cool(thing) | |
puts 'ok' | |
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
#!/usr/bin/env ruby | |
my_friends = %w(Adam Alice Lydia Sam) | |
puts "My best friends are #{my_friends.join(',')}." | |
#=> "My best friends are Adam, Alice, Lydia, Sam. |
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
# './people.csv' file contents | |
# | |
# name,age,hometown | |
# Tina,22,London | |
# Jim,32,Manchester | |
# Harriet,41,Swansea | |
# declare the Person class in ./person.rb | |
class Person |
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
test |
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
test test test |