Skip to content

Instantly share code, notes, and snippets.

View kdefliese's full-sized avatar

Katherine kdefliese

View GitHub Profile
@kdefliese
kdefliese / Code cleaned up.html
Last active August 29, 2015 14:14
Code review assignment
<!-- I added the .toUpperCase() function to my original script so the user should be able to type answers either capitalized or lowercase -->
<script>
var answer1 = prompt("Welcome to Harry Potter trivia! (Special Hermione Granger Edition) What is Hermione Granger's middle name?");
while (answer1.toUpperCase() !== "JEAN") {
var answer1 = prompt("Nope! Try again");
}
if (answer1.toUpperCase() === "JEAN") {
alert("Correct!");
}
else {
@kdefliese
kdefliese / Outline from HTML outliner
Last active August 29, 2015 14:15
HTML outline assignment
It's not very helpful :-(
1. Untitled Section
1. Untitled Section
2. Untitled Section
3. Untitled Section
4. Untitled Section
1. Untitled Section
5. Untitled Section
6. Untitled Section
@kdefliese
kdefliese / Mario Kart style.html
Last active August 29, 2015 14:15
Turtle and rabbit race
<script>
var Animal = function(s,f,n) {
this.speed = s;
this.focus = f;
this.name = n;
this.position = 0;
this.report = function() {
return this.name + " is at " + this.position;
};
this.run = function() {
@kdefliese
kdefliese / race_game.css
Last active August 29, 2015 14:15
Website for race game
.header {
width: 100%;
height: 50px;
}
h1 {
text-align: center;
font-size: 24px;
}
.grass {
background-color: lightgreen;
@kdefliese
kdefliese / race.css
Last active August 29, 2015 14:16
race game for jquery up assignment
.header {
width: 100%;
height: 50px;
margin: auto;
text-align: center;
}
h1 {
text-align: center;
font-size: 24px;
}
// creating a JSON object that contains all my cats
"allMyCats": [
{"name": "Maxwell", "color": "black", "type: "Burmese"},
{"name": "Gracie", "color": "black and white", "type: "American shorthair"},
{"name": "Gizmo", "color": "tabby", "type: "unknown"}
// using a get ajax request to access the JSON endpoint created in question #4
$.get("http://localhost:3000/cats", function(response) {
// replacing the text of the element with id="putCatHere" with the JSON data that is returned from the endpoint
$("#putCatHere").text(response);
});
@kdefliese
kdefliese / LTP_2-5.rb
Created September 24, 2015 04:10
Homework for 9/23
hours_per_year = 24 * 365
puts "The number of hours in a year is #{hours_per_year}"
mins_per_decade = 60 * 24 * 365 * 10
puts "The number of minutes in a decade is #{mins_per_decade}"
age_in_seconds = 60 * 60 * 24 * 365 * 26
puts "I have been alive for about #{age_in_seconds} seconds"
authors_age = 1160000000 / 60 / 60 / 24 / 365
@kdefliese
kdefliese / random-menu.rb
Created September 24, 2015 22:05
Random menu generator
puts "Hello! This is a random menu generator"
# I added the user-submitted words to my original arrays because it was kind of annoying for the user to have to input 30+ words on the command line...
user_adjectives = ["hot","cold","tasty","spicy","bland","overcooked","raw","disgusting","burned","crispy"]
user_cooking_styles = ["pan-seared","baked","broiled","deep-fried","roasted","julienned","boiled","microwaved","stir-fried","barbecued"]
user_foods = ["yams","bread","peanut butter and jelly sandwiches","yogurts","chia seeds","chocolates","tacos","burritos","gravy","applesauce"]
puts "Let's add some items to the menu!"
3.times { puts "Enter an adjective:"
new_adj = gets.chomp
user_adjectives.push(new_adj) }
@kdefliese
kdefliese / LTP_5-6.rb
Created September 25, 2015 01:07
Homework for 9/24
puts "Hello! What's your first name?"
first_name = gets.chomp
puts "What about your middle name? Don't be embarassed!"
middle_name = gets.chomp
puts "And finally, your last name!"
last_name = gets.chomp
puts "So your full name is #{first_name} #{middle_name} #{last_name}? That's a good name!"
puts "What's your favorite number, #{first_name}?"