Skip to content

Instantly share code, notes, and snippets.

View AmeliaJaneMurphy's full-sized avatar

AmeliaJaneMurphy

View GitHub Profile
@AmeliaJaneMurphy
AmeliaJaneMurphy / cat.rb
Created November 19, 2015 02:46
cat.rb_with dog
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
def feed(food)
puts "Mmmmm, " + food + "!"
class Cat
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
def feed(food)
puts "Mmmmm, " + food + "!"
def fav_foods
food_array=[]
3.times do
puts "Name a favorite food."
food_array<<gets.chomp
puts "Your favorite foods are #{food_array.join(", ")}."
end
food_array.each do |food|
puts "I like #{food} too!"
end
if (5+5==10)
puts "this is true"
else
puts "this is false"
end
@AmeliaJaneMurphy
AmeliaJaneMurphy / index.html
Created September 17, 2015 20:39
Maps n Stuff
<!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 -->
<!-- Latest compiled and minified Bootstrap CSS-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
@AmeliaJaneMurphy
AmeliaJaneMurphy / scripts.js
Created September 15, 2015 18:21
Object Literals
var myProjects = [ { title: "First Project", pic: "img/portfolio/buddhacrop.jpg" }, { title: "Second Project", pic: "img/portfolio/theendcrop.jpg" },
{ title: "Third Project", pic: "img/portfolio/treecrop.jpg" },
{ title: "Fourth Project", pic: "img/portfolio/momsite.jpg" }
];
$(document).ready(function() {
//all your code goes here
$(".form-control").css("background-color", "pink");
@AmeliaJaneMurphy
AmeliaJaneMurphy / scripts.js
Created September 14, 2015 21:55
Arrays and more
$(document).ready(function() {
//all your code goes here
$(".form-control").css("background-color", "pink");
$("button").on("click", function(){
console.log("clicked");
var comment = $(".form-control").val();
console.log(comment);
$("#visible-comment").html(comment);
return false;
@AmeliaJaneMurphy
AmeliaJaneMurphy / index.html
Created September 12, 2015 17:58
Conditional Statements
<!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 -->
<!-- Latest compiled and minified Bootstrap CSS-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
@AmeliaJaneMurphy
AmeliaJaneMurphy / scripts.js
Created September 12, 2015 06:31
Intro to JavaScript and jQuery
$(document).ready(function() {
//all your code goes here
$(".form-control").css("background-color", "pink");
$("button").on("click", function(){
console.log("clicked");
var comment = $(".form-control").val();
console.log(comment);
$("#visible-comment").html(comment);
return false;
//no code here
@AmeliaJaneMurphy
AmeliaJaneMurphy / index.html
Created September 12, 2015 03:19
Better CSS
<!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 -->
<!-- Latest compiled and minified Bootstrap CSS-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">