- Download this application skeleton.
- Convert the app to use AJAX.
- Add any files you changed to your gist and submit your code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Comment(author, text){ | |
this.form = "<form id='new_comment'><textarea></textarea><input name='author' id='authorName' type='text'><input type='submit' value='submit' id='submitButton'></form>"; | |
this.author = author; | |
this.text = text; | |
}; | |
Comment.prototype.addToPage = function() { | |
$('#comment_list').append("<li>" + this.text + "<span class='author'>" + this.author + "</span></li>"); | |
$('#new_comment').replaceWith('<button id="new_comment_button">New Comment</button>'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FruitTree(){ | |
this.height = 0; | |
this.age = 0; | |
this.fruitCollection = []; | |
this.dead = false; | |
} | |
function Fruit(){} | |
FruitTree.prototype.grow = function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Zoo = { | |
animals : [], | |
bipeds : function(){ | |
result = []; | |
for(i=0; i < this.animals.length; i++){ | |
if(this.animals[i].legs == 2){result.push(this.animals[i]);} | |
} | |
return result; | |
}, | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container { | |
/* | |
If you have a block-level element of a certain width, margin: 0 auto; | |
will how you center it inside its parent container. | |
See: http://bluerobot.com/web/css/center1.html | |
Don't change the container width. | |
*/ | |
margin: 0 auto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
module Flashcard | |
class Deck | |
def initialize options = {} | |
@file = options[:deck] || 'default.csv' | |
@deck = load_deck | |
end | |
def list | |
#@deck.inject("") {|memo, card| memo + card.front + "\n" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TreeGrove | |
def initialize(array) | |
end | |
def age! | |
p "Hello!" | |
end | |
def trees | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Die | |
def initialize(sides = 6) | |
@sides = sides | |
end | |
# Remember: rand(N) randomly returns one of N consecutive integers, starting at 0 | |
# So rand(N) returns a random integer in (0..N-1) | |
# And 1 + rand(N) returns a random integer in (1..N) | |
# See: http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-rand | |
def roll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# row coordinate logic | |
ROW_1 = MY_BOARD[0] | |
ROW_2 = MY_BOARD[1] | |
ROW_3 = MY_BOARD[2] | |
ROW_4 = MY_BOARD[3] | |
ROW_5 = MY_BOARD[4] | |
ROW_6 = MY_BOARD[5] | |
ROW_7 = MY_BOARD[6] | |
ROW_8 = MY_BOARD[7] |
NewerOlder