Skip to content

Instantly share code, notes, and snippets.

View LewisYoul's full-sized avatar

Lewis Youl LewisYoul

View GitHub Profile
@LewisYoul
LewisYoul / test test test
Created April 15, 2020 08:20
test test test
test test test
@LewisYoul
LewisYoul / test
Created April 15, 2020 07:46
test
test
# './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
#!/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.
def cool(thing)
puts 'ok'
end
@LewisYoul
LewisYoul / html_gist.html
Created September 18, 2017 13:31
HTML Gist Script
<script src="https://gist.github.com/LewisYoul/b95e0cc1adbe47616089fa4652f8b2d3.js"></script>
@LewisYoul
LewisYoul / class_example_1.rb
Created September 18, 2017 11:23
Class Example 1
class Dog
attr_accessor :name, :breed, :age
def initialize (name, breed, age)
@name = name
@breed = breed
@age = age
end
@LewisYoul
LewisYoul / 8_kyu_answer.rb
Created September 18, 2017 10:04
8 Kyu Answer
def invert(list)
list.map { |n| n *= -1 }
end
@LewisYoul
LewisYoul / 8_kyu_question.rb
Last active September 18, 2017 09:53
8 Kyu Question
#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([]) == []