- 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
#Array#map calls the passed block once for each element of the array it was called on. | |
#It creates and return a new array containing the new values. | |
#Array#inject combines each element of an enumerator by applying the operation specified in the attached block or | |
#represented by an operator/method symbol (like +, -, /). If a block is specified, the block is passed an accumulator value | |
#and the individual element. It then returns the value of memo. | |
#Array#select returns a new array containing all the elements of the passed array for which the passed block is true. | |
class Array |
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
#List 10 topics | |
#1. Recursion | |
#2. Pairing effectively | |
#3. Benchmarking | |
#4. Using Regex | |
#5. Using the zip method. | |
#6. When to use destructive methods effectively | |
#7. Loops- each, while, unless | |
#8. Using yield | |
#9. Writing in pseudocode. |
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] |
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
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
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
.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
<!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
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; | |
}, | |
OlderNewer