Skip to content

Instantly share code, notes, and snippets.

View Kotoriii's full-sized avatar

Christian Mack Kotoriii

View GitHub Profile
@Kotoriii
Kotoriii / pet.rb
Created February 13, 2016 01:20
Exercise3-5
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
def feed(food)
puts "Mmmm, " + food + "!"
@Kotoriii
Kotoriii / cat.rb
Created February 11, 2016 22:36
Exercise3-4
class Cat
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
def feed(food)
puts "Mmmm, " + food + "!"
@Kotoriii
Kotoriii / fav_foods.rb
Created February 10, 2016 23:00
Exercise3-3
# array = ["a", "d", "e", "b", "c"]
# array.sort!
# my_string = array.join(", ")
# new_array = my_string.split(", ")
def fav_foods
food_array = []
3.times do
puts "Name one of your favorite foods:"
food_array << gets.chomp
@Kotoriii
Kotoriii / program2.rb
Last active February 10, 2016 00:07
Exercise3-2
# Logical operators used in more than one statement
#(5 x 20 == 100) && ("apples" == "apples")
#("this is the same" == "this is not the same") || (12 x 12 == 144)
if (5+5==10)
puts "this is true"
else
puts "this is false"
end
@Kotoriii
Kotoriii / program.rb
Created February 8, 2016 23:10
Exercise3-1
def greeting
puts "Please enter your name:"
name = gets.chomp
puts "Hello" + " " + name
end
greeting
@Kotoriii
Kotoriii / index.html
Created February 5, 2016 23:03
Exercise2-10
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Christian Mack</title>
@Kotoriii
Kotoriii / index.html
Created February 4, 2016 22:21
Exercise2-9
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Christian Mack</title>
@Kotoriii
Kotoriii / index.html
Created February 4, 2016 03:33
Exercise2-8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Christian Mack</title>
@Kotoriii
Kotoriii / index.html
Created February 2, 2016 21:45
Exercise2-7
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Christian Mack</title>
@Kotoriii
Kotoriii / index.html
Last active February 1, 2016 23:21
Exercise 2-6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Christian Mack</title>