Skip to content

Instantly share code, notes, and snippets.

View janetferguson's full-sized avatar

Janet Ferguson janetferguson

View GitHub Profile
@janetferguson
janetferguson / pet.rb
Created April 17, 2015 04:52
Exercise 25
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 + "!"
@janetferguson
janetferguson / cat.rb
Created April 16, 2015 01:51
Exercise 24
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 + "!"
@janetferguson
janetferguson / fav_foods.rb
Created April 14, 2015 02:49
Exercise 23
def fav_foods
food_array = []
3.times do
puts "Name a favorite food"
food_array << gets.chomp
end
p food_array
puts "Your favorite foods are #{food_array.join(", ")}."
end
@janetferguson
janetferguson / program2.rb
Created April 13, 2015 20:10
Exercise 22
# False if/else statement
if 5 + 4 == 8
puts "this is true"
else
puts "this is false"
end
# True if/else statement
@janetferguson
janetferguson / program.rb
Created April 13, 2015 17:43
Exercise 21
def greeting
puts "Please enter your name:"
name = gets.chomp
puts "Hello" + " " + name
end
greeting
@janetferguson
janetferguson / index.html
Last active August 29, 2015 14:19
Exercise 20
<!DOCTYPE html>
<html lang="en">
<head>
<!-- My js File -->
<meta charset="utf-8">
<title>Janet Ferguson - Full Stack Web Developer | Rubyist</title>
<!-- Latest compiled and minified CSS -->
@janetferguson
janetferguson / scripts.js
Created April 10, 2015 01:51
Exercise 19
// User input transformed into upper case letters + !
$(".btn-default").on("click", function() {
console.log("clicked");
var comment = $("#txt").val().toUpperCase() + "!";
console.log(comment);
$("#visible-comment").html(comment);
return false;
// no code here, just above the 'return false'
});
<!DOCTYPE html>
<html lang="en">
<head>
<!-- My js File -->
<meta charset="utf-8">
<title>Janet Ferguson - Full Stack Web Developer | Rubyist</title>
<!-- Latest compiled and minified CSS -->
@janetferguson
janetferguson / index.html
Last active August 29, 2015 14:18
Exercise 17
<!DOCTYPE html>
<html lang="en">
<head>
<!-- My js File -->
<meta charset="utf-8">
<title>Janet Ferguson - Full Stack Web Developer | Rubyist</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!DOCTYPE html>
<html lang="en">
<head>
<!-- My js File -->
<meta charset="utf-8">
<title>Janet Ferguson - Full Stack Web Developer | Rubyist</title>
<!-- Latest compiled and minified CSS -->