├── 05-04-CRUD ├── solution-code │ ├── .buildpacks │ ├── img │ │ └── bey.jpg │ ├── style.css │ ├── config.html │ ├── index.html │ ├── app.js │ └── client.js ├── starter-code │ ├── img │ │ └── bey.jpg │ ├── style.css │ ├── config.html │ ├── app.js │ ├── index.html │ └── client.js └── readme.md ├── .gitignore ├── 03-23-project-1 ├── starter_code │ ├── hubot-scripts.json │ ├── Procfile │ ├── .gitignore │ ├── bin │ │ ├── hubot.cmd │ │ └── hubot │ ├── .editorconfig │ ├── external-scripts.json │ ├── package.json │ └── scripts │ │ ├── slackbot.js │ │ └── example.coffee └── readme.md ├── 03-28-objects-and-json └── .gitignore ├── 04-11-ajax-and-apis ├── solution-code │ ├── 04-open-weather-map │ │ ├── style.css │ │ ├── index.html │ │ └── main.js │ ├── 03-posts_requests │ │ ├── style.css │ │ ├── package.json │ │ ├── index.html │ │ ├── server.js │ │ └── main.js │ └── 02-movie-browser │ │ ├── images │ │ └── reel.jpg │ │ ├── css │ │ └── style.css │ │ ├── index.html │ │ ├── readme.md │ │ └── js │ │ └── movie_browser.js ├── starter-code │ ├── 04-open-weather-map │ │ ├── style.css │ │ ├── index.html │ │ └── main.js │ ├── 02-movie-browser │ │ ├── js │ │ │ └── movie_browser.js │ │ ├── images │ │ │ └── reel.jpg │ │ ├── css │ │ │ └── style.css │ │ ├── index.html │ │ └── readme.md │ ├── 03-posts_requests │ │ ├── style.css │ │ ├── package.json │ │ ├── index.html │ │ ├── main.js │ │ └── server.js │ └── 01-jquery-ajax │ │ └── index.html └── images │ ├── http_req_resp.gif │ ├── http_request.jpeg │ ├── http_response.jpeg │ ├── chrome_inspector.png │ ├── http1-url-structure.png │ ├── http_request_response.jpeg │ └── webserver_to_rails_setup.jpeg ├── 04-13-async-js-and-callbacks ├── code-along │ └── async-examples.js ├── knock-knock.png ├── solution-code │ ├── iife-exercise │ │ └── main.js │ └── functions-callbacks-exercise │ │ └── main.js ├── starter-code │ ├── iife-exercise │ │ └── main.js │ └── functions-callbacks-exercise │ │ └── main.js └── instagram.md ├── 05-02-prototypal-inheritance ├── solution-code │ ├── 07-oop-monkey-js │ │ ├── lib │ │ │ ├── .gitkeep │ │ │ └── monkey.js │ │ ├── .gitignore │ │ ├── package.json │ │ ├── readme.md │ │ └── spec │ │ │ └── monkey_spec.js │ ├── 04-car-constructor-function │ │ └── app.js │ ├── 03-person-constructor-function │ │ └── app.js │ ├── 01-car-objects │ │ └── app.js │ ├── 06-car-constructor-function-with-prototypes │ │ └── app.js │ ├── 02-make-car-function │ │ └── app.js │ ├── 05-prototypes │ │ └── app.js │ └── 08-prototypal-inheritance │ │ └── app.js └── starter-code │ ├── 07-oop-monkey-js │ ├── lib │ │ ├── .gitkeep │ │ └── monkey.js │ ├── .gitignore │ ├── package.json │ ├── readme.md │ └── spec │ │ └── monkey_spec.js │ ├── 04-car-constructor-function │ └── app.js │ ├── 06-car-constructor-function-with-prototypes │ └── app.js │ ├── 02-make-car-function │ └── app.js │ ├── 03-person-constructor-function │ └── app.js │ ├── 01-car-objects │ └── app.js │ ├── 05-prototypes │ └── app.js │ └── 08-prototypal-inheritance │ └── app.js ├── 03-30-dom-and-jquery ├── code-along │ ├── style.css │ ├── index.html │ └── jquery │ │ └── index.html ├── solution-code │ ├── jquery_exercise │ │ ├── style.css │ │ ├── main.js │ │ └── index.html │ ├── js_dom_exercise │ │ ├── style.css │ │ ├── index.html │ │ └── main.js │ └── js_to_jquery_codealong │ │ ├── style.css │ │ ├── index.html │ │ └── main.js └── starter-code │ ├── jquery_exercise │ ├── style.css │ ├── index.html │ └── main.js │ └── js_dom_exercise │ ├── style.css │ ├── index.html │ └── main.js ├── assets ├── logo.png └── class-pass.png ├── 03-01-prework ├── prework.pdf └── readme.md ├── 03-09-command-line-JS └── img │ ├── butter.jpg │ ├── blocking.jpg │ ├── client-server.jpg │ └── Client-server-model.png ├── 04-06-review ├── starter-code │ ├── atm │ │ ├── ga.png │ │ ├── atm.js │ │ ├── atm.css │ │ ├── index.html │ │ └── readme.md │ └── cash-register │ │ ├── js │ │ └── main.js │ │ ├── readme.md │ │ ├── obfuscated │ │ ├── index.html │ │ ├── js │ │ │ └── main.js │ │ └── css │ │ │ └── main.css │ │ ├── index.html │ │ └── css │ │ └── main.css └── readme.md ├── 03-21-functions-and-scope ├── solution-code │ ├── dice │ │ ├── img │ │ │ ├── 1.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ └── 6.png │ │ ├── js │ │ │ └── app.js │ │ ├── index.html │ │ └── css │ │ │ └── style.css │ ├── currency-converter │ │ ├── img │ │ │ ├── 1.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ └── 6.png │ │ ├── btchubot.png │ │ ├── js │ │ │ └── app.js │ │ ├── index.html │ │ └── css │ │ │ └── style.css │ └── btc-slackbot.js └── starter-code │ ├── dice │ ├── img │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ └── diceroller.png │ ├── js │ │ └── app.js │ ├── index.html │ └── css │ │ └── style.css │ └── currency-converter │ ├── img │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ └── 6.png │ ├── js │ └── app.js │ ├── index.html │ └── css │ └── style.css ├── 04-04-dom-and-jquery-continued ├── solution-code │ ├── pixart_js │ │ ├── ps_neutral.png │ │ ├── style.css │ │ ├── index.html │ │ ├── LICENSE │ │ ├── pixart.js │ │ └── README.md │ ├── templating_codealong │ │ ├── style.css │ │ ├── index.html │ │ └── main.js │ └── events_codealong_and_exercise │ │ ├── style.css │ │ ├── index.html │ │ └── main.js └── starter-code │ ├── pixart_js │ ├── ps_neutral.png │ ├── style.css │ ├── index.html │ ├── LICENSE │ ├── pixart.js │ └── README.md │ ├── events_codealong_and_exercise │ ├── style.css │ ├── main.js │ └── index.html │ └── templating-codealong │ └── index.html ├── 05-09-final-project ├── starter-code │ ├── app.js │ ├── index.html │ ├── readme.md │ ├── config.html │ └── client.js └── readme.md ├── 04-18-advanced-apis ├── starter-code │ ├── style.css │ ├── index.html │ └── app.js └── solution-code │ ├── style.css │ ├── index.html │ └── app.js ├── 04-27-closures-and-this ├── starter-code │ └── make-a-person.js └── solution-code │ ├── closure-brain-teaser.js │ ├── make-a-person-module.js │ ├── make-a-person.js │ └── make-a-person-thisify.js ├── 03-14-data-types ├── data-types-exercise.md ├── lab.md └── lab-solution.md ├── 03-16-collections-and-loops ├── solution-code │ ├── verify-age.js │ └── fizzbizz.js └── starter-code │ └── fizzbuzz.js ├── readme.md ├── 04-20-lab └── readme.md └── 03-07-installfest └── brew-git-node-atom └── readme.md /05-04-CRUD/solution-code/.buildpacks: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /03-23-project-1/starter_code/hubot-scripts.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /03-28-objects-and-json/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/04-open-weather-map/style.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/04-open-weather-map/style.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /04-13-async-js-and-callbacks/code-along/async-examples.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /03-23-project-1/starter_code/Procfile: -------------------------------------------------------------------------------- 1 | web: bin/hubot -a campfire 2 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/07-oop-monkey-js/lib/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/07-oop-monkey-js/lib/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/code-along/style.css: -------------------------------------------------------------------------------- 1 | #name { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/assets/logo.png -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/07-oop-monkey-js/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/07-oop-monkey-js/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /assets/class-pass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/assets/class-pass.png -------------------------------------------------------------------------------- /03-23-project-1/starter_code/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store* 3 | .hubot_history 4 | -------------------------------------------------------------------------------- /03-01-prework/prework.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-01-prework/prework.pdf -------------------------------------------------------------------------------- /03-30-dom-and-jquery/solution-code/jquery_exercise/style.css: -------------------------------------------------------------------------------- 1 | #name { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/solution-code/js_dom_exercise/style.css: -------------------------------------------------------------------------------- 1 | #name { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/starter-code/jquery_exercise/style.css: -------------------------------------------------------------------------------- 1 | #name { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/starter-code/js_dom_exercise/style.css: -------------------------------------------------------------------------------- 1 | #name { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/solution-code/js_to_jquery_codealong/style.css: -------------------------------------------------------------------------------- 1 | #name { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /03-09-command-line-JS/img/butter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-09-command-line-JS/img/butter.jpg -------------------------------------------------------------------------------- /04-06-review/starter-code/atm/ga.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-06-review/starter-code/atm/ga.png -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/02-movie-browser/js/movie_browser.js: -------------------------------------------------------------------------------- 1 | // API Docs at: 2 | // http://www.omdbapi.com -------------------------------------------------------------------------------- /05-04-CRUD/solution-code/img/bey.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/05-04-CRUD/solution-code/img/bey.jpg -------------------------------------------------------------------------------- /05-04-CRUD/starter-code/img/bey.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/05-04-CRUD/starter-code/img/bey.jpg -------------------------------------------------------------------------------- /03-09-command-line-JS/img/blocking.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-09-command-line-JS/img/blocking.jpg -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/03-posts_requests/style.css: -------------------------------------------------------------------------------- 1 | .completed .todo-text { 2 | text-decoration: line-through; 3 | } -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/03-posts_requests/style.css: -------------------------------------------------------------------------------- 1 | .completed .todo-text { 2 | text-decoration: line-through; 3 | } -------------------------------------------------------------------------------- /03-09-command-line-JS/img/client-server.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-09-command-line-JS/img/client-server.jpg -------------------------------------------------------------------------------- /03-23-project-1/starter_code/bin/hubot.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | npm install && node_modules\.bin\hubot.cmd --name "starter-code" %* -------------------------------------------------------------------------------- /04-11-ajax-and-apis/images/http_req_resp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-11-ajax-and-apis/images/http_req_resp.gif -------------------------------------------------------------------------------- /04-11-ajax-and-apis/images/http_request.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-11-ajax-and-apis/images/http_request.jpeg -------------------------------------------------------------------------------- /04-13-async-js-and-callbacks/knock-knock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-13-async-js-and-callbacks/knock-knock.png -------------------------------------------------------------------------------- /04-11-ajax-and-apis/images/http_response.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-11-ajax-and-apis/images/http_response.jpeg -------------------------------------------------------------------------------- /03-09-command-line-JS/img/Client-server-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-09-command-line-JS/img/Client-server-model.png -------------------------------------------------------------------------------- /04-11-ajax-and-apis/images/chrome_inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-11-ajax-and-apis/images/chrome_inspector.png -------------------------------------------------------------------------------- /04-11-ajax-and-apis/images/http1-url-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-11-ajax-and-apis/images/http1-url-structure.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/dice/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/dice/img/1.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/dice/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/dice/img/2.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/dice/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/dice/img/3.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/dice/img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/dice/img/4.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/dice/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/dice/img/5.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/dice/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/dice/img/6.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/dice/img/1.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/dice/img/2.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/dice/img/3.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/dice/img/4.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/dice/img/5.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/dice/img/6.png -------------------------------------------------------------------------------- /04-11-ajax-and-apis/images/http_request_response.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-11-ajax-and-apis/images/http_request_response.jpeg -------------------------------------------------------------------------------- /04-11-ajax-and-apis/images/webserver_to_rails_setup.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-11-ajax-and-apis/images/webserver_to_rails_setup.jpeg -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/07-oop-monkey-js/lib/monkey.js: -------------------------------------------------------------------------------- 1 | // don't forget to use module.exports to export your resulting Monkey constructor! 2 | -------------------------------------------------------------------------------- /04-06-review/starter-code/atm/atm.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | // Uh oh -- it's saying `$` is undefined! Something's missing from `index.html`... 3 | }); 4 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/img/diceroller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/dice/img/diceroller.png -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/04-car-constructor-function/app.js: -------------------------------------------------------------------------------- 1 | // Write a constructor function to replace our `makeCar` function 2 | // earlier. 3 | 4 | 5 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/02-movie-browser/images/reel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-11-ajax-and-apis/solution-code/02-movie-browser/images/reel.jpg -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/02-movie-browser/images/reel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-11-ajax-and-apis/starter-code/02-movie-browser/images/reel.jpg -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/currency-converter/img/1.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/currency-converter/img/2.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/currency-converter/img/3.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/currency-converter/img/4.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/currency-converter/img/5.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/currency-converter/img/6.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/currency-converter/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/currency-converter/img/1.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/currency-converter/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/currency-converter/img/2.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/currency-converter/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/currency-converter/img/3.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/currency-converter/img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/currency-converter/img/4.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/currency-converter/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/currency-converter/img/5.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/currency-converter/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/starter-code/currency-converter/img/6.png -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/pixart_js/ps_neutral.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-04-dom-and-jquery-continued/solution-code/pixart_js/ps_neutral.png -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/pixart_js/ps_neutral.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/04-04-dom-and-jquery-continued/starter-code/pixart_js/ps_neutral.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/btchubot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ga-dc/js1/HEAD/03-21-functions-and-scope/solution-code/currency-converter/btchubot.png -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/currency-converter/js/app.js: -------------------------------------------------------------------------------- 1 | var btcRate; 2 | $.getJSON('https://api.bitcoinaverage.com/ticker/USD/', function(data) { 3 | btcRate = data.last; 4 | }); 5 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/code-along/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /03-23-project-1/starter_code/bin/hubot: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | npm install 6 | export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH" 7 | 8 | exec node_modules/.bin/hubot --name "starter-code" "$@" 9 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/templating_codealong/style.css: -------------------------------------------------------------------------------- 1 | #name { 2 | color: blue; 3 | } 4 | 5 | .inactive { 6 | color: #ccc; 7 | } 8 | 9 | .completed { 10 | text-decoration: line-through; 11 | } 12 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/06-car-constructor-function-with-prototypes/app.js: -------------------------------------------------------------------------------- 1 | // Update the constructor function for our car to define the methods on prototypes 2 | // rather than on the individual instances themselves. 3 | -------------------------------------------------------------------------------- /05-09-final-project/starter-code/app.js: -------------------------------------------------------------------------------- 1 | var Item = new ParseObjectType("Items_initials_here") 2 | 3 | Item.create({title:'My first Item'}, function(){ 4 | Item.getAll(function(err, results){ 5 | console.log(results) 6 | }) 7 | }) -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/events_codealong_and_exercise/style.css: -------------------------------------------------------------------------------- 1 | #name { 2 | color: blue; 3 | } 4 | 5 | .inactive { 6 | color: #ccc; 7 | } 8 | 9 | .completed { 10 | text-decoration: line-through; 11 | } 12 | -------------------------------------------------------------------------------- /05-09-final-project/starter-code/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Starter Code for Project 4 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/events_codealong_and_exercise/style.css: -------------------------------------------------------------------------------- 1 | #name { 2 | color: blue; 3 | } 4 | 5 | .inactive, .complete{ 6 | color:#ccc; 7 | } 8 | 9 | .complete{ 10 | text-decoration: line-through; 11 | } 12 | -------------------------------------------------------------------------------- /04-18-advanced-apis/starter-code/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: tomato; 3 | } 4 | 5 | .images { 6 | display: flex; 7 | flex-wrap: wrap; 8 | height: 1000px; 9 | } 10 | 11 | .image { 12 | flex: 1 1 200px; 13 | margin: 3px; 14 | background-size: cover; 15 | } -------------------------------------------------------------------------------- /04-18-advanced-apis/solution-code/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: tomato; 3 | } 4 | 5 | .images { 6 | display: flex; 7 | flex-wrap: wrap; 8 | height: 1000px; 9 | } 10 | 11 | .image { 12 | flex: 1 1 200px; 13 | margin: 3px; 14 | background-size: cover; 15 | } -------------------------------------------------------------------------------- /03-23-project-1/starter_code/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /03-23-project-1/starter_code/external-scripts.json: -------------------------------------------------------------------------------- 1 | [ 2 | "hubot-diagnostics", 3 | "hubot-help", 4 | "hubot-heroku-keepalive", 5 | "hubot-google-images", 6 | "hubot-google-translate", 7 | "hubot-pugme", 8 | "hubot-maps", 9 | "hubot-redis-brain", 10 | "hubot-rules", 11 | "hubot-shipit" 12 | ] -------------------------------------------------------------------------------- /04-06-review/starter-code/cash-register/js/main.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var $form = $('#entry'); 4 | var $costInput = $('#newEntry'); 5 | 6 | $(function() { 7 | 8 | $form.on('submit', function(event) { 9 | event.preventDefault(); 10 | 11 | var cost = $costInput.val(); 12 | 13 | console.log(cost) 14 | }); 15 | 16 | }); -------------------------------------------------------------------------------- /04-13-async-js-and-callbacks/solution-code/iife-exercise/main.js: -------------------------------------------------------------------------------- 1 | (function timedCountDown(endTime) { 2 | for (var i = 1; i <= endTime; i++) { 3 | (function runCountDown(j){ 4 | setTimeout(function timer(){ 5 | console.log( j ); 6 | }, j*1000 ); 7 | })( i ); 8 | } 9 | })(5); 10 | -------------------------------------------------------------------------------- /04-13-async-js-and-callbacks/starter-code/iife-exercise/main.js: -------------------------------------------------------------------------------- 1 | // Write an IIFE function that takes a timer argument. 2 | // The function will automatically execute and count up every second until the specified argument. 3 | // Use the setTimeout function to count up. 4 | // Hint: a second is the timer passed * 1000 (milliseconds). 5 | -------------------------------------------------------------------------------- /04-06-review/starter-code/cash-register/readme.md: -------------------------------------------------------------------------------- 1 | # Cash Register 2 | 3 | Open the index.html file in the obfuscated folder and examine changes to the DOM. 4 | 5 | Write pseudo-code for how this application should work. 6 | 7 | ## Bonus 8 | 9 | Allow users to delete entries. 10 | 11 | ## Double Bonus 12 | 13 | Allow users to edit entries. -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/02-make-car-function/app.js: -------------------------------------------------------------------------------- 1 | // Create a makeCar function 2 | // --- 3 | // Define a function: `makeCar()` that takes two parameters (model, color) and 4 | // makes a new object literal for a car using those params, and returns that object. 5 | 6 | var celica = makeCar("Toy-Yoda Celica", "limegreen"); 7 | console.log(celica); 8 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/templating-codealong/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Templatin! 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /04-27-closures-and-this/starter-code/make-a-person.js: -------------------------------------------------------------------------------- 1 | 2 | function makePerson(name, age) { 3 | 4 | var kids = []; 5 | 6 | // Return an object that has the following methods... 7 | 8 | // a method get return kids 9 | // a method to have a new kid 10 | // a method to get the person's name 11 | // a method to get the person's age 12 | // a method to celebrate the person's birthday 13 | 14 | } 15 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/04-open-weather-map/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/04-open-weather-map/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /04-27-closures-and-this/solution-code/closure-brain-teaser.js: -------------------------------------------------------------------------------- 1 | 2 | function queueCreator(waitList){ 3 | for (var i=0; i 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 |
16 |
17 |
18 |
19 |
20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/03-person-constructor-function/app.js: -------------------------------------------------------------------------------- 1 | function Person(initialName) { 2 | this.name = initialName; 3 | this.species = "Homo Sapiens"; 4 | this.speak = function() { 5 | return "Hello! I'm " + this.name; 6 | }; 7 | } 8 | 9 | var adam = new Person("Adam"); 10 | var bob = new Person("Bob"); 11 | 12 | console.log(adam.name) // "Adam" 13 | console.log(adam.speak()) // "Hello! I'm Adam" 14 | 15 | console.log(bob.name) // "Bob" 16 | console.log(bob.speak()) // "Hello! I'm Bob" 17 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/03-person-constructor-function/app.js: -------------------------------------------------------------------------------- 1 | function Person(initialName) { 2 | this.name = initialName; 3 | this.species = "Homo Sapiens"; 4 | this.speak = function() { 5 | return "Hello! I'm " + this.name; 6 | }; 7 | } 8 | 9 | var adam = new Person("Adam"); 10 | var bob = new Person("Bob"); 11 | 12 | console.log(adam.name) // "Adam" 13 | console.log(adam.speak()) // "Hello! I'm Adam" 14 | 15 | console.log(bob.name) // "Bob" 16 | console.log(bob.speak()) // "Hello! I'm Bob" 17 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/01-car-objects/app.js: -------------------------------------------------------------------------------- 1 | var celica = { 2 | model: 'Toy-Yoda Celica', 3 | color: 'limegreen', 4 | fuel: 100, 5 | drive: function() { 6 | this.fuel--; 7 | return 'Vroom!'; 8 | }, 9 | refuel: function() { 10 | this.fuel = 100; 11 | } 12 | } 13 | 14 | var civic = { 15 | model: 'Honda Civic', 16 | color: 'lemonchiffon', 17 | fuel: 100, 18 | drive: function() { 19 | this.fuel--; 20 | return 'Vroom!'; 21 | }, 22 | refuel: function() { 23 | this.fuel = 100; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/01-car-objects/app.js: -------------------------------------------------------------------------------- 1 | var celica = { 2 | model: 'Toy-Yoda Celica', 3 | color: 'limegreen', 4 | fuel: 100, 5 | drive: function() { 6 | this.fuel--; 7 | return 'Vroom!'; 8 | }, 9 | refuel: function() { 10 | this.fuel = 100; 11 | } 12 | } 13 | 14 | var civic = { 15 | model: 'Honda Civic', 16 | color: 'lemonchiffon', 17 | fuel: 100, 18 | drive: function() { 19 | this.fuel--; 20 | return 'Vroom!'; 21 | }, 22 | refuel: function() { 23 | this.fuel = 100; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /05-04-CRUD/solution-code/style.css: -------------------------------------------------------------------------------- 1 | body,html { 2 | width: 100%; 3 | height: 100%; 4 | } 5 | body { 6 | color: black; 7 | background: url(img/bey.jpg); 8 | background-size: 100% 100%; 9 | background-repeat: no-repeat; 10 | } 11 | 12 | .vote-count { 13 | position: relative; 14 | top: -.15em; 15 | } 16 | 17 | .panel-heading { 18 | color: black !important; 19 | } 20 | 21 | .nav { 22 | border-radius: 0; 23 | } 24 | 25 | .nav__title { 26 | color: white; 27 | margin: 1em; 28 | } 29 | 30 | .fa { 31 | cursor: pointer; 32 | padding-left: 3px; 33 | } 34 | -------------------------------------------------------------------------------- /05-04-CRUD/starter-code/style.css: -------------------------------------------------------------------------------- 1 | body,html { 2 | width: 100%; 3 | height: 100%; 4 | } 5 | body { 6 | color: black; 7 | background: url(img/bey.jpg); 8 | background-size: 100% 100%; 9 | background-repeat: no-repeat; 10 | } 11 | 12 | .vote-count { 13 | position: relative; 14 | top: -.15em; 15 | } 16 | 17 | .panel-heading { 18 | color: black !important; 19 | } 20 | 21 | .nav { 22 | border-radius: 0; 23 | } 24 | 25 | .nav__title { 26 | color: white; 27 | margin: 1em; 28 | } 29 | 30 | .fa { 31 | cursor: pointer; 32 | padding-left: 3px; 33 | } 34 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/07-oop-monkey-js/lib/monkey.js: -------------------------------------------------------------------------------- 1 | // don't forget to use module.exports to export your resulting Monkey constructor! 2 | 3 | var Monkey = function(name,species){ 4 | this.name = name; 5 | this.species = species; 6 | } 7 | Monkey.prototype.foodsEaten = []; 8 | Monkey.prototype.eat = function(food){ 9 | this.foodsEaten.push(food); 10 | } 11 | Monkey.prototype.introduce = function(){ 12 | return "Hello! My name is " + this.name + " and I am a " + this.species + ". I have eaten " + this.foodsEaten.join(", ") 13 | } 14 | module.exports = Monkey 15 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/pixart_js/style.css: -------------------------------------------------------------------------------- 1 | @import url(http://fonts.googleapis.com/css?family=Monoton); 2 | 3 | .brush { 4 | width: 100px; 5 | height: 100px; 6 | background: #1B4370; 7 | margin: 15px auto; 8 | } 9 | 10 | .square { 11 | float: left; 12 | width: 10px; 13 | height: 10px; 14 | background: #E7E5DB; 15 | margin: 0; 16 | } 17 | 18 | h1 { 19 | font-family: Monoton; 20 | font-size: 48px; 21 | text-align: center; 22 | } 23 | 24 | .controls { 25 | text-align: center; 26 | } 27 | 28 | body { 29 | background-image: url('ps_neutral.png'); 30 | } 31 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/pixart_js/style.css: -------------------------------------------------------------------------------- 1 | @import url(http://fonts.googleapis.com/css?family=Monoton); 2 | 3 | .brush { 4 | width: 100px; 5 | height: 100px; 6 | background: #1B4370; 7 | margin: 15px auto; 8 | } 9 | 10 | .square { 11 | float: left; 12 | width: 10px; 13 | height: 10px; 14 | background: #E7E5DB; 15 | margin: 0; 16 | } 17 | 18 | h1 { 19 | font-family: Monoton; 20 | font-size: 48px; 21 | text-align: center; 22 | } 23 | 24 | .controls { 25 | text-align: center; 26 | } 27 | 28 | body { 29 | background-image: url('ps_neutral.png'); 30 | } 31 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/04-open-weather-map/main.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | - Sign up for openweathermap.org and generate an API key. 4 | - User either $.ajax or $.get to pull weather current data . 5 | for Washington DC (hint: http://api.openweathermap.org/data/2.5/weather?q=...). 6 | - Print the temperature in console. 7 | - Bonus 1: add a form prompting user for the city and state. 8 | - Bonus 2: convert answer from kelvin to fahrenheit. 9 | 10 | */ 11 | 12 | 'use strict'; 13 | (function() { 14 | var weatherUrl = "http://api.openweathermap.org/data/2.5/weather?q="; 15 | var apiKey = ""; 16 | 17 | }); 18 | })(); 19 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/js/app.js: -------------------------------------------------------------------------------- 1 | var btcRate; 2 | var convertedBTC; 3 | $.getJSON('https://api.bitcoinaverage.com/ticker/USD/', function(data) { 4 | btcRate = data.last; 5 | }); 6 | 7 | document.getElementById('convert').onclick = convert; 8 | 9 | function convert(){ 10 | usdToConvert = document.getElementById('usd').value; 11 | //console.log(usdToConvert); 12 | btc = usdToBTC(usdToConvert); 13 | //console.log(btc); 14 | document.getElementById('btc').value = btc; 15 | 16 | } 17 | 18 | function usdToBTC(usd) { 19 | convertedBTC = usd / btcRate; 20 | return convertedBTC; 21 | } -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/06-car-constructor-function-with-prototypes/app.js: -------------------------------------------------------------------------------- 1 | // Update the constructor function for our car to define the methods on prototypes 2 | // rather than on the individual instances themselves. 3 | 4 | function Car(model, color){ 5 | this.model = model; 6 | this.color = color; 7 | } 8 | 9 | Car.prototype.fuel = 100; 10 | 11 | Car.prototype.drive = function(){ 12 | this.fuel--; 13 | return 'Vroom!'; 14 | } 15 | 16 | Car.prototype.refuel = function(){ 17 | this.fuel = 100; 18 | } 19 | 20 | var celica = new Car("Celica","lemonchiffon") 21 | celica.drive() 22 | console.log(celica) 23 | -------------------------------------------------------------------------------- /05-09-final-project/starter-code/readme.md: -------------------------------------------------------------------------------- 1 | # Project 4 Starter Code 2 | 3 | Here’s some starter code for you to use with your final projects. 4 | Add these files to your project folder and you’ve now got everything you need 5 | to get started, including a config file to input our class tokens (check Slack, 6 | everything’s pinned to the #general channel) 7 | 8 | While you’re testing locally, don’t forget to run `http-server` in the project folder to serve up these files. Here’s a link to our deployment tutorial 9 | 10 | for when you’re ready to take it online -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/events_codealong_and_exercise/main.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | var $thingList = $('#fav-list'); 3 | var $listItem = $('#fav-list li'); 4 | var $button = $('#new-thing-button'); 5 | $button.on('click', function(event) { 6 | event.preventDefault(); 7 | MyApp.addToList($thingList); 8 | }); 9 | }); 10 | 11 | var MyApp = {}; 12 | 13 | MyApp.addToList = function(list) { 14 | var $newLi = $('
  • '); 15 | var $newItemText = $('#new-thing'); 16 | $newLi.html($newItemText.val()); 17 | $newItemText.val(''); 18 | if ($newLi.html() !== '') { 19 | list.append($newLi); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/pixart_js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | i ♥ js 7 | 8 | 9 |

    Pixel Art!

    10 |
    11 |
    12 | 13 | 14 |
    15 |
    16 |
    17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/02-make-car-function/app.js: -------------------------------------------------------------------------------- 1 | // Create a makeCar function 2 | // --- 3 | // Define a function: `makeCar()` that takes two parameters (model, color) and 4 | // makes a new object literal for a car using those params, and returns that object. 5 | 6 | function makeCar(model, color){ 7 | return { 8 | model: model, 9 | color: color, 10 | fuel: 100, 11 | drive: function() { 12 | this.fuel--; 13 | return 'Vroom!'; 14 | }, 15 | refuel: function() { 16 | this.fuel = 100; 17 | } 18 | } 19 | } 20 | var celica = makeCar("Toy-Yoda Celica", "limegreen"); 21 | console.log(celica); 22 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/pixart_js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | i ♥ js 7 | 8 | 9 |

    Pixel Art!

    10 |
    11 |
    12 | 13 | 14 |
    15 |
    16 |
    17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /03-14-data-types/data-types-exercise.md: -------------------------------------------------------------------------------- 1 | ## Data Types 2 | 3 | What is the return value of each of the below code snippets? Come up with an answer before testing them out in the console. 4 | 5 | ```js 6 | typeof( 15 ); 7 | // Include your answer below each line using a comment, like this. 8 | 9 | typeof( 5.5 ); 10 | typeof( NaN ); 11 | typeof( "hello" ); 12 | typeof( true ) 13 | typeof( 1 != 2 ); 14 | 15 | "hamburger" + "s"; 16 | "hamburgers" - "s"; 17 | "1" + "3" 18 | "1" - "3" 19 | "johnny" + 5; 20 | "johnny" - 5 21 | 99 * "luftbaloons"; 22 | ``` 23 | 24 | What's going on in the second half of the previous question? Are there any "rules" we can pull from those examples? 25 | -------------------------------------------------------------------------------- /03-16-collections-and-loops/solution-code/verify-age.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var age = 25 4 | 5 | if (age < 16) { 6 | console.log('You can go to school!') 7 | } else if (age >= 16 && age < 18) { 8 | console.log('You can drive!') 9 | } else if (age >= 18 && age < 21) { 10 | console.log('You can vote!') 11 | } else if (age >= 21 && age < 25) { 12 | console.log('You can drink alcohol!') 13 | } else if (age >= 25 && age < 35) { 14 | console.log('You can rent a car!') 15 | } else if (age >= 35 && age < 62) { 16 | console.log('You can run for president!') 17 | } else if (age >= 62) { 18 | console.log('You can collect social security!') 19 | } else { 20 | console.log('Please enter a correct age value') 21 | } -------------------------------------------------------------------------------- /03-30-dom-and-jquery/starter-code/js_dom_exercise/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

    Hello World

    10 | 11 |

    Favorite Things

    12 |
      13 |
    • Dog bites
    • 14 |
    • Bee Stings
    • 15 |
    • Feeling Bad
    • 16 |
    17 | 18 |
    19 | 20 | 21 |
    22 | 23 | 24 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/solution-code/js_dom_exercise/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

    Hello World

    10 | 11 |

    Favorite Things

    12 |
      13 |
    • Dog bites
    • 14 |
    • Bee Stings
    • 15 |
    • Feeling Bad
    • 16 |
    17 | 18 |
    19 | 20 | 21 |
    22 | 23 | 24 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/solution-code/js_to_jquery_codealong/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

    Hello World

    10 | 11 |

    Favorite Things

    12 |
      13 |
    • Dog bites
    • 14 |
    • Bee Stings
    • 15 |
    • Feeling Bad
    • 16 |
    17 | 18 |
    19 | 20 | 21 |
    22 | 23 | 24 | -------------------------------------------------------------------------------- /04-06-review/starter-code/cash-register/obfuscated/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cash Register - CodePen 6 | 7 | 8 | 9 | 10 |
    11 |
    12 |

    Thank You!

    13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
    Total$0.00
    23 |
    24 |
    25 | 26 |
    27 |
    28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /04-27-closures-and-this/solution-code/make-a-person-module.js: -------------------------------------------------------------------------------- 1 | 2 | var johnny = (function(name, age) { 3 | 4 | var kids = []; 5 | 6 | return { 7 | getKids: function() { 8 | return kids; 9 | }, 10 | 11 | haveAKid: function(kidName) { 12 | kids.push(kidName); 13 | }, 14 | 15 | getName: function() { 16 | return name; 17 | }, 18 | 19 | getAge: function() { 20 | return age; 21 | }, 22 | 23 | celebrateBirthday: function() { 24 | age += 1; 25 | } 26 | }; 27 | })('johnny', 32); 28 | 29 | johnny.celebrateBirthday(); 30 | 31 | console.log(johnny.getAge()) // 33 32 | 33 | console.log(johnny.getKids()) // [] 34 | 35 | johnny.haveAKid('judah'); 36 | 37 | console.log(johnny.getKids()) // ['judah'] 38 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/solution-code/jquery_exercise/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | $(function() { 4 | var yourName = prompt('What is your name?'); 5 | 6 | $('#name').html(yourName); 7 | 8 | var $thingList = $('#fav-list'); 9 | 10 | var $button = $('#new-thing-button'); 11 | // button.onclick = function(event) { 12 | $button.on('click', function(event) { 13 | event.preventDefault(); 14 | MyApp.addToList($thingList); 15 | }); 16 | }); 17 | 18 | var MyApp = {}; 19 | 20 | MyApp.addToList = function(list) { 21 | var $newLi = $('
  • '); 22 | var $newItemText = $('#new-thing'); 23 | $newLi.html($newItemText.val()); 24 | $newItemText.val(''); 25 | if ($newLi.html() !== '') { 26 | list.append($newLi); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/02-movie-browser/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Movie Browser 5 | 6 | 7 | 8 | 9 |
    10 |

    Movie Browser

    11 | 12 | 16 | 17 | 20 | 21 |
    22 |
    23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/02-movie-browser/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Movie Browser 5 | 6 | 7 | 8 | 9 |
    10 |

    Movie Browser

    11 | 12 | 16 | 17 | 20 | 21 |
    22 |
    23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /04-27-closures-and-this/solution-code/make-a-person.js: -------------------------------------------------------------------------------- 1 | 2 | function makePerson(name, age) { 3 | 4 | var kids = []; 5 | 6 | return { 7 | getKids: function() { 8 | return kids; 9 | }, 10 | 11 | haveAKid: function(kidName) { 12 | kids.push(kidName); 13 | }, 14 | 15 | getName: function() { 16 | return name; 17 | }, 18 | 19 | getAge: function() { 20 | return age; 21 | }, 22 | 23 | celebrateBirthday: function() { 24 | age += 1; 25 | } 26 | }; 27 | } 28 | 29 | var johnny = makePerson('johnny', 32); 30 | 31 | johnny.celebrateBirthday(); 32 | 33 | console.log(johnny.getAge()) // 33 34 | 35 | console.log(johnny.getKids()) // [] 36 | 37 | johnny.haveAKid('judah'); 38 | 39 | console.log(johnny.getKids()) // ['judah'] 40 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/solution-code/js_to_jquery_codealong/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var $ = require('jquery'); 4 | 5 | $(function() { 6 | var yourName = prompt('What is your name?'); 7 | 8 | $('#name').html(yourName); 9 | 10 | var $thingList = $('#fav-list'); 11 | 12 | var $button = $('#new-thing-button'); 13 | // button.onclick = function(event) { 14 | $button.on('click', function(event) { 15 | event.preventDefault(); 16 | MyApp.addToList($thingList); 17 | }); 18 | }); 19 | 20 | var MyApp = {}; 21 | 22 | MyApp.addToList = function(list) { 23 | var $newLi = $('
  • '); 24 | var $newItemText = $('#new-thing'); 25 | $newLi.html($newItemText.val()); 26 | $newItemText.val(''); 27 | if ($newLi.html() !== '') { 28 | list.append($newLi); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /03-01-prework/readme.md: -------------------------------------------------------------------------------- 1 | # Before Class 2 | 3 | 1. Complete the [JS Pre-Work Prompt](./prework.pdf). You should all have received this already, but in any case, make sure you have gone through it before the first class. There are some extra tutorials and resources included, so be sure take a look! 4 | 5 | 2. Accept your Slack invitation. Slack is a group chat tool you'll be using to stay in touch with your instructors and classmates during JS. I've just sent you all email invites to our class specific team. Once you're signed into Slack, upload a profile picture and introduce yourself in the #general channel! 6 | 7 | 3. Fill out your [GA Student Profile](https://mobilega.typeform.com/to/DbXlOu?course_name=javascript-development&campus=washington-dc&start_date=3-7-2016&github=yes&location=us&core_id=19434) 8 | -------------------------------------------------------------------------------- /03-23-project-1/starter_code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "starter-code", 3 | "version": "0.0.0", 4 | "private": true, 5 | "author": "Jesse Shawl ", 6 | "description": "A simple helpful robot for your Company", 7 | "dependencies": { 8 | "hubot": "^2.18.0", 9 | "hubot-diagnostics": "0.0.1", 10 | "hubot-google-images": "^0.2.6", 11 | "hubot-google-translate": "^0.2.0", 12 | "hubot-help": "^0.1.3", 13 | "hubot-heroku-keepalive": "^1.0.2", 14 | "hubot-maps": "0.0.2", 15 | "hubot-pugme": "^0.1.0", 16 | "hubot-redis-brain": "0.0.3", 17 | "hubot-rules": "^0.1.1", 18 | "hubot-scripts": "^2.16.2", 19 | "hubot-shipit": "^0.2.0", 20 | "hubot-slack": "^3.4.2" 21 | }, 22 | "engines": { 23 | "node": "0.10.x" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /04-06-review/starter-code/cash-register/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cash Register - CodePen 6 | 7 | 8 | 9 | 10 |
    11 |
    12 |

    Thank You!

    13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
    Total$0.00
    23 |
    24 |
    25 | 26 |
    27 |
    28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/04-open-weather-map/main.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | - Sign up for openweathermap.org and generate an API key. 4 | - User either $.ajax or $.get to pull weather current data . 5 | for Washington DC (hint: http://api.openweathermap.org/data/2.5/weather?q=...). 6 | - Print the temperature in console. 7 | - Bonus 1: add a form prompting user for the city and state. 8 | - Bonus 2: convert answer from kelvin to fahrenheit. 9 | 10 | */ 11 | 12 | 'use strict'; 13 | (function() { 14 | var weatherUrl = "http://api.openweathermap.org/data/2.5/weather?q=Washington,DC"; 15 | var apiKey = "2490c4b3eae6bcf3343a6556a99ab9c2"; 16 | var url = weatherUrl + "&appid=" + apiKey 17 | $.getJSON(url, function(response){ 18 | console.log(response.main.temp) 19 | }) 20 | 21 | })(); 22 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/starter-code/js_dom_exercise/main.js: -------------------------------------------------------------------------------- 1 | /* DOM Manipulation: Independent Practice 2 | 3 | To complete this excercise, you must meet the following requirements: 4 | 5 | - Change the value of the element with the name id to be whatever the user inputs when page first loads. 6 | - When the user clicks the "#new-thing-button" button, add whatever is in the input box to the "#fav-list" list. 7 | - Clear the input box when the user clicks the button. 8 | - Bonus: only add item if the input box is not blank (hint: check innerHTML property) 9 | 10 | */ 11 | 12 | 13 | window.onload = function() { 14 | var your_name = prompt("What is your name?"); 15 | var button; 16 | var thing_list; 17 | 18 | }; 19 | 20 | var MyApp = { 21 | add_to_list: function(list) { 22 | 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /04-06-review/starter-code/cash-register/obfuscated/js/main.js: -------------------------------------------------------------------------------- 1 | eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 e=0.3("o");e.n("a",a);1 8=0.3(\'8\');m a(h){h.q();1 5=0.3(\'f\');5=6(5.l).i(2);1 7=0.b("p");1 k=0.b("j");1 9=0.b("j");9.d=5;7.c(k);7.c(9);8.c(7);0.3(\'f\').l=\'\';4=6(0.3(\'4\').d.r(/\\$|,/g,\'\'));4=4+6(5);0.3(\'4\').d="$"+6(4).i(2)}',28,28,'document|var||getElementById|total|val|parseFloat|row|entries|valCell|submit|createElement|appendChild|innerHTML|form|newEntry||event|toFixed|td|cell|value|function|addEventListener|entry|tr|preventDefault|replace'.split('|'),0,{})) 2 | 3 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/02-movie-browser/readme.md: -------------------------------------------------------------------------------- 1 | # Movie Browser 2 | 3 | Use the [Open Movie Database API](http://www.omdbapi.com/) to build a single-page movie browser app. 4 | 5 | ## Requirements 6 | 7 | 1. The `"#movie-select"` should be hidden by default. 8 | 9 | 2. When the user may submits a search for a movie keyword... 10 | - the `"#movie-select"` field should be un-hidden, 11 | - it should be populated with all search results, 12 | - and the first select option should read "Movies matching `keyword`…". 13 | 14 | 3. Whenever the user selects a title from the `#movie-select` field (HINT: listen for a `"change"` event), the app should populate the `"#movie-detail"` div with that movie's title and poster image. 15 | 16 | ## Take a look: 17 | 18 | http://ga-dc.github.io/movie-browser 19 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/02-movie-browser/readme.md: -------------------------------------------------------------------------------- 1 | # Movie Browser 2 | 3 | Use the [Open Movie Database API](http://www.omdbapi.com/) to build a single-page movie browser app. 4 | 5 | ## Requirements 6 | 7 | 1. The `"#movie-select"` should be hidden by default. 8 | 9 | 2. When the user may submits a search for a movie keyword... 10 | - the `"#movie-select"` field should be un-hidden, 11 | - it should be populated with all search results, 12 | - and the first select option should read "Movies matching `keyword`…". 13 | 14 | 3. Whenever the user selects a title from the `#movie-select` field (HINT: listen for a `"change"` event), the app should populate the `"#movie-detail"` div with that movie's title and poster image. 15 | 16 | ## Take a look: 17 | 18 | http://ga-dc.github.io/movie-browser 19 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/solution-code/jquery_exercise/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

    Hello World

    9 | 10 |

    Favorite Things

    11 |
      12 |
    • Dog bites
    • 13 |
    • Bee Stings
    • 14 |
    • Feeling Bad
    • 15 |
    16 | 17 |
    18 | 19 | 20 |
    21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/starter-code/jquery_exercise/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

    Hello World

    9 | 10 |

    Favorite Things

    11 |
      12 |
    • Dog bites
    • 13 |
    • Bee Stings
    • 14 |
    • Feeling Bad
    • 15 |
    16 | 17 |
    18 | 19 | 20 |
    21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/05-prototypes/app.js: -------------------------------------------------------------------------------- 1 | function Dog(name, breed) { 2 | this.name = name; 3 | this.breed = breed; 4 | } 5 | 6 | Dog.prototype.species = "Canis Canis"; 7 | Dog.prototype.bark = function() { return "Woof! I'm " + this.name; } 8 | 9 | // OR Alternate form: 10 | // The disadvantage here is that we're overwriting any existing properties on 11 | // the prototype 12 | Dog.prototype = { 13 | species: "Canis Canis", 14 | speak: function() { return "Woof! I'm " + this.name; } 15 | } 16 | 17 | // Our objects work just as they did before! 18 | var spot = new Dog("Spot", "Beagle"); 19 | var rufus = new Dog("Rufus", "Poodle"); 20 | 21 | spot.name // "Spot" 22 | spot.breed // "Beagle" 23 | spot.bark() // "Hello! I'm Spot" 24 | 25 | rufus.name // "Rufus" 26 | rufus.bark() // "Hello! I'm Rufus" 27 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/05-prototypes/app.js: -------------------------------------------------------------------------------- 1 | function Dog(name, breed) { 2 | this.name = name; 3 | this.breed = breed; 4 | } 5 | 6 | Dog.prototype.species = "Canis Canis"; 7 | Dog.prototype.bark = function() { return "Woof! I'm " + this.name; } 8 | 9 | // OR Alternate form: 10 | // The disadvantage here is that we're overwriting any existing properties on 11 | // the prototype 12 | Dog.prototype = { 13 | species: "Canis Canis", 14 | speak: function() { return "Woof! I'm " + this.name; } 15 | } 16 | 17 | // Our objects work just as they did before! 18 | var spot = new Dog("Spot", "Beagle"); 19 | var rufus = new Dog("Rufus", "Poodle"); 20 | 21 | spot.name // "Spot" 22 | spot.breed // "Beagle" 23 | spot.bark() // "Hello! I'm Spot" 24 | 25 | rufus.name // "Rufus" 26 | rufus.bark() // "Hello! I'm Rufus" 27 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/07-oop-monkey-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "oop_monkey", 3 | "version": "1.0.0", 4 | "description": "OOP Monkey Exercise", 5 | "main": "index.js", 6 | "dependencies": { 7 | "jasmine-expect": "^2.0.0-beta1", 8 | "jasmine-node": "^1.14.5" 9 | }, 10 | "devDependencies": {}, 11 | "scripts": { 12 | "test": "jasmine-node spec" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/ga-dc/oop_monkey.git" 17 | }, 18 | "keywords": [ 19 | "node", 20 | "npm", 21 | "monkey", 22 | "jasmine", 23 | "oop" 24 | ], 25 | "author": "Adam Bray", 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/ga-dc/oop_monkey/issues" 29 | }, 30 | "homepage": "https://github.com/ga-dc/oop_monkey#readme" 31 | } 32 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/events_codealong_and_exercise/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

    Hello World

    9 | 10 |

    Favorite Things

    11 |
      12 |
    • Dog bites
    • 13 |
    • Bee Stings
    • 14 |
    • Feeling Bad
    • 15 |
    16 | 17 |
    18 | 19 | 20 |
    21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /04-27-closures-and-this/solution-code/make-a-person-thisify.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | function makePerson(name, age) { 4 | 5 | return { 6 | 7 | kids: [], 8 | 9 | name: name, 10 | 11 | age: age, 12 | 13 | getKids: function() { 14 | return this.kids; 15 | }, 16 | 17 | haveAKid: function(kidName) { 18 | this.kids.push(kidName); 19 | }, 20 | 21 | getName: function() { 22 | return this.name; 23 | }, 24 | 25 | getAge: function() { 26 | return this.age; 27 | }, 28 | 29 | celebrateBirthday: function() { 30 | this.age += 1; 31 | } 32 | }; 33 | } 34 | 35 | var johnny = new makePerson('johnny', 32); 36 | 37 | johnny.celebrateBirthday(); 38 | 39 | console.log(johnny.getAge()) // 33 40 | 41 | console.log(johnny.getKids()) // [] 42 | 43 | johnny.haveAKid('judah'); 44 | 45 | console.log(johnny.getKids()) // ['judah'] 46 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/07-oop-monkey-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "oop_monkey", 3 | "version": "1.0.0", 4 | "description": "OOP Monkey Exercise", 5 | "main": "index.js", 6 | "dependencies": { 7 | "jasmine-expect": "^2.0.0-beta1", 8 | "jasmine-node": "^1.14.5" 9 | }, 10 | "devDependencies": {}, 11 | "scripts": { 12 | "test": "jasmine-node spec" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/ga-dc/oop_monkey.git" 17 | }, 18 | "keywords": [ 19 | "node", 20 | "npm", 21 | "monkey", 22 | "jasmine", 23 | "oop" 24 | ], 25 | "author": "Adam Bray", 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/ga-dc/oop_monkey/issues" 29 | }, 30 | "homepage": "https://github.com/ga-dc/oop_monkey#readme" 31 | } 32 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/events_codealong_and_exercise/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

    Hello World

    9 | 10 |

    Favorite Things

    11 |
      12 |
    • Dog bites
    • 13 |
    • Bee Stings
    • 14 |
    • Feeling Bad
    • 15 |
    16 | 17 |
    18 | 19 | 20 |
    21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/01-jquery-ajax/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 30 | 31 | 32 | 33 |
    34 |
    35 | 36 |
    37 |
    38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/07-oop-monkey-js/readme.md: -------------------------------------------------------------------------------- 1 | # Monkies!! 2 | 3 | Create a `Monkey` constructor in `lib/monkey.js`, which has the following attributes: 4 | * name - (a string) 5 | * species - (a string) 6 | * foodsEaten - (an array) 7 | 8 | And the following methods: 9 | * eat(food) - adds the food (a string) to the list of foods eaten 10 | * introduce() - introduces self, with name, species, and what it's eaten. 11 | 12 | ## Setup 13 | 14 | Install dependencies: 15 | ```bash 16 | $ npm install -g jasmine-node 17 | $ npm install 18 | ``` 19 | 20 | ## Goal 21 | 22 | Run tests using `jasmine-node spec`. Write code in your Monkey constructor to make the tests pass. 23 | 24 | Make sure to use the Monkey prototype so that you're not creating multiple copies of the functions for your monkies! 25 | 26 | ## Bonus 27 | 28 | Uncomment the bonus tests in `spec/monkey_spec` and make them pass. 29 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/07-oop-monkey-js/readme.md: -------------------------------------------------------------------------------- 1 | # Monkies!! 2 | 3 | Create a `Monkey` constructor in `lib/monkey.js`, which has the following attributes: 4 | * name - (a string) 5 | * species - (a string) 6 | * foodsEaten - (an array) 7 | 8 | And the following methods: 9 | * eat(food) - adds the food (a string) to the list of foods eaten 10 | * introduce() - introduces self, with name, species, and what it's eaten. 11 | 12 | ## Setup 13 | 14 | Install dependencies: 15 | ```bash 16 | $ npm install -g jasmine-node 17 | $ npm install 18 | ``` 19 | 20 | ## Goal 21 | 22 | Run tests using `jasmine-node spec`. Write code in your Monkey constructor to make the tests pass. 23 | 24 | Make sure to use the Monkey prototype so that you're not creating multiple copies of the functions for your monkies! 25 | 26 | ## Bonus 27 | 28 | Uncomment the bonus tests in `spec/monkey_spec` and make them pass. 29 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/templating_codealong/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

    Hello World

    9 | 10 |

    Favorite Things

    11 |
      12 |
    13 | 14 |
    15 | 16 | 17 |
    18 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/js/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Creating a page where every time the user hits the "Roll Dice" button, the screen randomly updates the two dice. Use the html and css code included in the starter code folder to get started. 4 | 5 | 1) Write down pseudocode for the following program. 6 | 7 | 2) Follow the steps below to write your code. 8 | * generate a random number between 1 - 6 and store to a variable, random1 9 | * generate a random number between 1 - 6 and store to a variable, random2 10 | * combine 'dice-' and random1 to form the random class for the first die, firstDie 11 | * combine 'dice-' and random1 to form the random class for the second die, secondDie 12 | * get the first die by ID and update the class to firstDie (hint: document.getElementById) 13 | * get the first die by ID and update the class to secondDie (hint:document.getElementById) 14 | 15 | 3) Check to see if the Dice Roll has been hit, if it has run the diceRoll function. 16 | 17 | */ 18 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/solution-code/js_dom_exercise/main.js: -------------------------------------------------------------------------------- 1 | window.onload = function() { 2 | var your_name = prompt("What is your name?"), 3 | button, 4 | thing_list; 5 | 6 | document.getElementById('name').innerHTML = your_name; 7 | 8 | thing_list = document.getElementById('fav-list'); 9 | 10 | button = document.getElementById('new-thing-button'); 11 | button.onclick = function(event) { 12 | event.preventDefault(); 13 | MyApp.add_to_list(thing_list); 14 | return false; 15 | }; 16 | }; 17 | 18 | // We can define things outside of the window.onload which are evaluated 19 | // only when called. 20 | MyApp = {}; 21 | 22 | MyApp.add_to_list = function(list) { 23 | var new_li = document.createElement('li'), 24 | new_item_text = document.getElementById('new-thing'); 25 | new_li.innerHTML = new_item_text.value; 26 | new_item_text.value = ""; 27 | if (new_li.innerHTML !== "") { 28 | list.appendChild(new_li); 29 | } 30 | return true; 31 | } 32 | -------------------------------------------------------------------------------- /04-06-review/starter-code/atm/atm.css: -------------------------------------------------------------------------------- 1 | @import url(http://fonts.googleapis.com/css?family=Oleo+Script); 2 | @import url(http://fonts.googleapis.com/css?family=Ruluko); 3 | 4 | body { 5 | font-family: 'Ruluko', sans-serif; 6 | margin: 0px auto; 7 | text-align: center; 8 | width: 700px; 9 | } 10 | 11 | .header { 12 | margin: 50px 0px; 13 | } 14 | 15 | .title { 16 | color: #F52F4F; 17 | font-family: 'Oleo Script', cursive; 18 | font-size: 50px; 19 | } 20 | 21 | .account { 22 | background-color: #6C9A74; 23 | border: 1px solid #295A33; 24 | border-radius: 15px; 25 | display: inline-block; 26 | margin: 10px; 27 | padding: 10px; 28 | width: 300px; 29 | } 30 | 31 | .balance { 32 | background-color: #E3E3E3; 33 | border: 1px solid #676767; 34 | border-radius: 15px; 35 | font-family: 'Ruluko', sans-serif; 36 | font-size: 50px; 37 | margin: 5px; 38 | padding: 25px 0px; 39 | } 40 | 41 | .zero { 42 | background-color: #F52F4F; 43 | color: #FFFFFF; 44 | } 45 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Currency Converter 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |

    Currency Converter

    22 | 23 |
    24 | 25 | 26 |
    27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/currency-converter/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Currency Converter 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |

    Currency Converter

    22 | 23 |
    24 | 25 | 26 |
    27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /04-06-review/readme.md: -------------------------------------------------------------------------------- 1 | # ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) Review (3:00) 2 | 3 | ## We've come a looooonnggg way 4 | 5 | ### Do you sometimes feel like this? 6 | 7 | ![frustrated](https://media.giphy.com/media/oirLISmToyoeI/giphy.gif) 8 | 9 | ### JavaScript kicking your butt? 10 | 11 | ![frustrated](https://media4.giphy.com/media/P3x1oqza891SM/200.gif) 12 | 13 | ### You've tried everything 14 | 15 | ![frustrated](https://media0.giphy.com/media/NHIecaiSc7YjK/200.gif) 16 | 17 | ### But you still feel like this 18 | 19 | ![frustrated](https://media4.giphy.com/media/29bKyyjDKX1W8/200.gif) 20 | 21 | ### Then you're all like "screw javascript, I'm going back to ruby, ugh" 22 | 23 | ![frustrated](https://media3.giphy.com/media/2FazfWOd7WPJuYqHe/200.gif) 24 | 25 | ### Everyone goes through this! It's an indication that growth is happening! 26 | 27 | ![frustrated](https://media4.giphy.com/media/ToMjGpKniGqRNLGBrhu/200.gif) 28 | 29 | 30 | ## Variables 31 | 32 | ```javascript 33 | var foo = 'bar'; 34 | var beep = 1; 35 | ``` 36 | 37 | ## -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/02-movie-browser/js/movie_browser.js: -------------------------------------------------------------------------------- 1 | // API Docs at: 2 | // http://www.omdbapi.com 3 | 4 | var $dropdown = $("#movie-select"); 5 | var $form = $("#search") 6 | var $input = $("#movie-search") 7 | var $detail = $("#movie-detail") 8 | 9 | $dropdown.hide() 10 | $form.on("submit", function(e){ 11 | e.preventDefault() 12 | var url = "http://www.omdbapi.com/?s=" + $input.val() 13 | $.get(url, function(response){ 14 | console.log(response) 15 | buildDropdown(response.Search) 16 | }) 17 | }) 18 | 19 | $dropdown.on("change", function(e){ 20 | var $selected = $(this).find(":selected"); 21 | var id = $selected.attr("id") 22 | var url = "http://www.omdbapi.com/?i=" + id 23 | $.get(url, function(response){ 24 | $detail.html("

    "+response.Title+"

    ") 25 | $detail.append("") 26 | }) 27 | }) 28 | 29 | function buildDropdown(movies){ 30 | movies.forEach(function(movie){ 31 | var $option = $("") 32 | $dropdown.append($option) 33 | }) 34 | $dropdown.show(); 35 | } -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/03-posts_requests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

    Do It

    9 | 10 |

    Todo List

    11 |
      12 | 13 |
      14 | 15 | 16 |
      17 | 18 | 19 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/03-posts_requests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

      Do It

      9 | 10 |

      Todo List

      11 |
        12 | 13 |
        14 | 15 | 16 |
        17 | 18 | 19 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /04-06-review/starter-code/atm/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ATM 5 | 6 | 7 | 8 | 9 | 10 |
        11 |
        12 |
        Bank of GA
        13 |
        14 | 15 | 22 | 23 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /04-18-advanced-apis/solution-code/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Advanced APIs Lesson 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 25 | 26 |
        27 |

        Here are the images in your neighborhood:

        28 |
        29 |
        30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /04-18-advanced-apis/starter-code/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Advanced APIs Lesson 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 25 | 26 |
        27 |

        Here are the images in your neighborhood:

        28 |
        29 |
        30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/08-prototypal-inheritance/app.js: -------------------------------------------------------------------------------- 1 | //////////////////////////////// 2 | // Animal (Parent) Class 3 | //////////////////////////////// 4 | function Animal( name ){ 5 | this.name = name; 6 | } 7 | 8 | Animal.prototype.kingdom = "Animalia"; 9 | Animal.prototype.breathe = function() {console.log("Inhale... exhale...")}; 10 | 11 | 12 | //////////////////////////////// 13 | // HELLO THIS IS DOG 14 | //////////////////////////////// 15 | function Dog(name, breed){ 16 | this.name = name; 17 | this.breed = breed; 18 | } 19 | 20 | // Important! Set up the link in the prototype chain connecting Dogs to Animals 21 | Dog.prototype = new Animal(); 22 | 23 | // Add any methods / properties shared by all dogs. 24 | Dog.prototype.bark = function(){ console.log("Woof")}; 25 | Dog.prototype.species = "Canis canis" 26 | 27 | //////////////////////////////// 28 | // Testing our dawgs 29 | //////////////////////////////// 30 | var spot = new Dog("Spot", "Beagle"); 31 | 32 | // from Animal prototype 33 | spot.kingdom; 34 | spot.breathe(); 35 | 36 | // from Dog prototype 37 | spot.bark(); 38 | spot.species; 39 | 40 | // from Dog properties 41 | spot.name; 42 | spot.breed; 43 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/08-prototypal-inheritance/app.js: -------------------------------------------------------------------------------- 1 | //////////////////////////////// 2 | // Animal (Parent) Class 3 | //////////////////////////////// 4 | function Animal( name ){ 5 | this.name = name; 6 | } 7 | 8 | Animal.prototype.kingdom = "Animalia"; 9 | Animal.prototype.breathe = function() {console.log("Inhale... exhale...")}; 10 | 11 | 12 | //////////////////////////////// 13 | // HELLO THIS IS DOG 14 | //////////////////////////////// 15 | function Dog(name, breed){ 16 | this.name = name; 17 | this.breed = breed; 18 | } 19 | 20 | // Important! Set up the link in the prototype chain connecting Dogs to Animals 21 | Dog.prototype = new Animal(); 22 | 23 | // Add any methods / properties shared by all dogs. 24 | Dog.prototype.bark = function(){ console.log("Woof")}; 25 | Dog.prototype.species = "Canis canis" 26 | 27 | //////////////////////////////// 28 | // Testing our dawgs 29 | //////////////////////////////// 30 | var spot = new Dog("Spot", "Beagle"); 31 | 32 | // from Animal prototype 33 | spot.kingdom; 34 | spot.breathe(); 35 | 36 | // from Dog prototype 37 | spot.bark(); 38 | spot.species; 39 | 40 | // from Dog properties 41 | spot.name; 42 | spot.breed; 43 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/pixart_js/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 GA_DC Campus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/pixart_js/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 GA_DC Campus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /04-13-async-js-and-callbacks/solution-code/functions-callbacks-exercise/main.js: -------------------------------------------------------------------------------- 1 | 2 | // This function takes one parameter - predicate. 3 | // Predicate should be a function 4 | function countWhereTrue (predicate) { 5 | return function(items) { 6 | var count = 0; 7 | for (var i = 0; i < items.length; i++) { 8 | if (predicate(items[i])) { 9 | count++; 10 | } 11 | } 12 | return count; 13 | }; 14 | } 15 | 16 | // This function should return true or false depending on if the number 17 | // passed to it is odd or not 18 | function isOdd(number) { 19 | return number % 2 !== 0; 20 | } 21 | 22 | /* Once you've filled in the two function definitions above, the line below should package up 'makeCountWhereTrue()' and 'isOdd()' into a single function that accepts an array of items as a parameter, loops through it and returns a count of how many of those items are odd numbers. This new function is being assigned to the variable 'countTheOdds'. */ 23 | var countTheOdds = countWhereTrue(isOdd); 24 | 25 | /* The final line below calls our new 'countTheOdds()' function and passes in an array of numbers. Once your code is working, the line below should return the number 4. */ 26 | 27 | console.log(countTheOdds([1, 2, 3, 4, 5, 6, 7])); 28 | -------------------------------------------------------------------------------- /04-13-async-js-and-callbacks/starter-code/functions-callbacks-exercise/main.js: -------------------------------------------------------------------------------- 1 | 2 | function countWhereTrue (predicate) { 3 | // return a function that takes one parameter (an array) 4 | // Initialize a counter 5 | // For every item in the array 6 | // pass the item to the given predicate function 7 | // if the result of the prediciate function is true 8 | // increment the counter by 1 9 | // return the count 10 | } 11 | 12 | // This function should return true or false depending on if the number 13 | // passed to it is odd or not 14 | function isOdd(number) { 15 | 16 | } 17 | 18 | // Once you've filled in the two function definitions above, the line below 19 | // should package up 'countWhereTrue()' and 'isOdd()' into a single function that 20 | // accepts an array of items as a parameter, loops through it and returns a count 21 | // of how many of those items are odd numbers. 22 | // This new function is being assigned to the variable 'countTheOdds'. 23 | var countTheOdds = countWhereTrue(isOdd); 24 | 25 | // The final line below calls our new 'countTheOdds()' function and passes in an 26 | // array of numbers. Once your code is working, the line below should return 27 | // the number 4 28 | console.log( countTheOdds([1, 2, 3, 4, 5, 6, 7]) ); 29 | -------------------------------------------------------------------------------- /04-06-review/starter-code/cash-register/css/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #EEE; 3 | font-family: sans-serif; 4 | font-size: 20px; 5 | margin: 3em; 6 | padding: 0; 7 | } 8 | 9 | #register { 10 | width: 20em; 11 | margin: auto; 12 | } 13 | 14 | #ticket { 15 | background: white; 16 | margin: 0 1em; 17 | padding: 1em; 18 | box-shadow: 0 0 5px rgba(0,0,0,.25); 19 | } 20 | #ticket h1 { 21 | text-align: center; 22 | } 23 | #ticket table { 24 | font-family: monospace; 25 | width: 100%; 26 | border-collapse: collapse; 27 | } 28 | #ticket td, #ticket th { 29 | padding: 5px; 30 | } 31 | #ticket th { 32 | text-align: left; 33 | } 34 | #ticket td, #ticket #total { 35 | text-align: right; 36 | } 37 | #ticket tfoot th { 38 | border-top: 1px solid black; 39 | } 40 | 41 | #entry { 42 | background: #333; 43 | padding: 12px; 44 | border-radius: 10px; 45 | box-shadow: 0 0 5px rgba(0,0,0,.25); 46 | } 47 | #entry input { 48 | width: 100%; 49 | padding: 10px; 50 | border: 1px solid black; 51 | text-align: right; 52 | font-family: sans-serif; 53 | font-size: 20px; 54 | box-shadow: inset 0 0 3px rgba(0,0,0,.5); 55 | -webkit-box-sizing: border-box; 56 | -moz-box-sizing: border-box; 57 | box-sizing: border-box; 58 | } 59 | #entry input:focus { 60 | outline: none; 61 | border-color: rgba(255,255,255,.75); 62 | } -------------------------------------------------------------------------------- /04-06-review/starter-code/cash-register/obfuscated/css/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #EEE; 3 | font-family: sans-serif; 4 | font-size: 20px; 5 | margin: 3em; 6 | padding: 0; 7 | } 8 | 9 | #register { 10 | width: 20em; 11 | margin: auto; 12 | } 13 | 14 | #ticket { 15 | background: white; 16 | margin: 0 1em; 17 | padding: 1em; 18 | box-shadow: 0 0 5px rgba(0,0,0,.25); 19 | } 20 | #ticket h1 { 21 | text-align: center; 22 | } 23 | #ticket table { 24 | font-family: monospace; 25 | width: 100%; 26 | border-collapse: collapse; 27 | } 28 | #ticket td, #ticket th { 29 | padding: 5px; 30 | } 31 | #ticket th { 32 | text-align: left; 33 | } 34 | #ticket td, #ticket #total { 35 | text-align: right; 36 | } 37 | #ticket tfoot th { 38 | border-top: 1px solid black; 39 | } 40 | 41 | #entry { 42 | background: #333; 43 | padding: 12px; 44 | border-radius: 10px; 45 | box-shadow: 0 0 5px rgba(0,0,0,.25); 46 | } 47 | #entry input { 48 | width: 100%; 49 | padding: 10px; 50 | border: 1px solid black; 51 | text-align: right; 52 | font-family: sans-serif; 53 | font-size: 20px; 54 | box-shadow: inset 0 0 3px rgba(0,0,0,.5); 55 | -webkit-box-sizing: border-box; 56 | -moz-box-sizing: border-box; 57 | box-sizing: border-box; 58 | } 59 | #entry input:focus { 60 | outline: none; 61 | border-color: rgba(255,255,255,.75); 62 | } -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/pixart_js/pixart.js: -------------------------------------------------------------------------------- 1 | // Step 1 2 | //When I click the "Set Color" button, it should change the color of the "brush" box to the color I specify in the input field. (Hint: You will need to use event.preventDefault() somewhere in your code.) 3 | 4 | // Step 2 5 | //The same thing should happen when I press the enter key from inside the input field 6 | 7 | // Step 3 8 | //Create 20 divs of the "square" class and append them to the body 9 | //Hint: use .append() 10 | 11 | // Step 4 12 | //Add functionality so that when I click on each "square", it changes the color of that individual square to "green" 13 | //Hint: either add the event listener while creating the squares, or listen for events on the body element 14 | 15 | // Step 5 16 | //Modify your code so that when I click on each "square", it changes to the color I set using my input instead of "green" every time. 17 | 18 | // Step 6 19 | //Modify the CSS so that the "square" class has a height and width of 10px and a margin of 0. 20 | //Modify your code so that you are creating 8000 divs instead of 20. 21 | //Change the event that changes your box colors from 'click' to 'mouseover' 22 | //Paint a picture! 23 | 24 | // Bonus 25 | //Add a color swatch. You should have 3 boxes with the most recent 3 colors used. When you click on each of those boxes, it should set the current brush color back to that color. 26 | -------------------------------------------------------------------------------- /03-23-project-1/starter_code/scripts/slackbot.js: -------------------------------------------------------------------------------- 1 | // Description: 2 | // 3 | // 4 | // Dependencies: 5 | // None 6 | // 7 | // Configuration: 8 | // None 9 | // 10 | // Commands: 11 | // 12 | 13 | module.exports = function(robot) { 14 | // YOUR CODE HERE 15 | // Example 16 | robot.hear(/javascript/i, function(msg) { 17 | return msg.send("I love JavaScript!"); 18 | }); 19 | } 20 | 21 | /************************************ 22 | 23 | EXAMPLES OF THE KEY HUBOT FUNCTIONS 24 | 25 | ************************************/ 26 | 27 | /* Variables for random example */ 28 | 29 | var squirrels; 30 | squirrels = ["http://img.skitch.com/20100714-d6q52xajfh4cimxr3888yb77ru.jpg", "https://img.skitch.com/20111026-r2wsngtu4jftwxmsytdke6arwd.png", "http://cl.ly/1i0s1r3t2s2G3P1N3t3M/Screen_Shot_2011-10-27_at_9.36.45_AM.png", "http://shipitsquirrel.github.com/images/squirrel.png"]; 31 | 32 | module.exports = function(robot) { 33 | /* Basic example of respond / send. If the user enters hi or hello the bot responds "Howdy!" */ 34 | return robot.respond(/hi|hello/i, function(msg) { 35 | return msg.send("Howdy!"); 36 | }); 37 | 38 | /* Random Example 39 | If a user enters 'ship it' we return a random squirrel, which is popular for symbolizing shipping something with engineers */ 40 | return robot.hear(/ship it/i, function(msg) { 41 | return msg.send(msg.random(squirrels)); 42 | }); 43 | }; 44 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Dice Roller 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
        23 |
        24 |

        Dice Roller

        25 |
        26 |
        27 | 28 | 29 | 30 |
        31 |
        32 | 33 | 34 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/dice/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Dice Roller 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
        23 |
        24 |

        Dice Roller

        25 |
        26 |
        27 | 28 | 29 | 30 |
        31 |
        32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /05-09-final-project/starter-code/config.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 |

        Configure your APP_ID, APP_KEY and APP_HOST right here!

        9 |
        10 | 11 | 12 | 13 | 14 |
        15 |
        16 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /03-30-dom-and-jquery/starter-code/jquery_exercise/main.js: -------------------------------------------------------------------------------- 1 | /*Create a Checklist: Independent Practice 2 | 3 | You'll add the ability to complete tasks in your favorite things list. Your program must complete the following rules: 4 | 5 | - Through jQuery, add a "complete task" link at the end of each to-do item (i.e. each "favorite thing"). 6 | - When clicked, the link will cross out the current item (hint: add a class to the list that sets the text-decoration to strikeout). 7 | - Each new item added by the user needs to also have the "complete task" link at the end. 8 | - Bonus: when user completes an item, remove that item from the current list and add it to a completed list below. Do not show this list unless the there are completed items. 9 | - Bonus 2: add the ability to restore items from the completed list to the first list. 10 | 11 | */ 12 | 13 | 'use strict'; 14 | 15 | $(function() { 16 | var yourName = prompt('What is your name?'); 17 | 18 | $('#name').html(yourName); 19 | 20 | var $thingList = $('#fav-list'); 21 | 22 | var $button = $('#new-thing-button'); 23 | // button.onclick = function(event) { 24 | $button.on('click', function(event) { 25 | event.preventDefault(); 26 | MyApp.addToList($thingList); 27 | }); 28 | }); 29 | 30 | var MyApp = {}; 31 | 32 | MyApp.addToList = function(list) { 33 | var $newLi = $('
      • '); 34 | var $newItemText = $('#new-thing'); 35 | $newLi.html($newItemText.val()); 36 | $newItemText.val(''); 37 | if ($newLi.html() !== '') { 38 | list.append($newLi); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /03-16-collections-and-loops/starter-code/fizzbuzz.js: -------------------------------------------------------------------------------- 1 | /** 2 | * FizzBuzz Excercise 3 | 4 | Relying on newfound knowledge of loops, combine loops and if/else statements together and incrementally build the common fizzbuzz loop. 5 | 6 | - In the loop every time a number is divisible by **3**, instead of logging the number itself, the word "fizz" should appear. 7 | - If the number is divisible by **5**, the word "buzz" should be logged. 8 | - If the number is divisible by both **3** and **5**, then the word "fizzbuzz" should be logged. 9 | 10 | Follow the steps below. 11 | 12 | ##### Step 1: 13 | Construct a for loop that iterates through, and `console.log()`'s out, numbers 1 - 100. 14 | 15 | 16 | 17 | ##### Step 2: 18 | Add an `if/else` statement that logs the string `"fizz"` if the value being iterated over is divisible by `3`; otherwise, log out the value. 19 | 20 | 21 | 22 | ##### Step 3: 23 | Add an `else if` clause that logs the string `"buzz"` if the value being iterated over is divisible by `5`. 24 | 25 | 26 | 27 | ##### Step 4: 28 | Add an additional `else if` clause that logs the string `"fizzbuzz"` if the value being iterated over is divisible by both `3` and `5`. __Note:__ this step is intentionally broken! Place the new `else if` __below__ the evaluations for `fizz` and `buzz`; after running the code, and experiencing the undesired results, prompt the students as to why the `fizzbuzz` evaluation never occurred. 29 | 30 | 31 | ##### Step 5: 32 | Fix the above code to evaluate the `fizzbuzz` condition: 33 | 34 | 35 | */ 36 | -------------------------------------------------------------------------------- /05-04-CRUD/solution-code/config.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 |

        Configure your APP_ID, APP_KEY and APP_HOST right here!

        9 |
        10 | 11 | 12 | 13 | 14 |
        15 |
        16 | 17 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /05-04-CRUD/starter-code/config.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 |

        Configure your APP_ID, APP_KEY and APP_HOST right here!

        9 |
        10 | 11 | 12 | 13 | 14 |
        15 |
        16 | 17 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # ![](assets/logo.png) JavaScript Development 2 | 3 | ## People 4 | 5 | - Producer 6 | - Tim Foley 7 | - [tim.foley@ga.co](tim.foley@ga.co) 8 | - 202-748-3694 9 | - Instructors 10 | - Johnny Austin 11 | - [johnny@isl.co](johnny@isl.co) 12 | - Office hours: 13 | - Thursdays 6:00pm -8:00pm [ISL Office](https://isl.co/contact/) 14 | - Jesse Shawl 15 | - [jesse@ga.co](jesse@ga.co) 16 | - office hours: 17 | - Sundays 10:00am - 12:00pm @ GA 18 | - TA 19 | - John Master 20 | - [john.master@generalassemb.ly](john.master@generalassemb.ly) 21 | - Office hours: 22 | - Monday 5:30 - 6:30 (General Assembly) 23 | - Wednesday 5:30 - 6:30 (General Assembly) 24 | 25 | ## Course information 26 | 27 | Class will meet on the 8th floor in classroom 3 from 6:30 - 9:30pm - https://goo.gl/maps/PwyY2 28 | 29 | To get up to the 8th floor, show the attached Class Pass at the Security Desk downstairs. You will need to show this on your phone or printed out every time. 30 | Once you're upstairs, tell the folks at the front desk you're here for your first day of Javascript and they'll point you to your classroom. 31 | 32 | ### What to Bring 33 | 34 | A. Your laptop (and charger with your name on it!) 35 | 36 | B. Snacks in case you get hungry 37 | 38 | C. [Class Pass](./assets/class-pass.png) printed out or on your phone 39 | 40 | ## Schedule 41 | 42 | [Google Calendar](https://calendar.google.com/calendar/embed?src=generalassemb.ly_2bpe0sg92jg3otj03epjk03foc%40group.calendar.google.com&ctz=America/New_York) 43 | -------------------------------------------------------------------------------- /03-14-data-types/lab.md: -------------------------------------------------------------------------------- 1 | ## Data Collections 2 | 3 | ### Arrays 4 | 5 | Javascript provides us with a number of native methods that allow us to interact with arrays. Find methods that do each of the following and provide an example... 6 | * Add an element to the back of an array. 7 | * Remove an element from the back of an array. 8 | * Add an element to the front of an array. 9 | * Remove an element from the front of an array. 10 | * Concatenates all the elements in an array into a string. 11 | * Separates the characters of a string into an array. 12 | 13 | ```js 14 | // Your answers go here. 15 | ``` 16 | 17 | What will the contents of the below arrays be after the code samples are executed? Come up with an answer yourself before testing it out in the console. 18 | > **HINT:** You might find it helpful to draw the arrays out as you run each line of code. 19 | 20 | ```js 21 | var numbers = [ 2, 4, 6, 8 ]; 22 | numbers.pop(); 23 | numbers.push( 10 ); 24 | numbers.unshift( 3 ); 25 | ``` 26 | 27 | ``` 28 | Your answer goes here. 29 | ``` 30 | 31 | What is the return value of the below code sample? Come up with an answer yourself before testing it out in the console. 32 | 33 | ```js 34 | var morse = [ "dot", "pause", "dot" ]; 35 | var moreMorse = morse.join( " dash " ); 36 | moreMorse.split( " " ); 37 | ``` 38 | 39 | ``` 40 | Your answer goes here. 41 | ``` 42 | 43 | What will the contents of the below array be after the below code sample is executed? Come up with an answer yourself before testing it out in the console. 44 | 45 | ```js 46 | var bands = []; 47 | var beatles = [ "Paul", "John", "George", "Pete" ]; 48 | var stones = [ "Brian", "Mick", "Keith", "Ronnie", "Charlie" ]; 49 | bands.push( beatles ); 50 | bands.unshift( stones ); 51 | bands[ bands.length - 1 ].pop(); 52 | bands[0].shift(); 53 | bands[1][3] = "Ringo"; 54 | ``` 55 | 56 | ``` 57 | Your answer goes here. 58 | ``` 59 | -------------------------------------------------------------------------------- /04-18-advanced-apis/solution-code/app.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | // get access token from hash/fragment 4 | var uriHash = window.location.hash; 5 | 6 | if (uriHash.length > 0) { 7 | var accessToken = uriHash.replace('#access_token=', ''); 8 | getImages(accessToken); 9 | } else { 10 | // if not yet redirected hide results view 11 | $('.image-results-view').hide(); 12 | } 13 | 14 | function getImages(accessToken) { 15 | // if redirected hide initial view 16 | $('.sign-in-view').hide(); 17 | 18 | // use the navigator given to us by the window.navigator object to find the user's location 19 | getCurrentLocation(function(position) { 20 | var lat = position.coords.latitude; 21 | var lng = position.coords.longitude; 22 | 23 | // configure instagram endpoint with accessToken and user's location data 24 | var instagramEndpoint = 'https://api.instagram.com/v1/media/search?lat=' + lat + '&lng=' + lng + '&access_token=' + accessToken 25 | 26 | // call the instagram with configured URI 27 | $.ajax({ 28 | url: instagramEndpoint, 29 | method: 'GET', 30 | dataType: 'jsonp', 31 | success: handleResponseSuccess 32 | }); 33 | }); 34 | 35 | } 36 | 37 | function handleResponseSuccess(response) { 38 | var allData = response.data; 39 | 40 | // iterate through each piece of data 41 | allData.forEach(function(data) { 42 | var imageUrl = 'url(' + data.images.standard_resolution.url + ')'; 43 | 44 | // create element 45 | var element = $('
        ').css({'background-image': imageUrl}).addClass('image'); 46 | 47 | // append element to .images node 48 | $('.images').append(element); 49 | }); 50 | } 51 | 52 | function getCurrentLocation(onLocation) { 53 | if (navigator.geolocation) { 54 | navigator.geolocation.getCurrentPosition(onLocation); 55 | } else { 56 | console.error("Geolocation is not supported by this browser."); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /04-06-review/starter-code/atm/readme.md: -------------------------------------------------------------------------------- 1 | #ATM application 2 | 3 | We 're going to build an application to keep track of the checking and savings balances. 4 | 5 | There is also a vanilla Javascript solution branch that was coded in class. 6 | 7 | ## USE jQUERY 8 | 9 | ###User Stories 10 | - As a user, I want to deposit money into one of the bank accounts 11 | - As a user, I want to withdraw money from one of the bank accounts 12 | - Make sure the balance in an account can't go negative. If a user tries to withdraw more money than exists in the account, ignore the transaction. 13 | - As a user, I want overdraft protection 14 | - What happens when the user wants to withdraw more money from the checking account than is in the account? 15 | - If a withdrawal can be covered by the balances in both accounts, take the balance of the account withdrawn from down to $0 and take the rest of the withdrawal from the other account. 16 | - If the withdrawal amount is more than the combined account balance, ignore it. 17 | - As a user, I want the color of my back account to reflect it's balance (there's a CSS class called .zero already written for this!) 18 | - Are there ways to refactor your code to make it DRYer or more Object-Oriented? 19 | 20 | ###Tips 21 | * Tackle making your accounts work individually first 22 | * Then tackle them working together with overdraft protection 23 | * Only start working with the DOM after you have the logic down 24 | 25 | ###Resources 26 | * [What is window.onload for?](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onload) 27 | * [Adding Event Listeners so things happen when you click](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener) 28 | * [Adding or removing a CSS class using JS](https://developer.mozilla.org/en-US/docs/Web/API/Element.classList) 29 | * [Changing HTML with JavaScript](https://developer.mozilla.org/en-US/docs/Web/API/Element.innerHTML) 30 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/pixart_js/pixart.js: -------------------------------------------------------------------------------- 1 | var $button = $("#set-color"); 2 | var $brush = $(".brush"); 3 | var $input = $("#color-field"); 4 | var $form = $("#form"); 5 | var $body = $("body"); 6 | 7 | // Step 1 8 | //When I click the "Set Color" button, it should change the color of the "brush" box to the color I specify in the input field. (Hint: You will need to use event.preventDefault() somewhere in your code.) 9 | $form.on("submit", function(e){ 10 | e.preventDefault(); 11 | var color = $input.val(); 12 | $brush.css('background', color); 13 | }) 14 | 15 | // Step 2 16 | //The same thing should happen when I press the enter key from inside the input field 17 | 18 | // Step 3 19 | //Create 20 divs of the "square" class and append them to the body 20 | //Hint: use .append() 21 | 22 | for( var i = 0; i < 8000; i++){ 23 | $body.append("
        "); 24 | } 25 | 26 | // Step 4 27 | //Add functionality so that when I click on each "square", it changes the color of that individual square to "green" 28 | //Hint: either add the event listener while creating the squares, or listen for events on the body element 29 | 30 | $(".square").on("mouseover", function( event ){ 31 | var $square = $(event.target); 32 | $square.css('background',$input.val()) 33 | }) 34 | 35 | // Step 5 36 | //Modify your code so that when I click on each "square", it changes to the color I set using my input instead of "green" every time. 37 | 38 | // Step 6 39 | //Modify the CSS so that the "square" class has a height and width of 10px and a margin of 0. 40 | //Modify your code so that you are creating 8000 divs instead of 20. 41 | //Change the event that changes your box colors from 'click' to 'mouseover' 42 | //Paint a picture! 43 | 44 | // Bonus 45 | //Add a color swatch. You should have 3 boxes with the most recent 3 colors used. When you click on each of those boxes, it should set the current brush color back to that color. 46 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/pixart_js/README.md: -------------------------------------------------------------------------------- 1 | #Pixart 2 | 3 | Use the starter code and commit each step of the exercise. 4 | 5 | - Fork and clone this repo. 6 | - Checkout a new branch called '**YOUR-NAME**-solution' 7 | - Work in small steps and commit frequently. 8 | - When you're finished, push your solution branch to your fork (`git push origin `) and issue a **pull request**. 9 | - Feel free to use jQuery. 10 | 11 | ###Commit 1 12 | 13 | * When I click the "Set Color" button, it should change the color of the "brush" box to the color I specify in the input field. (**Hint:** You will need to use `event.preventDefault()` somewhere in your code.) 14 | * Use jQuery to select the element, and `addEventListener` to handle clicks 15 | * `$("body")[0].addEventListener...` 16 | 17 | ###Commit 2 18 | 19 | * The same thing should happen when I press the enter key from inside the input field 20 | 21 | ###Commit 3 22 | 23 | * Create 20 divs of the "square" class and append them to the body 24 | * **Hint**: use `.append()` 25 | 26 | ###Commit 4 27 | 28 | * Add functionality so that when I click on each "square", it changes the color of that individual square to "green" 29 | * **Hint**: either add the event listener while creating the squares, or listen for events on the `body` element 30 | 31 | ###Commit 5 32 | 33 | * Modify your code so that when I click on each "square", it changes to the color I set using my input instead of "green" every time. 34 | 35 | ###Commit 6 36 | 37 | * Modify the CSS so that the "square" class has a height and width of 10px and a margin of 0. 38 | * Modify your code so that you are creating 8000 divs instead of 20. 39 | * Change the event that changes your box colors from 'click' to 'mouseover' 40 | * Paint a picture! 41 | 42 | ## Bonus 43 | 44 | * Add a color swatch. You should have 3 boxes with the most recent 3 colors used. When you click on each of those boxes, it should set the current brush color back to that color. 45 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/starter-code/pixart_js/README.md: -------------------------------------------------------------------------------- 1 | #Pixart 2 | 3 | Use the starter code and commit each step of the exercise. 4 | 5 | - Fork and clone this repo. 6 | - Checkout a new branch called '**YOUR-NAME**-solution' 7 | - Work in small steps and commit frequently. 8 | - When you're finished, push your solution branch to your fork (`git push origin `) and issue a **pull request**. 9 | - Feel free to use jQuery. 10 | 11 | ###Commit 1 12 | 13 | * When I click the "Set Color" button, it should change the color of the "brush" box to the color I specify in the input field. (**Hint:** You will need to use `event.preventDefault()` somewhere in your code.) 14 | * Use jQuery to select the element, and `addEventListener` to handle clicks 15 | * `$("body")[0].addEventListener...` 16 | 17 | ###Commit 2 18 | 19 | * The same thing should happen when I press the enter key from inside the input field 20 | 21 | ###Commit 3 22 | 23 | * Create 20 divs of the "square" class and append them to the body 24 | * **Hint**: use `.append()` 25 | 26 | ###Commit 4 27 | 28 | * Add functionality so that when I click on each "square", it changes the color of that individual square to "green" 29 | * **Hint**: either add the event listener while creating the squares, or listen for events on the `body` element 30 | 31 | ###Commit 5 32 | 33 | * Modify your code so that when I click on each "square", it changes to the color I set using my input instead of "green" every time. 34 | 35 | ###Commit 6 36 | 37 | * Modify the CSS so that the "square" class has a height and width of 10px and a margin of 0. 38 | * Modify your code so that you are creating 8000 divs instead of 20. 39 | * Change the event that changes your box colors from 'click' to 'mouseover' 40 | * Paint a picture! 41 | 42 | ## Bonus 43 | 44 | * Add a color swatch. You should have 3 boxes with the most recent 3 colors used. When you click on each of those boxes, it should set the current brush color back to that color. 45 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/events_codealong_and_exercise/main.js: -------------------------------------------------------------------------------- 1 | 2 | //SOLUTION: Appending: Independent Practice 3 | 4 | 'use strict'; 5 | var MyApp = {}; 6 | 7 | MyApp.addToList = function(list) { 8 | var $newLi = $('
      • '); 9 | var $newItemText = $('#new-thing'); 10 | $newLi.html($newItemText.val()); 11 | $newItemText.val(''); 12 | if ($newLi.html() !== '') { 13 | list.append($newLi); 14 | } 15 | MyApp.addButtons($newLi); 16 | } 17 | 18 | MyApp.initiateButtons = function($thingList) { 19 | $thingList.find('li').each(function() { 20 | MyApp.addButtons($(this)); 21 | }); 22 | } 23 | 24 | MyApp.addButtons = function($item) { 25 | var completeBtn = ' Complete'; 26 | $item.append(completeBtn); 27 | 28 | var deleteBtn = ' Delete'; 29 | $item.append(deleteBtn); 30 | } 31 | 32 | $(function() { 33 | // var yourName = prompt('What is your name?'); 34 | 35 | $('#name').html("World"); 36 | 37 | var $thingList = $('#fav-list'); 38 | 39 | var $button = $('#new-thing-button'); 40 | // button.onclick = function(event) { 41 | $button.on('click', function(event) { 42 | event.preventDefault(); 43 | MyApp.addToList($thingList); 44 | }); 45 | 46 | 47 | $thingList.on('mouseenter mouseleave', 'li', function(event) { 48 | if (event.type == 'mouseenter') { 49 | $(this).removeClass('inactive'); 50 | $(this).siblings().addClass('inactive'); 51 | } else if (event.type == 'mouseleave') { 52 | $(this).siblings().removeClass('inactive'); 53 | } 54 | }); 55 | 56 | $thingList.on('click', 'a.complete', function(e) { 57 | e.preventDefault(); 58 | var listItem = $(this).parent('li'); 59 | 60 | listItem.toggleClass('completed'); 61 | }); 62 | 63 | $thingList.on('click', 'a.delete', function(e) { 64 | e.preventDefault(); 65 | $(this).parent('li').remove(); 66 | }); 67 | 68 | MyApp.initiateButtons($thingList); 69 | }); 70 | -------------------------------------------------------------------------------- /04-18-advanced-apis/starter-code/app.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | // get access token from hash/fragment 4 | var uriHash = window.location.hash; 5 | 6 | if (uriHash.length > 0) { 7 | var accessToken = uriHash.replace('#access_token=', ''); 8 | getImages(accessToken); 9 | } else { 10 | // if not yet redirected hide results view 11 | $('.image-results-view').hide(); 12 | } 13 | 14 | 15 | function getImages(accessToken) { 16 | // hide the sign in view 17 | 18 | 19 | // Determine the user's location. When the location position is obtained 20 | // store latitude in a variable 21 | // store longitude in a variable 22 | 23 | // create a variable for the endpoing 24 | var instagramEndpoint = ``; // <== store your url here in this string! 25 | 26 | // now lets fetch the data images from instagram and handle the response 27 | $ajax({ 28 | url: instagramEndpoint, 29 | method: '', // <=== Hmm, what type of request is this?, 30 | dataType: 'jsonp', 31 | success: handleResponseSuccess // <== You'll have to implement this below 32 | }); 33 | } 34 | 35 | 36 | function handleResponseSuccess(response) { 37 | var allData = response.data; 38 | // for each item in allData 39 | // assign the item's image url to a variable imageUrl 40 | // create a new jQuery div element 41 | // Use the jQuery css method to change the background of the the div to the imageUrl 42 | // Use jQuery to add the 'image' class to the new div element 43 | // append the new div element to the .images div 44 | } 45 | 46 | // This function fetches the current location of the user. It has one parameter 47 | // onLocation which is a callback function here's an example 48 | // getCurrentLocation(function(position) { 49 | // the position object has the current lat/long 50 | // }) 51 | function getCurrentLocation(onLocation) { 52 | if (navigator.geolocation) { 53 | navigator.geolocation.getCurrentPosition(onLocation); 54 | } else { 55 | console.error("Geolocation is not supported by this browser."); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /03-16-collections-and-loops/solution-code/fizzbizz.js: -------------------------------------------------------------------------------- 1 | //Step 1: 2 | 3 | //Construct a for loop that iterates through, and `console.log()`'s out, numbers 1 - 100: 4 | 5 | for (var num = 1; num <= 100; num++) { 6 | console.log(num); 7 | } 8 | 9 | //Step 2: 10 | 11 | //Add an `if/else` statement that logs the string `"fizz"` if the value being iterated over is divisible by `3`; otherwise, log out the value: 12 | 13 | for (var num = 1; num <= 100; num++) { 14 | if (num % 3 === 0) { 15 | console.log('fizz'); 16 | } else { 17 | console.log(num) 18 | } 19 | } 20 | 21 | //##### Step 3: 22 | 23 | //Add an `else if` clause that logs the string `"buzz"` if the value being iterated over is divisible by `5`: 24 | 25 | for (var num = 1; num <= 100; num++) { 26 | if (num % 3 === 0) { 27 | console.log('fizz'); 28 | } else if (num % 5 === 0) { 29 | console.log('buzz') 30 | } else { 31 | console.log(num) 32 | } 33 | } 34 | 35 | //##### Step 4: 36 | 37 | //Add an additional `else if` clause that logs the string `"fizzbuzz"` if the value being iterated over is divisible by both `3` and `5`. __Note:__ this step is intentionally broken! Place the new `else if` __below__ the evaluations for `fizz` and `buzz`; after running the code, and experiencing the undesired results, prompt the students as to why the `fizzbuzz` evaluation never occurred. 38 | 39 | for (var num = 1; num <= 100; num++) { 40 | if (num % 3 === 0) { 41 | console.log('fizz'); 42 | } else if (num % 5 === 0) { 43 | console.log('buzz') 44 | } else if (num % 15 === 0) { 45 | console.log('fizzbuzz') 46 | } else { 47 | console.log(num) 48 | } 49 | } 50 | 51 | //##### Step 5: 52 | 53 | //Fix the above code to evaluate the `fizzbuzz` condition: 54 | 55 | 56 | for (var num = 1; num <= 100; num++) { 57 | if (num % 15 === 0) { 58 | console.log('fizzbuzz'); 59 | } else if (num % 5 === 0) { 60 | console.log('buzz') 61 | } else if (num % 3 === 0) { 62 | console.log('fizz') 63 | } else { 64 | console.log(num) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/solution-code/07-oop-monkey-js/spec/monkey_spec.js: -------------------------------------------------------------------------------- 1 | var jasmineExpect = require('jasmine-expect'); 2 | var Monkey = require("../lib/monkey.js"); 3 | 4 | describe("Monkey", function() { 5 | it("has a name", function() { 6 | adam = new Monkey("Adam", "Spider Monkey"); 7 | 8 | expect(adam.name).toEqual("Adam"); 9 | }); 10 | 11 | it("has a species", function() { 12 | andy = new Monkey("Andy", "Cool Monkey"); 13 | 14 | expect(andy.species).toEqual("Cool Monkey"); 15 | }); 16 | 17 | it("starts with no foods eaten", function() { 18 | adrian = new Monkey("Adrian", "White-headed Capuchin"); 19 | 20 | expect(adrian.foodsEaten).toEqual([]); 21 | }); 22 | 23 | it("can eat a food (a string)", function() { 24 | matt = new Monkey("Matt", "Mandrill"); 25 | matt.eat("banana"); 26 | matt.eat("PB&J"); 27 | 28 | expect(matt.foodsEaten).toContain("banana"); 29 | expect(matt.foodsEaten).toContain("PB&J"); 30 | }); 31 | 32 | it("can introduce itself with name, species, and foods eaten", function() { 33 | jesse = new Monkey("Jesse", "Dusky Leaf Monkey"); 34 | jesse.eat("cheeseburger"); 35 | jesse.eat("bacon"); 36 | 37 | expect(jesse.introduce()).toContain("Jesse"); 38 | expect(jesse.introduce()).toContain("Dusky Leaf Monkey"); 39 | expect(jesse.introduce()).toContain("cheeseburger"); 40 | expect(jesse.introduce()).toContain("bacon"); 41 | }); 42 | 43 | // //******BONUS****** 44 | // it("always has a capitalized name", function() { 45 | // robin = new Monkey("robin", "Olive Baboon"); 46 | // expect(robin.name).toEqual("Robin"); 47 | // }); 48 | // 49 | // it("won't eat foods begninng with a vowel", function() { 50 | // robin = new Monkey("robin", "Olive Baboon"); 51 | // 52 | // robin.eat("apple"); 53 | // robin.eat("eclair"); 54 | // robin.eat("ice"); 55 | // robin.eat("ovaltine"); 56 | // robin.eat("udon"); 57 | // 58 | // robin.eat("pudding"); 59 | // robin.eat("chocolate"); 60 | // 61 | // //we only expect to see non-vowel foods in the list of foodsEaten 62 | // expect(robin.foodsEaten).toEqual(["pudding", "chocolate"]); 63 | // }); 64 | }); 65 | -------------------------------------------------------------------------------- /05-02-prototypal-inheritance/starter-code/07-oop-monkey-js/spec/monkey_spec.js: -------------------------------------------------------------------------------- 1 | var jasmineExpect = require('jasmine-expect'); 2 | var Monkey = require("../lib/monkey.js"); 3 | 4 | describe("Monkey", function() { 5 | it("has a name", function() { 6 | adam = new Monkey("Adam", "Spider Monkey"); 7 | 8 | expect(adam.name).toEqual("Adam"); 9 | }); 10 | 11 | it("has a species", function() { 12 | andy = new Monkey("Andy", "Cool Monkey"); 13 | 14 | expect(andy.species).toEqual("Cool Monkey"); 15 | }); 16 | 17 | it("starts with no foods eaten", function() { 18 | adrian = new Monkey("Adrian", "White-headed Capuchin"); 19 | 20 | expect(adrian.foodsEaten).toEqual([]); 21 | }); 22 | 23 | it("can eat a food (a string)", function() { 24 | matt = new Monkey("Matt", "Mandrill"); 25 | matt.eat("banana"); 26 | matt.eat("PB&J"); 27 | 28 | expect(matt.foodsEaten).toContain("banana"); 29 | expect(matt.foodsEaten).toContain("PB&J"); 30 | }); 31 | 32 | it("can introduce itself with name, species, and foods eaten", function() { 33 | jesse = new Monkey("Jesse", "Dusky Leaf Monkey"); 34 | jesse.eat("cheeseburger"); 35 | jesse.eat("bacon"); 36 | 37 | expect(jesse.introduce()).toContain("Jesse"); 38 | expect(jesse.introduce()).toContain("Dusky Leaf Monkey"); 39 | expect(jesse.introduce()).toContain("cheeseburger"); 40 | expect(jesse.introduce()).toContain("bacon"); 41 | }); 42 | 43 | // //******BONUS****** 44 | // it("always has a capitalized name", function() { 45 | // robin = new Monkey("robin", "Olive Baboon"); 46 | // expect(robin.name).toEqual("Robin"); 47 | // }); 48 | // 49 | // it("won't eat foods begninng with a vowel", function() { 50 | // robin = new Monkey("robin", "Olive Baboon"); 51 | // 52 | // robin.eat("apple"); 53 | // robin.eat("eclair"); 54 | // robin.eat("ice"); 55 | // robin.eat("ovaltine"); 56 | // robin.eat("udon"); 57 | // 58 | // robin.eat("pudding"); 59 | // robin.eat("chocolate"); 60 | // 61 | // //we only expect to see non-vowel foods in the list of foodsEaten 62 | // expect(robin.foodsEaten).toEqual(["pudding", "chocolate"]); 63 | // }); 64 | }); 65 | -------------------------------------------------------------------------------- /04-13-async-js-and-callbacks/instagram.md: -------------------------------------------------------------------------------- 1 | # ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) 2 | 3 | #### Signing Up For Instagram Credentials 4 | 5 | In the next lesson, we'll be doing an in-class exercise that uses Instagram's API. The first step in working with a third-party API that requires authentication is to register your application with the API. The purpose of this is so that the API owner, in this case Instagram, can give our app credentials to use in future requests so it can recognize who is asking for what information. Let's go ahead and get our credentials! 6 | 7 | First and foremost, you must have an Instagram account. If you don't already have one, please sign up. Once you are signed in, visit Instagram's [developer site](https://instagram.com/developer/). Here you will see an option in the navbar to "Manage Clients". Click it. Once [here](https://instagram.com/developer/clients/manage/) register your application by clicking on the "Register a New Client" button. You should see the following: 8 | 9 | ![register client](https://s3.amazonaws.com/f.cl.ly/items/26180R00453o1D1q171i/Image%202015-11-08%20at%2012.55.00%20PM.png) 10 | 11 | After you fill out the form you'll have: 12 | 13 | ![register client form](https://s3.amazonaws.com/f.cl.ly/items/2B2g2J1d1l200q190h44/Image%202015-11-08%20at%2012.57.36%20PM.png) 14 | 15 | Most of the fields values should be pretty self-explanatory. However, _Website URL_ and _Valid Redirect URIs_ may not be as obvious. In both of these fields, enter in `http://localhost:3000`. Make sure you type in `http://localhost:3000` carefully, as the punctuation here matters! 16 | 17 | The last step is to turn on implicit Oauth flow, which we'll be needing for our app. Hit the "edit" button on your newly-created application. Next, hit the "security" button. You should see the screen below. What you're looking for is the checkbox that says "Disable implicit Oauth" next to it. **If this box is checked, make sure to uncheck it**. If you neglect to uncheck this box, your app will not work! 18 | 19 | ![Implicit Oauth](../../../resources/images/implicit_oauth.png) 20 | 21 | You're now ready to start working with the Instagram API during our next class! 22 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/03-posts_requests/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var FavoriteThings = { 4 | elements: { 5 | $thingList: $('#todo-list'), 6 | $button: $('#new-thing-button'), 7 | $form: $('#new-thing-form'), 8 | $newItemInput: $('#new-thing'), 9 | $toDoTemplate: $("#to-do-template") 10 | }, 11 | add: function(thing){ 12 | var $listItem = FavoriteThings.render(FavoriteThings.elements.$toDoTemplate,thing); 13 | FavoriteThings.elements.$thingList.append($listItem); 14 | FavoriteThings.elements.$newItemInput.val(''); 15 | // send a post request to "/things" 16 | // data: { newThing: thing.text } 17 | }, 18 | markComplete: function(event){ 19 | event.preventDefault(); 20 | $(this).parent().addClass("completed"); 21 | var thing = $(this).siblings(".todo-text").html() 22 | // send a patch request to /things/thing-text 23 | // e.g. /things/ 24 | }, 25 | delete: function(event){ 26 | event.preventDefault(); 27 | $(this).parent().remove(); 28 | // send a delete request to /thing 29 | // data: { thing: thing.text } 30 | }, 31 | listen: function(){ 32 | FavoriteThings.elements.$form.on("submit", function(event){ 33 | event.preventDefault(); 34 | FavoriteThings.add({ 35 | text: FavoriteThings.elements.$newItemInput.val(), 36 | completed: false 37 | }) 38 | }) 39 | FavoriteThings.elements.$thingList.on( 40 | "click", 'a.complete', 41 | FavoriteThings.markComplete 42 | ) 43 | FavoriteThings.elements.$thingList.on( 44 | "click", 'a.delete', 45 | FavoriteThings.delete 46 | ) 47 | }, 48 | render: function($element, context){ 49 | var source = $element.html(); 50 | var template = Handlebars.compile(source); 51 | var html = template(context); 52 | return $(html); 53 | }, 54 | load: function(callback){ 55 | $.get("/things", function(response){ 56 | console.log(response) 57 | response.forEach(function(thing){ 58 | FavoriteThings.elements.$thingList.append( 59 | FavoriteThings.render(FavoriteThings.elements.$toDoTemplate,thing) 60 | ) 61 | }) 62 | callback(response) 63 | }) 64 | } 65 | }; 66 | 67 | FavoriteThings.load(function(){ 68 | FavoriteThings.listen() 69 | }) 70 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/03-posts_requests/server.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | 4 | var fs = require('fs'); 5 | var express = require('express'); 6 | var bodyParser = require('body-parser'); 7 | var connect = require('connect'); 8 | var app = express(); 9 | var myFavThings = []; 10 | 11 | app.use(bodyParser()); 12 | app.use(bodyParser.json()); 13 | app.use(bodyParser.urlencoded({ extended: false })); 14 | app.use(express.static('.')); 15 | 16 | app.patch('/things/:existingThing', function(req, res) { 17 | var existingThing = req.params.existingThing; 18 | var completed = req.body.completed; 19 | var index = indexOf(existingThing); 20 | if (index > -1) { 21 | myFavThings[index].completed = completed; 22 | res.status(200).send(myFavThings); 23 | } else { 24 | res.status(500).send(`Thing ${existingThing} does not exist`); 25 | } 26 | }); 27 | 28 | app.post('/things', function(req, res) { 29 | var newThing = req.body.newThing; 30 | if (!exists(newThing)) { 31 | myFavThings.push({ text: newThing, completed: false }); 32 | res.status(200).json(newThing); 33 | } else { 34 | res.status(500).json({ message: `Thing ${newThing} is already in your list` }); 35 | } 36 | }) 37 | 38 | app.get('/things', function(req, res) { 39 | res.status(200).json(myFavThings); 40 | }); 41 | 42 | app.delete('/thing', function(req, res) { 43 | var thingToDelete = req.body.thing; 44 | /* 45 | * Remove the thing from our favThings array and return 46 | * the new array with a status of 200. Use the app.post('/thing') 47 | * route as a guide. 48 | */ 49 | }); 50 | 51 | app.get('/', function(req, res) { 52 | fs.createReadStream('index.html').pipe(res); 53 | }); 54 | 55 | app.listen(3000, function() { 56 | console.log('\n**********************************'); 57 | console.log(` I believe in you :-)\n Go to http://localhost:3000`); 58 | console.log('**********************************\n'); 59 | }); 60 | 61 | function exists(thing) { 62 | return myFavThings.some(function(item) { 63 | return item.text === thing.text; 64 | }); 65 | } 66 | 67 | function indexOf(thingText) { 68 | var index; 69 | for (var i = 0; i < myFavThings.length; i++) { 70 | if (thingText === myFavThings[i].text) { 71 | index = i; 72 | break; 73 | } 74 | } 75 | return index; 76 | } -------------------------------------------------------------------------------- /04-11-ajax-and-apis/starter-code/03-posts_requests/server.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | 4 | var fs = require('fs'); 5 | var express = require('express'); 6 | var bodyParser = require('body-parser'); 7 | var connect = require('connect'); 8 | var app = express(); 9 | var myFavThings = []; 10 | 11 | app.use(bodyParser()); 12 | app.use(bodyParser.json()); 13 | app.use(bodyParser.urlencoded({ extended: false })); 14 | app.use(express.static('.')); 15 | 16 | app.patch('/things/:existingThing', function(req, res) { 17 | var existingThing = req.params.existingThing; 18 | var completed = req.body.completed; 19 | var index = indexOf(existingThing); 20 | if (index > -1) { 21 | myFavThings[index].completed = completed; 22 | res.status(200).send(myFavThings); 23 | } else { 24 | res.status(500).send(`Thing ${existingThing} does not exist`); 25 | } 26 | }); 27 | 28 | app.post('/things', function(req, res) { 29 | var newThing = req.body.newThing; 30 | if (!exists(newThing)) { 31 | myFavThings.push({ text: newThing, completed: false }); 32 | res.status(200).json(newThing); 33 | } else { 34 | res.status(500).json({ message: `Thing ${newThing} is already in your list` }); 35 | } 36 | }) 37 | 38 | app.get('/things', function(req, res) { 39 | res.status(200).json(myFavThings); 40 | }); 41 | 42 | app.delete('/thing', function(req, res) { 43 | var thingToDelete = req.body.thing; 44 | /* 45 | * Remove the thing from our favThings array and return 46 | * the new array with a status of 200. Use the app.post('/thing') 47 | * route as a guide. 48 | */ 49 | }); 50 | 51 | app.get('/', function(req, res) { 52 | fs.createReadStream('index.html').pipe(res); 53 | }); 54 | 55 | app.listen(3000, function() { 56 | console.log('\n**********************************'); 57 | console.log(` I believe in you :-)\n Go to http://localhost:3000`); 58 | console.log('**********************************\n'); 59 | }); 60 | 61 | function exists(thing) { 62 | return myFavThings.some(function(item) { 63 | return item.text === thing.text; 64 | }); 65 | } 66 | 67 | function indexOf(thingText) { 68 | var index; 69 | for (var i = 0; i < myFavThings.length; i++) { 70 | if (thingText === myFavThings[i].text) { 71 | index = i; 72 | break; 73 | } 74 | } 75 | return index; 76 | } -------------------------------------------------------------------------------- /05-04-CRUD/starter-code/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | =================================================== 3 | ===================== WELCOME ===================== 4 | =================================================== 5 | */ 6 | 7 | var Message = new ParseObjectType('Message'); 8 | 9 | $(document).ready(function() { 10 | // TODO 11 | // When the message form submits 12 | // stop the page from refreshing 13 | // Take the data entered and create a new message. Relevant data is the message text and number of upVotes 14 | // When the message is SUCCESSFULLY created, grab the objectId from the result and render a new handlebars template 15 | 16 | // on initialization of app (when document is ready) get fan messages 17 | getFanMessages(); 18 | 19 | // This function should get all the currently saved messages and setup the event listeners 20 | // for the upvote and delete button! 21 | function getFanMessages() { 22 | 23 | // TODO 24 | // When someone clicks an upvote button, increase the number of votes and update the corresponding message model 25 | // When someone clicks a delete button, remove that message from the database 26 | // Update the view to reflect the upvote or deletion 27 | 28 | // Maybe you can use this function to encapsulate the remote post functionality. 29 | // Maybe $messageEl is the corresponding li element. IDK, do what you want. 30 | function removePost($messageEl) { 31 | // TODO 32 | // Remove the message from the database. When it's done, update the view 33 | } 34 | 35 | // Maybe you can use this function to encapsulate the increment votes functionality. 36 | // Maybe $messageEl is the corresponding li element. IDK, do what you want. 37 | function updateVote($messageEl) { 38 | // TODO 39 | // Update the vote count in the database. When it's done, update the view 40 | } 41 | 42 | // TODO 43 | // There should be code here to get all the current messages and populate the view accordingly 44 | } 45 | 46 | function renderMessage(messageData) { 47 | var html = compile(messageData); 48 | $('.message-board').append(html); 49 | } 50 | 51 | function compile(messageData) { 52 | var source = $("#message-template").html(); 53 | var template = Handlebars.compile(source); 54 | var html = template(messageData); 55 | return html; 56 | } 57 | }); 58 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/dice/css/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Project Name: Blank Template 3 | Client: Your Client 4 | Author: Your Name 5 | Developer @GA in NYC 6 | */ 7 | 8 | 9 | /****************************************** 10 | /* SETUP 11 | /*******************************************/ 12 | 13 | /* Box Model Hack */ 14 | * { 15 | -moz-box-sizing: border-box; /* Firexfox */ 16 | -webkit-box-sizing: border-box; /* Safari/Chrome/iOS/Android */ 17 | box-sizing: border-box; /* IE */ 18 | } 19 | 20 | /* Clear fix hack */ 21 | .clearfix:after { 22 | content: "."; 23 | display: block; 24 | clear: both; 25 | visibility: hidden; 26 | line-height: 0; 27 | height: 0; 28 | } 29 | 30 | .clear { 31 | clear: both; 32 | } 33 | 34 | .alignright { 35 | float: right; 36 | padding: 0 0 10px 10px; /* note the padding around a right floated image */ 37 | } 38 | 39 | .alignleft { 40 | float: left; 41 | padding: 0 10px 10px 0; /* note the padding around a left floated image */ 42 | } 43 | 44 | /****************************************** 45 | /* BASE STYLES 46 | /*******************************************/ 47 | 48 | body { 49 | color: #000; 50 | font-size: 12px; 51 | line-height: 1.4; 52 | font-family: Helvetica, Arial, sans-serif; 53 | } 54 | 55 | 56 | /****************************************** 57 | /* LAYOUT 58 | /*******************************************/ 59 | 60 | /* Center the container */ 61 | #container { 62 | width: 960px; 63 | margin: auto; 64 | } 65 | 66 | #content span { 67 | width: 100px; 68 | height: 100px; 69 | display: inline-block; 70 | margin: 20px; 71 | background-repeat: no-repeat; 72 | background-position: top left; 73 | } 74 | 75 | .dice-1 { 76 | background-image: url('../img/1.png'); 77 | } 78 | .dice-2 { 79 | background-image: url('../img/2.png'); 80 | } 81 | .dice-3 { 82 | background-image: url('../img/3.png'); 83 | } 84 | .dice-4 { 85 | background-image: url('../img/4.png'); 86 | } 87 | .dice-5 { 88 | background-image: url('../img/5.png'); 89 | } 90 | .dice-6 { 91 | background-image: url('../img/6.png'); 92 | } 93 | /****************************************** 94 | /* ADDITIONAL STYLES 95 | /*******************************************/ 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/dice/css/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Project Name: Blank Template 3 | Client: Your Client 4 | Author: Your Name 5 | Developer @GA in NYC 6 | */ 7 | 8 | 9 | /****************************************** 10 | /* SETUP 11 | /*******************************************/ 12 | 13 | /* Box Model Hack */ 14 | * { 15 | -moz-box-sizing: border-box; /* Firexfox */ 16 | -webkit-box-sizing: border-box; /* Safari/Chrome/iOS/Android */ 17 | box-sizing: border-box; /* IE */ 18 | } 19 | 20 | /* Clear fix hack */ 21 | .clearfix:after { 22 | content: "."; 23 | display: block; 24 | clear: both; 25 | visibility: hidden; 26 | line-height: 0; 27 | height: 0; 28 | } 29 | 30 | .clear { 31 | clear: both; 32 | } 33 | 34 | .alignright { 35 | float: right; 36 | padding: 0 0 10px 10px; /* note the padding around a right floated image */ 37 | } 38 | 39 | .alignleft { 40 | float: left; 41 | padding: 0 10px 10px 0; /* note the padding around a left floated image */ 42 | } 43 | 44 | /****************************************** 45 | /* BASE STYLES 46 | /*******************************************/ 47 | 48 | body { 49 | color: #000; 50 | font-size: 12px; 51 | line-height: 1.4; 52 | font-family: Helvetica, Arial, sans-serif; 53 | } 54 | 55 | 56 | /****************************************** 57 | /* LAYOUT 58 | /*******************************************/ 59 | 60 | /* Center the container */ 61 | #container { 62 | width: 960px; 63 | margin: auto; 64 | } 65 | 66 | #content span { 67 | width: 100px; 68 | height: 100px; 69 | display: inline-block; 70 | margin: 20px; 71 | background-repeat: no-repeat; 72 | background-position: top left; 73 | } 74 | 75 | .dice-1 { 76 | background-image: url('../img/1.png'); 77 | } 78 | .dice-2 { 79 | background-image: url('../img/2.png'); 80 | } 81 | .dice-3 { 82 | background-image: url('../img/3.png'); 83 | } 84 | .dice-4 { 85 | background-image: url('../img/4.png'); 86 | } 87 | .dice-5 { 88 | background-image: url('../img/5.png'); 89 | } 90 | .dice-6 { 91 | background-image: url('../img/6.png'); 92 | } 93 | /****************************************** 94 | /* ADDITIONAL STYLES 95 | /*******************************************/ 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/starter-code/currency-converter/css/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Project Name: Blank Template 3 | Client: Your Client 4 | Author: Your Name 5 | Developer @GA in NYC 6 | */ 7 | 8 | 9 | /****************************************** 10 | /* SETUP 11 | /*******************************************/ 12 | 13 | /* Box Model Hack */ 14 | * { 15 | -moz-box-sizing: border-box; /* Firexfox */ 16 | -webkit-box-sizing: border-box; /* Safari/Chrome/iOS/Android */ 17 | box-sizing: border-box; /* IE */ 18 | } 19 | 20 | /* Clear fix hack */ 21 | .clearfix:after { 22 | content: "."; 23 | display: block; 24 | clear: both; 25 | visibility: hidden; 26 | line-height: 0; 27 | height: 0; 28 | } 29 | 30 | .clear { 31 | clear: both; 32 | } 33 | 34 | .alignright { 35 | float: right; 36 | padding: 0 0 10px 10px; /* note the padding around a right floated image */ 37 | } 38 | 39 | .alignleft { 40 | float: left; 41 | padding: 0 10px 10px 0; /* note the padding around a left floated image */ 42 | } 43 | 44 | /****************************************** 45 | /* BASE STYLES 46 | /*******************************************/ 47 | 48 | body { 49 | color: #000; 50 | font-size: 12px; 51 | line-height: 1.4; 52 | font-family: Helvetica, Arial, sans-serif; 53 | } 54 | 55 | 56 | /****************************************** 57 | /* LAYOUT 58 | /*******************************************/ 59 | 60 | /* Center the container */ 61 | #container { 62 | width: 960px; 63 | margin: auto; 64 | } 65 | 66 | #content span { 67 | width: 100px; 68 | height: 100px; 69 | display: inline-block; 70 | margin: 20px; 71 | background-repeat: no-repeat; 72 | background-position: top left; 73 | } 74 | 75 | .dice-1 { 76 | background-image: url('../img/1.png'); 77 | } 78 | .dice-2 { 79 | background-image: url('../img/2.png'); 80 | } 81 | .dice-3 { 82 | background-image: url('../img/3.png'); 83 | } 84 | .dice-4 { 85 | background-image: url('../img/4.png'); 86 | } 87 | .dice-5 { 88 | background-image: url('../img/5.png'); 89 | } 90 | .dice-6 { 91 | background-image: url('../img/6.png'); 92 | } 93 | /****************************************** 94 | /* ADDITIONAL STYLES 95 | /*******************************************/ 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /03-21-functions-and-scope/solution-code/currency-converter/css/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Project Name: Blank Template 3 | Client: Your Client 4 | Author: Your Name 5 | Developer @GA in NYC 6 | */ 7 | 8 | 9 | /****************************************** 10 | /* SETUP 11 | /*******************************************/ 12 | 13 | /* Box Model Hack */ 14 | * { 15 | -moz-box-sizing: border-box; /* Firexfox */ 16 | -webkit-box-sizing: border-box; /* Safari/Chrome/iOS/Android */ 17 | box-sizing: border-box; /* IE */ 18 | } 19 | 20 | /* Clear fix hack */ 21 | .clearfix:after { 22 | content: "."; 23 | display: block; 24 | clear: both; 25 | visibility: hidden; 26 | line-height: 0; 27 | height: 0; 28 | } 29 | 30 | .clear { 31 | clear: both; 32 | } 33 | 34 | .alignright { 35 | float: right; 36 | padding: 0 0 10px 10px; /* note the padding around a right floated image */ 37 | } 38 | 39 | .alignleft { 40 | float: left; 41 | padding: 0 10px 10px 0; /* note the padding around a left floated image */ 42 | } 43 | 44 | /****************************************** 45 | /* BASE STYLES 46 | /*******************************************/ 47 | 48 | body { 49 | color: #000; 50 | font-size: 12px; 51 | line-height: 1.4; 52 | font-family: Helvetica, Arial, sans-serif; 53 | } 54 | 55 | 56 | /****************************************** 57 | /* LAYOUT 58 | /*******************************************/ 59 | 60 | /* Center the container */ 61 | #container { 62 | width: 960px; 63 | margin: auto; 64 | } 65 | 66 | #content span { 67 | width: 100px; 68 | height: 100px; 69 | display: inline-block; 70 | margin: 20px; 71 | background-repeat: no-repeat; 72 | background-position: top left; 73 | } 74 | 75 | .dice-1 { 76 | background-image: url('../img/1.png'); 77 | } 78 | .dice-2 { 79 | background-image: url('../img/2.png'); 80 | } 81 | .dice-3 { 82 | background-image: url('../img/3.png'); 83 | } 84 | .dice-4 { 85 | background-image: url('../img/4.png'); 86 | } 87 | .dice-5 { 88 | background-image: url('../img/5.png'); 89 | } 90 | .dice-6 { 91 | background-image: url('../img/6.png'); 92 | } 93 | /****************************************** 94 | /* ADDITIONAL STYLES 95 | /*******************************************/ 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /03-14-data-types/lab-solution.md: -------------------------------------------------------------------------------- 1 | ## Data Collections 2 | 3 | ### Arrays 4 | 5 | Javascript provides us with a number of native methods that allow us to interact with arrays. Find methods that do each of the following and provide an example... 6 | 7 | 8 | ```js 9 | var nums = [1,2,3] 10 | // * Add an element to the back of an array. 11 | nums.push(4) 12 | // * Remove an element from the back of an array. 13 | nums.pop() 14 | // * Add an element to the front of an array. 15 | nums.unshift(0) 16 | // * Remove an element from the front of an array. 17 | nums.shift() 18 | // * Concatenates all the elements in an array into a string. 19 | nums.join('') 20 | // * Separates the characters of a string into an array. 21 | var str = "supercalifragilisticexpialidocious" 22 | str.split("") 23 | ``` 24 | 25 | What will the contents of the below arrays be after the code samples are executed? Come up with an answer yourself before testing it out in the console. 26 | > **HINT:** You might find it helpful to draw the arrays out as you run each line of code. 27 | 28 | ```js 29 | var numbers = [ 2, 4, 6, 8 ]; 30 | 31 | ``` 32 | 33 | ```js 34 | numbers.pop(); // [2,4,6] 35 | numbers.push( 10 ); // [2,4,6,10] 36 | numbers.unshift( 3 ); // [3,2,4,6,10] 37 | ``` 38 | 39 | What is the return value of the below code sample? Come up with an answer yourself before testing it out in the console. 40 | 41 | ```js 42 | var morse = [ "dot", "pause", "dot" ]; 43 | var moreMorse = morse.join( " dash " ); // "dot dash pause dash dot" 44 | moreMorse.split( " " ); // ["dot","dash","pause","dot"] 45 | ``` 46 | 47 | What will the contents of the below array be after the below code sample is executed? Come up with an answer yourself before testing it out in the console. 48 | 49 | ```js 50 | var bands = []; 51 | var beatles = [ "Paul", "John", "George", "Pete" ]; 52 | var stones = [ "Brian", "Mick", "Keith", "Ronnie", "Charlie" ]; 53 | bands.push( beatles ); // [["Paul", "John", "George", "Pete"]] 54 | bands.unshift( stones );// [[ "Brian", "Mick", "Keith", "Ronnie", "Charlie" ],["Paul", "John", "George", "Pete"]] 55 | bands[ bands.length - 1 ].pop(); // [[ "Brian", "Mick", "Keith", "Ronnie", "Charlie" ],["Paul", "John", "George"]] 56 | bands[0].shift(); // [["Mick", "Keith", "Ronnie", "Charlie" ],["Paul", "John", "George"]] 57 | bands[1][3] = "Ringo"; // [["Mick", "Keith", "Ronnie", "Charlie" ],["Paul", "John", "George","Ringo"]] 58 | ``` 59 | -------------------------------------------------------------------------------- /04-11-ajax-and-apis/solution-code/03-posts_requests/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var FavoriteThings = { 4 | elements: { 5 | $thingList: $('#todo-list'), 6 | $button: $('#new-thing-button'), 7 | $form: $('#new-thing-form'), 8 | $newItemInput: $('#new-thing'), 9 | $toDoTemplate: $("#to-do-template") 10 | }, 11 | add: function(thing){ 12 | var $listItem = FavoriteThings.render(FavoriteThings.elements.$toDoTemplate,thing); 13 | FavoriteThings.elements.$thingList.append($listItem); 14 | FavoriteThings.elements.$newItemInput.val(''); 15 | // send a post request to "/things" 16 | // data: { newThing: thing.text } 17 | $.ajax({ 18 | url: "/things", 19 | method: "post", 20 | data: { 21 | newThing: thing.text 22 | } 23 | }) 24 | }, 25 | markComplete: function(event){ 26 | event.preventDefault(); 27 | $(this).parent().addClass("completed"); 28 | var thing = $(this).siblings(".todo-text").html() 29 | // send a patch request to /things/thing-text 30 | // e.g. /things/my+favorite+thing 31 | $.ajax({ 32 | url: "/things/" + thing, 33 | method: "patch", 34 | data: { 35 | completed: true 36 | } 37 | }) 38 | }, 39 | delete: function(event){ 40 | event.preventDefault(); 41 | $(this).parent().remove(); 42 | // send a delete request to /thing 43 | // data: { thing: thing.text } 44 | // modify server.js to delete the thing 45 | }, 46 | listen: function(){ 47 | FavoriteThings.elements.$form.on("submit", function(event){ 48 | event.preventDefault(); 49 | FavoriteThings.add({ 50 | text: FavoriteThings.elements.$newItemInput.val(), 51 | completed: false 52 | }) 53 | }) 54 | FavoriteThings.elements.$thingList.on( 55 | "click", 'a.complete', 56 | FavoriteThings.markComplete 57 | ) 58 | FavoriteThings.elements.$thingList.on( 59 | "click", 'a.delete', 60 | FavoriteThings.delete 61 | ) 62 | }, 63 | render: function($element, context){ 64 | var source = $element.html(); 65 | var template = Handlebars.compile(source); 66 | var html = template(context); 67 | return $(html); 68 | }, 69 | load: function(callback){ 70 | $.get("/things", function(response){ 71 | console.log(response) 72 | response.forEach(function(thing){ 73 | FavoriteThings.elements.$thingList.append( 74 | FavoriteThings.render(FavoriteThings.elements.$toDoTemplate,thing) 75 | ) 76 | }) 77 | callback(response) 78 | }) 79 | } 80 | }; 81 | 82 | FavoriteThings.load(function(){ 83 | FavoriteThings.listen() 84 | }) 85 | -------------------------------------------------------------------------------- /05-04-CRUD/solution-code/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The Bey Hive 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 33 | 34 | 35 | 36 | 37 | 44 | 45 |
        46 |
        47 |
        48 |
        Post a message for all fans of Beyonce AND Beyonce to see!
        49 |
        50 |
        51 |
        52 | 53 | 54 |
        55 | 56 |
        57 |
        58 |
        59 |
        60 | 61 |
        62 |
        63 |
        Message Board
        64 |
        65 |
          66 |
        67 |
        68 |
        69 |
        70 | 71 |
        72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /04-04-dom-and-jquery-continued/solution-code/templating_codealong/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var MyApp = {}; 3 | 4 | // Compile element using handlebars 5 | MyApp.compileItem = function(item) { 6 | var source = $('#to-do-template').html(); 7 | var template = Handlebars.compile(source); 8 | return template(item); 9 | } 10 | 11 | // Note: this starter data is usually loaded from somewhere 12 | MyApp.todos = [{toDo: "Clean fridge"}, {toDo: "Take out Puppy"}, {toDo: "Finish work"} ]; 13 | 14 | MyApp.addToList = function(list, item) { 15 | var itemObject = {toDo: item.val()}; 16 | MyApp.todos.push(itemObject); 17 | var compiledItem = MyApp.compileItem(itemObject) 18 | list.append(compiledItem); 19 | $('#new-thing').val(''); 20 | } 21 | 22 | // Initial population of the list from todos array 23 | MyApp.populateList = function(list) { 24 | for (var i=0; i -1) 36 | MyApp.todos.splice(itemIndex, 1); 37 | 38 | // Remove dom element of item 39 | $item.remove(); 40 | } 41 | 42 | $(function() { 43 | 44 | var $thingList = $('#fav-list'), 45 | $button = $('#new-thing-button'); 46 | 47 | MyApp.populateList($thingList); 48 | 49 | /************************* Event Handlers *************************/ 50 | $button.on('click', function(event) { 51 | event.preventDefault(); 52 | var $newItemText = $('#new-thing'); 53 | if($newItemText.val()) 54 | MyApp.addToList($thingList, $newItemText); 55 | }); 56 | 57 | // Hover events for each list item in the to-do list. On hovering an element, its siblings get an inactive class applied 58 | $thingList.on('mouseenter mouseleave', 'li', function(event) { 59 | if (event.type == 'mouseenter') { 60 | $(this).removeClass('inactive'); 61 | $(this).siblings().addClass('inactive'); 62 | 63 | } else if (event.type == 'mouseleave') { 64 | $(this).siblings().removeClass('inactive'); 65 | } 66 | }); 67 | 68 | $thingList.on('click', 'a.complete', function(e) { 69 | e.preventDefault(); 70 | var listItem = $(this).parent('li'); 71 | listItem.toggleClass('completed'); 72 | }); 73 | 74 | $thingList.on('click', 'a.delete', function(e) { 75 | e.preventDefault(); 76 | var $listItem = $(this).parent('li'); 77 | MyApp.removeFromList($thingList, $listItem); 78 | }); 79 | /************************* End Event Handlers *************************/ 80 | }); 81 | -------------------------------------------------------------------------------- /05-04-CRUD/starter-code/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The Bey Hive 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 39 | 40 | 41 | 42 | 43 | 50 | 51 |
        52 |
        53 |
        54 |
        Post a message for all fans of Beyonce AND Beyonce to see!
        55 |
        56 |
        57 |
        58 | 59 | 60 |
        61 | 62 |
        63 |
        64 |
        65 |
        66 | 67 |
        68 |
        69 |
        Message Board
        70 |
        71 |
          72 |
        73 |
        74 |
        75 |
        76 | 77 |
        78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /05-04-CRUD/solution-code/app.js: -------------------------------------------------------------------------------- 1 | 2 | var Message = new ParseObjectType('Message'); 3 | 4 | $(document).ready(function() { 5 | $('#message-form').submit(function(event) { 6 | // by default a form submit reloads the DOM which will subsequently reload all our JS 7 | // to avoid this we preventDefault() 8 | event.preventDefault(); 9 | // grab user message input 10 | var message = $('#message').val(); 11 | 12 | // clear message input (for UX purposes) 13 | $('#message').val(''); 14 | 15 | // create a section for messages data in your db 16 | var messageObj = { 17 | text: message, 18 | upVotes: 0 19 | }; 20 | 21 | Message.create({ text: message, upVotes: 0, downVotes: 0 }, function(err, result) { 22 | if (err) { 23 | console.error(err); 24 | } else { 25 | messageObj.objectId = result.objectId; 26 | renderMessage(messageObj); 27 | } 28 | }); 29 | }); 30 | 31 | // on initialization of app (when document is ready) get fan messages 32 | getFanMessages(); 33 | 34 | function getFanMessages() { 35 | 36 | $('.message-board').on('click', '.fa', function(e) { 37 | var $this = $(this); 38 | if ($this.hasClass('vote-up')) { 39 | updateVote($this.closest('.message')); 40 | } else if ($this.hasClass('delete')) { 41 | removePost($this.closest('.message')); 42 | } else { 43 | console.error('IDK'); 44 | } 45 | }); 46 | 47 | function removePost($messageEl) { 48 | var messageId = $messageEl.data('id'); 49 | 50 | Message.remove(messageId, function(err) { 51 | if (err) { 52 | console.error(err); 53 | } else { 54 | $('[data-id="' + messageId + '"]').remove(); 55 | } 56 | }); 57 | } 58 | 59 | function updateVote($messageEl) { 60 | var messageId = $messageEl.data('id'); 61 | var upVotes = $messageEl.data('upvotes'); 62 | 63 | upVotes += 1; 64 | 65 | Message.update(messageId, { upVotes: upVotes }, function(err, result) { 66 | if (err) { 67 | console.error(err); 68 | } else { 69 | var messageObj = { 70 | objectId: messageId, 71 | text: $messageEl.find('.message__text').html(), 72 | upVotes: upVotes 73 | }; 74 | var html = compile(messageObj); 75 | $('[data-id="' + messageId + '"]').html(html); 76 | } 77 | }); 78 | } 79 | 80 | Message.getAll(function(err, messages) { 81 | if (err) { 82 | console.error(err); 83 | } else { 84 | console.log(messages) 85 | messages.forEach(renderMessage); 86 | } 87 | }); 88 | } 89 | 90 | function renderMessage(messageData) { 91 | var html = compile(messageData); 92 | $('.message-board').append(html); 93 | } 94 | 95 | function compile(messageData) { 96 | var source = $("#message-template").html(); 97 | var template = Handlebars.compile(source); 98 | var html = template(messageData); 99 | return html; 100 | } 101 | }); 102 | -------------------------------------------------------------------------------- /04-20-lab/readme.md: -------------------------------------------------------------------------------- 1 | # ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) In-class Lab: Feedr (3:00) 2 | 3 | ## Objectives 4 | 5 | * Familiarize yourself with the API documentation news sources . 6 | * Learn how to parse through API documentation. 7 | * Understand how to successfully retrieve information from APIs. 8 | * Fork and clone your starter code. 9 | * Strategize ways to hide the loader and replace the content of the `#main` 10 | container with that of the API. 11 | * Look up other news sources that might be useful for the project. 12 | * Understand how to implement handlebars in the project (optional for the final product). 13 | 14 | ### Overview 15 | 16 | 17 | For today's class you'll be getting your Feedr project set up.Our 18 | feed reader will pull feeds from our favorite blogs. The user will be able to 19 | filter between publications through the dropdown on the header menu. 20 | Clicking/tapping on one of the articles will load a pop up with more 21 | information. The user from that point will be able to either dismiss the 22 | additional information or go to the referenced article. 23 | 24 | This will be our first single page app. All of our application views will be 25 | contained in the provided index.html file. Our task, after we pull from the 26 | respective feed APIs, will be to toggle the appropriate classes and content for 27 | the provided site architecture. 28 | 29 | You'll give the user the ability to pull from a minimum of three news sources. You can 30 | select the three provided news sources and/or add your own: 31 | 32 | - [Mashable: http://feedr-api.wdidc.org/mashable.json](http://feedr-api.wdidc.org/mashable.json) 33 | - [Reddit: https://www.reddit.com/top.json](https://www.reddit.com/top.json) 34 | - [Digg: http://feedr-api.wdidc.org/digg.json](http://feedr-api.wdidc.org/digg.json) 35 | 36 | ### Getting Started 37 | 38 | Begin by "forking" the starter code repository. You can do so by clicking the "Fork" icon on 39 | the top right of [this](https://github.com/generalassembly-studio/JS-Unit-2-Project-Starter-Code) page. Once 40 | complete, clone the repository to your computer by running the following 41 | commands: 42 | 43 | ``` 44 | git clone https://github.com//JS-Unit-2-Project-Starter-Code.git 45 | cd JS-Unit-2-Project-Starter-Code 46 | ``` 47 | 48 | Or, download the zip file - https://dl.dropbox.com/s/fot2copsfr7lk9q/JS-Unit-2-Project-Starter-Code.zip 49 | 50 | ## Suggested Ways to Get Started 51 | 52 | > Below are some more specific ways for ways in which you can get started on the project. 53 | 54 | - Start by adding all the DOM functionality first. 55 | - When the user clicks on the news source, change the innerhtml of the top link 56 | - console.log( the innerhtml of the top link) 57 | - empty out the existing articles 58 | - Map out all of the needed fields/properties from each respective feed. 59 | - Start by doing a console.log of the incoming feeds to confirm you have a 60 | successful transaction before you start mapping anything out. 61 | - Make sure you have the [JSON View chrome extension](https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en) 62 | to get a clean view of the JSON dump in your browser. 63 | - Think about ways to best standardize all of your incoming data. 64 | - Test small pieces of functionality frequently, to make sure everything is 65 | working. 66 | - Use tools such as Stack Overflow, Google and documentation resources to solve 67 | problems. 68 | 69 | --- 70 | -------------------------------------------------------------------------------- /03-23-project-1/starter_code/scripts/example.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Example scripts for you to examine and try out. 3 | # 4 | # Notes: 5 | # They are commented out by default, because most of them are pretty silly and 6 | # wouldn't be useful and amusing enough for day to day huboting. 7 | # Uncomment the ones you want to try and experiment with. 8 | # 9 | # These are from the scripting documentation: https://github.com/github/hubot/blob/master/docs/scripting.md 10 | 11 | module.exports = (robot) -> 12 | 13 | # robot.hear /badger/i, (res) -> 14 | # res.send "Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS" 15 | # 16 | # robot.respond /open the (.*) doors/i, (res) -> 17 | # doorType = res.match[1] 18 | # if doorType is "pod bay" 19 | # res.reply "I'm afraid I can't let you do that." 20 | # else 21 | # res.reply "Opening #{doorType} doors" 22 | # 23 | # robot.hear /I like pie/i, (res) -> 24 | # res.emote "makes a freshly baked pie" 25 | # 26 | # lulz = ['lol', 'rofl', 'lmao'] 27 | # 28 | # robot.respond /lulz/i, (res) -> 29 | # res.send res.random lulz 30 | # 31 | # robot.topic (res) -> 32 | # res.send "#{res.message.text}? That's a Paddlin'" 33 | # 34 | # 35 | # enterReplies = ['Hi', 'Target Acquired', 'Firing', 'Hello friend.', 'Gotcha', 'I see you'] 36 | # leaveReplies = ['Are you still there?', 'Target lost', 'Searching'] 37 | # 38 | # robot.enter (res) -> 39 | # res.send res.random enterReplies 40 | # robot.leave (res) -> 41 | # res.send res.random leaveReplies 42 | # 43 | # answer = process.env.HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING 44 | # 45 | # robot.respond /what is the answer to the ultimate question of life/, (res) -> 46 | # unless answer? 47 | # res.send "Missing HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING in environment: please set and try again" 48 | # return 49 | # res.send "#{answer}, but what is the question?" 50 | # 51 | # robot.respond /you are a little slow/, (res) -> 52 | # setTimeout () -> 53 | # res.send "Who you calling 'slow'?" 54 | # , 60 * 1000 55 | # 56 | # annoyIntervalId = null 57 | # 58 | # robot.respond /annoy me/, (res) -> 59 | # if annoyIntervalId 60 | # res.send "AAAAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEIIIIIIIIHHHHHHHHHH" 61 | # return 62 | # 63 | # res.send "Hey, want to hear the most annoying sound in the world?" 64 | # annoyIntervalId = setInterval () -> 65 | # res.send "AAAAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEIIIIIIIIHHHHHHHHHH" 66 | # , 1000 67 | # 68 | # robot.respond /unannoy me/, (res) -> 69 | # if annoyIntervalId 70 | # res.send "GUYS, GUYS, GUYS!" 71 | # clearInterval(annoyIntervalId) 72 | # annoyIntervalId = null 73 | # else 74 | # res.send "Not annoying you right now, am I?" 75 | # 76 | # 77 | # robot.router.post '/hubot/chatsecrets/:room', (req, res) -> 78 | # room = req.params.room 79 | # data = JSON.parse req.body.payload 80 | # secret = data.secret 81 | # 82 | # robot.messageRoom room, "I have a secret: #{secret}" 83 | # 84 | # res.send 'OK' 85 | # 86 | # robot.error (err, res) -> 87 | # robot.logger.error "DOES NOT COMPUTE" 88 | # 89 | # if res? 90 | # res.reply "DOES NOT COMPUTE" 91 | # 92 | # robot.respond /have a soda/i, (res) -> 93 | # # Get number of sodas had (coerced to a number). 94 | # sodasHad = robot.brain.get('totalSodas') * 1 or 0 95 | # 96 | # if sodasHad > 4 97 | # res.reply "I'm too fizzy.." 98 | # 99 | # else 100 | # res.reply 'Sure!' 101 | # 102 | # robot.brain.set 'totalSodas', sodasHad+1 103 | # 104 | # robot.respond /sleep it off/i, (res) -> 105 | # robot.brain.set 'totalSodas', 0 106 | # res.reply 'zzzzz' 107 | -------------------------------------------------------------------------------- /05-09-final-project/starter-code/client.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | if(!(localStorage.getItem("APP_ID") && localStorage.getItem("API_KEY") && localStorage.getItem("API_HOST"))){ 4 | var err = "Please set configuration vars by visiting config.html in a browser"; 5 | alert(err) 6 | } 7 | 8 | const ParseObjectType = function(objName) { 9 | const apiHost = localStorage.getItem("API_HOST"); 10 | this.headers = { 11 | 'X-Parse-Application-Id': localStorage.getItem("APP_ID"), 12 | 'X-Parse-REST-API-Key': localStorage.getItem("API_KEY"), 13 | 'Content-Type': 'application/json' 14 | } 15 | this.objName = objName; 16 | this.baseUrl = `${apiHost}/parse/classes/${objName}`; 17 | }; 18 | 19 | ParseObjectType.prototype.getAll = function(onGet) { 20 | var request = new XMLHttpRequest(); 21 | request.open("GET", this.baseUrl, true); 22 | for(var header in this.headers){ 23 | request.setRequestHeader(header, this.headers[header]); 24 | } 25 | request.send(); 26 | request.onload = function(){ 27 | if(this.status >= 200 && this.status < 400){ 28 | parseResponse(this.response, onGet); 29 | } else { 30 | onGet(this.response); 31 | } 32 | } 33 | request.onerror = function(e){ 34 | throw new Error(e); 35 | } 36 | }; 37 | 38 | ParseObjectType.prototype.get = function(id, onGet) { 39 | const requestUrl = `${this.baseUrl}/${id}`; 40 | var request = new XMLHttpRequest(); 41 | request.open("GET", requestUrl, true); 42 | for(var header in this.headers){ 43 | request.setRequestHeader(header, this.headers[header]); 44 | } 45 | request.send(); 46 | request.onload = function(){ 47 | if(this.status >= 200 && this.status < 400){ 48 | parseResponse(this.response, onGet); 49 | } else { 50 | onGet(this.response); 51 | } 52 | } 53 | request.onerror = function(e){ 54 | throw new Error(e); 55 | } 56 | }; 57 | 58 | ParseObjectType.prototype.create = function(props, onCreate) { 59 | var request = new XMLHttpRequest(); 60 | request.open("POST", this.baseUrl, true); 61 | for(var header in this.headers){ 62 | request.setRequestHeader(header, this.headers[header]); 63 | } 64 | request.send(JSON.stringify(props)); 65 | request.onload = function(){ 66 | if(this.status >= 200 && this.status < 400){ 67 | parseResponse(this.response, onCreate); 68 | } else { 69 | onCreate(this.response); 70 | } 71 | } 72 | request.onerror = function(e){ 73 | throw new Error(e); 74 | } 75 | }; 76 | 77 | ParseObjectType.prototype.update = function(objId, props, onUpdate) { 78 | var request = new XMLHttpRequest(); 79 | request.open("PUT", this.baseUrl + '/' + objId, true); 80 | for(var header in this.headers){ 81 | request.setRequestHeader(header, this.headers[header]); 82 | } 83 | request.send(JSON.stringify(props)); 84 | request.onload = function(){ 85 | if(this.status >= 200 && this.status < 400){ 86 | parseResponse(this.response, onUpdate); 87 | } else { 88 | onUpdate(this.response); 89 | } 90 | } 91 | request.onerror = function(e){ 92 | throw new Error(e); 93 | } 94 | }; 95 | 96 | ParseObjectType.prototype.remove = function(objId, onRemove) { 97 | var request = new XMLHttpRequest(); 98 | request.open("DELETE", this.baseUrl + '/' + objId, true); 99 | for(var header in this.headers){ 100 | request.setRequestHeader(header, this.headers[header]); 101 | } 102 | request.send(); 103 | request.onload = function(){ 104 | if(this.status >= 200 && this.status < 400){ 105 | onRemove(null, { message: `Successfully deleted object ${objId}` }); 106 | } else { 107 | onRemove(this.response); 108 | } 109 | } 110 | request.onerror = function(e){ 111 | throw new Error(e); 112 | } 113 | }; 114 | 115 | function parseResponse(body, callback) { 116 | try { 117 | const data = JSON.parse(body); 118 | if (data.results) { 119 | callback(null, data.results); 120 | } else { 121 | callback(null, data); 122 | } 123 | } catch(e) { 124 | console.error(e.stack); 125 | callback(Error(`An error occured while parsing response: ${e.message}`)); 126 | } 127 | } 128 | 129 | window.ParseObjectType = ParseObjectType; 130 | 131 | })(); 132 | -------------------------------------------------------------------------------- /05-04-CRUD/solution-code/client.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | if(!(localStorage.getItem("APP_ID") && localStorage.getItem("API_KEY") && localStorage.getItem("API_HOST"))){ 4 | var err = "Please set configuration vars by visiting config.html in a browser"; 5 | window.location.href = '/config.html'; 6 | } 7 | 8 | const ParseObjectType = function(objName) { 9 | const apiHost = localStorage.getItem("API_HOST"); 10 | this.headers = { 11 | 'X-Parse-Application-Id': localStorage.getItem("APP_ID"), 12 | 'X-Parse-REST-API-Key': localStorage.getItem("API_KEY"), 13 | 'Content-Type': 'application/json' 14 | } 15 | this.objName = objName; 16 | this.baseUrl = `${apiHost}/parse/classes/${objName}`; 17 | }; 18 | 19 | ParseObjectType.prototype.getAll = function(onGet) { 20 | var request = new XMLHttpRequest(); 21 | request.open("GET", this.baseUrl, true); 22 | for(var header in this.headers){ 23 | request.setRequestHeader(header, this.headers[header]); 24 | } 25 | request.send(); 26 | request.onload = function(){ 27 | if(this.status >= 200 && this.status < 400){ 28 | parseResponse(this.response, onGet); 29 | } else { 30 | onGet(this.response); 31 | } 32 | } 33 | request.onerror = function(e){ 34 | throw new Error(e); 35 | } 36 | }; 37 | 38 | ParseObjectType.prototype.get = function(id, onGet) { 39 | const requestUrl = `${this.baseUrl}/${id}`; 40 | var request = new XMLHttpRequest(); 41 | request.open("GET", requestUrl, true); 42 | for(var header in this.headers){ 43 | request.setRequestHeader(header, this.headers[header]); 44 | } 45 | request.send(); 46 | request.onload = function(){ 47 | if(this.status >= 200 && this.status < 400){ 48 | parseResponse(this.response, onGet); 49 | } else { 50 | onGet(this.response); 51 | } 52 | } 53 | request.onerror = function(e){ 54 | throw new Error(e); 55 | } 56 | }; 57 | 58 | ParseObjectType.prototype.create = function(props, onCreate) { 59 | var request = new XMLHttpRequest(); 60 | request.open("POST", this.baseUrl, true); 61 | for(var header in this.headers){ 62 | request.setRequestHeader(header, this.headers[header]); 63 | } 64 | request.send(JSON.stringify(props)); 65 | request.onload = function(){ 66 | if(this.status >= 200 && this.status < 400){ 67 | parseResponse(this.response, onCreate); 68 | } else { 69 | onCreate(this.response); 70 | } 71 | } 72 | request.onerror = function(e){ 73 | throw new Error(e); 74 | } 75 | }; 76 | 77 | ParseObjectType.prototype.update = function(objId, props, onUpdate) { 78 | var request = new XMLHttpRequest(); 79 | request.open("PUT", this.baseUrl + '/' + objId, true); 80 | for(var header in this.headers){ 81 | request.setRequestHeader(header, this.headers[header]); 82 | } 83 | request.send(JSON.stringify(props)); 84 | request.onload = function(){ 85 | if(this.status >= 200 && this.status < 400){ 86 | parseResponse(this.response, onUpdate); 87 | } else { 88 | onUpdate(this.response); 89 | } 90 | } 91 | request.onerror = function(e){ 92 | throw new Error(e); 93 | } 94 | }; 95 | 96 | ParseObjectType.prototype.remove = function(objId, onRemove) { 97 | var request = new XMLHttpRequest(); 98 | request.open("DELETE", this.baseUrl + '/' + objId, true); 99 | for(var header in this.headers){ 100 | request.setRequestHeader(header, this.headers[header]); 101 | } 102 | request.send(); 103 | request.onload = function(){ 104 | if(this.status >= 200 && this.status < 400){ 105 | onRemove(null, { message: `Successfully deleted object ${objId}` }); 106 | } else { 107 | onRemove(this.response); 108 | } 109 | } 110 | request.onerror = function(e){ 111 | throw new Error(e); 112 | } 113 | }; 114 | 115 | function parseResponse(body, callback) { 116 | try { 117 | const data = JSON.parse(body); 118 | if (data.results) { 119 | callback(null, data.results); 120 | } else { 121 | callback(null, data); 122 | } 123 | } catch(e) { 124 | console.error(e.stack); 125 | callback(Error(`An error occured while parsing response: ${e.message}`)); 126 | } 127 | } 128 | 129 | window.ParseObjectType = ParseObjectType; 130 | 131 | })(); 132 | -------------------------------------------------------------------------------- /05-09-final-project/readme.md: -------------------------------------------------------------------------------- 1 | # ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) Unit #4 Project: Final Project 2 | 3 | ### Overview 4 | 5 | For the final project, you'll be designing and building a web app of your choice. This project will test your knowledge of JavaScript and ask you to apply everything you've learned in this course. The result will be a web app that you can add to your portfolio. You could create anything from: a blog users can comment on; an app that allows users to search for social media posts; or even an application that logs users geolocations. Work with your instructor to create project goals that are realistic given the scope and timing of the class. 6 | 7 | --- 8 | 9 | ### Technical Requirements 10 | 11 | - Use JavaScript to correctly structure the code for a web application: 12 | - Structure your application to be a SPA (single page application) 13 | - Make HTTP requests to our self-hosted parse server 14 | - Make at least one HTTP request to a third-party server 15 | - CRUD functionality should be present 16 | - Use either vanilla JS or jQuery to perform DOM manipulation 17 | - Listen for events and add interactivity based on user input 18 | 19 | - Hosting 20 | - App must be hosted on GitHub Pages 21 | 22 | #### Bonus / Best Practices 23 | 24 | Your instructor will provide feedback on how well you execute best practices. Even though it is not part of the requirements, you should keep these in mind: 25 | 26 | - __Clean And Readable Code__. The instructor should be able to read and follow your code easily. Maintain clean and readable code including: consistent indentation, code commenting and use of proper and consistent naming conventions. 27 | 28 | - __Object Oriented and/or Functional__. Implement function closures, keep code modular, maintain a separation of concerns, only put code on the global scope when absolutely necessary, use prototypical inheritance. 29 | 30 | --- 31 | 32 | ### SPA Architecture 33 | 34 | Single Page Applications (SPA) are all the rage today. The single page aspect of a SPA refers to a single page coming from the server, such as our _index.html_ page. Once loaded, the SPA changes views by using _client-side_ routing, which loads partial HTML snippets called templates. Think back to our _Advanced APIs_ lesson where we showed specific views based off the login state of a user. The goal for you implementing a SPA is to not make users have to refresh the entire DOM every time they need a new piece of data to be represented in the UI. 35 | 36 | ![spa_architecture](https://cloud.githubusercontent.com/assets/25366/8970635/896c4cce-35ff-11e5-96b2-ef7e62784764.png) 37 | 38 | --- 39 | 40 | ### Necessary Deliverables 41 | 42 | * A **production ready web application**, SPA, hosted live on the web. 43 | * A **new git repository hosted on Github** where codebase is maintained. 44 | * A 5-10 minute **presentation** including 3 technical hurdles, 2 new things you learned, Q&A. 45 | 46 | --- 47 | 48 | ### Suggested Ways to Get Started 49 | 50 | - Think of a problem in the world, or even in your personal life, and apply what you've learned to build an application that can help solve the issue. 51 | - Research different social media APIs (i.e. twitter) and see what kind of information you can use from them. 52 | - Look at different online [video games](http://phaser.io/examples) for inspiration. 53 | 54 | --- 55 | 56 | ### Potential Project Ideas 57 | 58 | ##### Idea 1 59 | Movie forum site where users can post their favorite movies and rate them. 60 | 61 | ##### Idea 2 62 | Celebrity follower app that allows users to easily pull all social media data from their favorite celebrities. 63 | 64 | ##### Idea 3 65 | Friend locator site that allows users to see how far away they are from their friends. 66 | 67 | --- 68 | 69 | ### Project Feedback + Evaluation 70 | 71 | * __Technical Requirements__: Did you deliver a project that met all the technical requirements? Given what the class has covered so far, did you build something that was reasonably complex? 72 | 73 | * __Creativity__: Did you added a personal spin or creative element into your project submission? 74 | 75 | * __Code Quality__: Did you follow code style guidance and best practices covered in class, such as tab indentation, DRYness, and semantic naming? Did you comment your code? 76 | 77 | * __Problem Solving__: Are you able to defend why you implemented your solution in a certain way? 78 | 79 | * __Total__: Your instructor will give you a total score on your project between: 80 | 81 | Score | Expectations 82 | ----- | ------------ 83 | **0** | _Does not meet expectations._ 84 | **1** | _Meets expectactions, good job!_ 85 | **2** | _Exceeds expectations, you wonderful creature, you!_ -------------------------------------------------------------------------------- /05-04-CRUD/starter-code/client.js: -------------------------------------------------------------------------------- 1 | /* 2 | ==================================================== 3 | ===== HEY WHAT THE HECK ARE YOU DOING IN HERE? ===== 4 | ==================================================== 5 | 6 | If you mess something up, you're assignment code may not behave correctly. 7 | If you're feeling good about yourself and want to change something, go ahead! 8 | */ 9 | 10 | (function() { 11 | if(!(localStorage.getItem("APP_ID") && localStorage.getItem("API_KEY") && localStorage.getItem("API_HOST"))){ 12 | var err = "Please set configuration vars by visiting config.html in a browser"; 13 | window.location.href = '/config.html'; 14 | } 15 | 16 | const ParseObjectType = function(objName) { 17 | const apiHost = localStorage.getItem("API_HOST"); 18 | this.headers = { 19 | 'X-Parse-Application-Id': localStorage.getItem("APP_ID"), 20 | 'X-Parse-REST-API-Key': localStorage.getItem("API_KEY"), 21 | 'Content-Type': 'application/json' 22 | } 23 | this.objName = objName; 24 | this.baseUrl = `${apiHost}/parse/classes/${objName}`; 25 | }; 26 | 27 | ParseObjectType.prototype.getAll = function(onGet) { 28 | var request = new XMLHttpRequest(); 29 | request.open("GET", this.baseUrl, true); 30 | for(var header in this.headers){ 31 | request.setRequestHeader(header, this.headers[header]); 32 | } 33 | request.send(); 34 | request.onload = function(){ 35 | if(this.status >= 200 && this.status < 400){ 36 | parseResponse(this.response, onGet); 37 | } else { 38 | onGet(this.response); 39 | } 40 | } 41 | request.onerror = function(e){ 42 | throw new Error(e); 43 | } 44 | }; 45 | 46 | ParseObjectType.prototype.get = function(id, onGet) { 47 | const requestUrl = `${this.baseUrl}/${id}`; 48 | var request = new XMLHttpRequest(); 49 | request.open("GET", requestUrl, true); 50 | for(var header in this.headers){ 51 | request.setRequestHeader(header, this.headers[header]); 52 | } 53 | request.send(); 54 | request.onload = function(){ 55 | if(this.status >= 200 && this.status < 400){ 56 | parseResponse(this.response, onGet); 57 | } else { 58 | onGet(this.response); 59 | } 60 | } 61 | request.onerror = function(e){ 62 | throw new Error(e); 63 | } 64 | }; 65 | 66 | ParseObjectType.prototype.create = function(props, onCreate) { 67 | var request = new XMLHttpRequest(); 68 | request.open("POST", this.baseUrl, true); 69 | for(var header in this.headers){ 70 | request.setRequestHeader(header, this.headers[header]); 71 | } 72 | request.send(JSON.stringify(props)); 73 | request.onload = function(){ 74 | if(this.status >= 200 && this.status < 400){ 75 | parseResponse(this.response, onCreate); 76 | } else { 77 | onCreate(this.response); 78 | } 79 | } 80 | request.onerror = function(e){ 81 | throw new Error(e); 82 | } 83 | }; 84 | 85 | ParseObjectType.prototype.update = function(objId, props, onUpdate) { 86 | var request = new XMLHttpRequest(); 87 | request.open("PUT", this.baseUrl + '/' + objId, true); 88 | for(var header in this.headers){ 89 | request.setRequestHeader(header, this.headers[header]); 90 | } 91 | request.send(JSON.stringify(props)); 92 | request.onload = function(){ 93 | if(this.status >= 200 && this.status < 400){ 94 | parseResponse(this.response, onUpdate); 95 | } else { 96 | onUpdate(this.response); 97 | } 98 | } 99 | request.onerror = function(e){ 100 | throw new Error(e); 101 | } 102 | }; 103 | 104 | ParseObjectType.prototype.remove = function(objId, onRemove) { 105 | var request = new XMLHttpRequest(); 106 | request.open("DELETE", this.baseUrl + '/' + objId, true); 107 | for(var header in this.headers){ 108 | request.setRequestHeader(header, this.headers[header]); 109 | } 110 | request.send(); 111 | request.onload = function(){ 112 | if(this.status >= 200 && this.status < 400){ 113 | onRemove(null, { message: `Successfully deleted object ${objId}` }); 114 | } else { 115 | onRemove(this.response); 116 | } 117 | } 118 | request.onerror = function(e){ 119 | throw new Error(e); 120 | } 121 | }; 122 | 123 | function parseResponse(body, callback) { 124 | try { 125 | const data = JSON.parse(body); 126 | if (data.results) { 127 | callback(null, data.results); 128 | } else { 129 | callback(null, data); 130 | } 131 | } catch(e) { 132 | console.error(e.stack); 133 | callback(Error(`An error occured while parsing response: ${e.message}`)); 134 | } 135 | } 136 | 137 | window.ParseObjectType = ParseObjectType; 138 | })(); 139 | -------------------------------------------------------------------------------- /03-23-project-1/readme.md: -------------------------------------------------------------------------------- 1 | # ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) Unit Project #1: Slackbot 2 | 3 | ### Overview 4 | 5 | We've been using Slack to communicate with each other for the first couple weeks of the class. Now it is time to build our very own Slackbot to add a fun interactive component to the chat room. A Slackbot is an integration into slack that can either respond to specific phrases that are mentioned in Slack or they can post things from outside of slack into a channel or private conversation. There are now entire startups built on top of Slackbots. For example, people have built Slackbots that let you hail an Uber from them or schedule meetings with different members of your team (where it searches your Google Calendar). One of the most popular Slackbot's lets people post random gifs based on phrases into a channel from Giphy. 6 | 7 | For our first project, we are going to keep things simple. We will build a Slackbot on top of the popular Github bot called [Hubot](https://github.com/slackhq/hubot-slack). Hubot is a robot that was created by GitHub, that automates their company chat. Hubot can deploy their site, be a source of fun comments and also can automate a lot of their daily tasks. It is powerful, but it is also built in a way that we can build whatever we want on top of it. 8 | 9 | Hubot scripts are generally written in CoffeeScript, which is a JavaScript scripting language. They also take vanilla JavaScript, which is what we will be using. Your bot can respond to whatever you like, but should do at least 3 different things. 10 | 11 | >Instructors will need to configure Hubot integrations and generate API tokens for students to use. [Click here](https://my.slack.com/services/new/hubot) to configure a new Hubot. Once your Hubot has been configured, edit that configuration in order to access its API token. 12 | 13 | Hubot has a few basic functions: 14 | 15 | __Respond__ 16 | 17 | Using the Respond command, will search through a series of text that you give it and if it sees the text in the Slack channel, this function will execute. You can then use the Send command to post a message to the channel. 18 | 19 | __Send__ 20 | 21 | Send lets you send a message to the Slack channel. We usually use this hand-in-hand with respond. For example, when someone says something (i.e. 'Hi') on the channel, we respond by sending "Howdy". Of course, it will only send or respond based on the commands and words you teach it (by adding it to your code). 22 | 23 | __Reply__ 24 | 25 | Reply lets you reply to a certain user or to the person who sent the original message. This includes the @ in front of the user's name so they get alerted. 26 | 27 | __Random__ 28 | 29 | Hubot also has a random script which is pretty nifty so we don't need to write custom JavaScript for that. It will return a random result based on what you give it. Check out the starter code for some examples. 30 | 31 | --- 32 | 33 | ### Technical Requirements 34 | 35 | Your app must: 36 | 37 | * Have a message post to Slack based on user input 38 | * Do at least 3 different things. 39 | * One of the commands must **utilize the list of people in the class to send a direct message or reply**. 40 | * Leverage [Hubot](https://github.com/slackhq/hubot-slack) 41 | * Use at least 1 conditional to change the outcome of a Slackbot. 42 | 43 | #### Bonus 44 | 45 | * Leverage a for loop to iterate over a collection 46 | * Introduce a random component 47 | * Include an image in the response in addition to text 48 | 49 | --- 50 | 51 | ### Necessary Deliverables 52 | 53 | * A **working Slackbot, built by you**, that can be run locally. 54 | * A **new git repository hosted on Github**, where codebase is maintained. 55 | * **A ``readme.md`` file** with explanations of what your bot does, what commands it responds to, the approach taken, installation instructions, unsolved problems, etc. 56 | * A 5-10 minute **presentation** including 3 technical hurdles, 2 new things you learned, Q&A. 57 | --- 58 | 59 | ### Suggested Ways to Get Started 60 | 61 | * Review existing Slackbots and Hubots for inspiration. 62 | * Begin by writing down what your different commands will be and expected outcomes before writing any code. 63 | * Write pseudocode before writing any code. 64 | * Get Hubot working out of the box before writing any custom code. 65 | * Test small pieces of functionality frequently to make sure everything is working. 66 | * Use tools such as Stack Overflow, Google and documentation resources to solve problems. 67 | 68 | --- 69 | 70 | ### Potential Project Ideas 71 | 72 | ##### Class today 73 | Ask your bot whether we have class today or not. Use JavaScript to check today's date and then respond back with whether we have class or not. 74 | 75 | ##### Random quote 76 | Use an array to store a number of your favorite quotes. When you ping your bot, have it return a random quote from your list. 77 | 78 | --- 79 | 80 | ### Useful Resources 81 | 82 | * How to set up! - https://vimeo.com/159850260 83 | 84 | Key Resources 85 | * [Hubot Slack](https://github.com/slackhq/hubot-slack) 86 | * [Slack API Documentation](https://api.slack.com/bot-users) 87 | 88 | Examples 89 | * [Hubot Ship It](https://github.com/hubot-scripts/hubot-shipit) 90 | * [Slackbot Community](https://api.slack.com/community) 91 | * [Hubot scripts](https://github.com/github/hubot-scripts) 92 | 93 | Advanced Reading 94 | * [Great in-depth tutorial on writing a Slackbot](http://www.michikono.com/2015/07/10/in-depth-tutorial-on-writing-a-slackbot/) 95 | * [Hubot scripts explained](http://theprogrammingbutler.com/blog/archives/2011/10/28/hubot-scripts-explained/) 96 | * [Create your own chatbot with Hubot & Coffeescript](http://www.slideshare.net/rscaduto/hubot-talk) 97 | * [Getting Started with Slackbots](http://www.sitepoint.com/getting-started-slack-bots/) 98 | 99 | --- 100 | 101 | ### Project Feedback + Evaluation 102 | 103 | Students will create a new repository on GitHub called "my-first-slackbot" and push their code to this new repository when they are ready to submit. 104 | 105 | The instructional team will grade each technical requirement and provide a numeric grade on a scale. 106 | 107 | * __Technical Requirements__: Did you deliver a project that met all the technical requirements? Given what the class has covered so far, did you build something that was reasonably complex? 108 | 109 | * __Creativity__: Did you added a personal spin or creative element into your project submission? Did you deliver something of value to the end user (not just a hello world response)? 110 | 111 | * __Code Quality__: Did you follow code style guidance and best practices covered in class, such as spacing, modularity, and semantic naming? Did you comment your code as your instructors have in class? 112 | 113 | * __Total__: Your instructors will give you a total score on your project between: 114 | 115 | Score | Expectations 116 | ----- | ------------ 117 | **0** | _Does not meet expectations._ 118 | **1** | _Meets expectactions, good job!_ 119 | **2** | _Exceeds expectations, you wonderful creature, you!_ 120 | 121 | This will serve as a helpful overall gauge of whether you met the project goals, but __the more important scores are the individual ones__ above, which can help you identify where to focus your efforts for the next project! 122 | -------------------------------------------------------------------------------- /03-07-installfest/brew-git-node-atom/readme.md: -------------------------------------------------------------------------------- 1 | #### Mac OS X 2 | 3 | 1. __Install Brew__ 4 | 5 | Brew is a package manager that we use to install various command line applications to your computer. 6 | 7 | Open your terminal (`Applications > Utilities > Terminal`), paste the following command, and then hit enter: 8 | 9 | ```bash 10 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 11 | ``` 12 | 13 | 2. __Install Git__ 14 | 15 | Git is a tool used to track the state of your code over time. 16 | [GitHub](https://github.com) is a company that has made a business on top of 17 | the Git technology. We will be using both Git and GitHub in this class to distribute 18 | code, submit assignments and offer feedback. 19 | 20 | Once brew is installed, it's easy to install command line applications. The 21 | following command can be entered to install Git: 22 | 23 | ```bash 24 | brew install git 25 | ``` 26 | 27 | 3. __Configure Git__ 28 | 29 | Please copy and paste the following two commands (separately) into your 30 | terminal. You'll want to replace the name and email address values with your 31 | own. 32 | 33 | ```bash 34 | git config --global user.name "Steve Jobs" 35 | git config --global user.email "steve@apple.com" 36 | ``` 37 | 38 | 4. __Install Node__ 39 | 40 | Next up is installing Node.js. The best way to install it is from the package installer on their [website](https://nodejs.org/en/). Follow the steps to get it set up. 41 | 42 | 5. __Make sure NPM is updated__ 43 | 44 | Node has a handy package manager that we will use frequently in our class. It comes with Node, but NPM is updated more frequently and we want to have the right one. 45 | 46 | ```bash 47 | npm install npm -g 48 | ``` 49 | 50 | 6. __Install Atom__ 51 | 52 | [Atom](http://atom.io) - you are free to use any code editor that you are comfortable with. Another popular choice is Sublime Text and can be found [here](http://www.sublimetext.com/3). 53 | 54 | Once complete, please raise your hand and ask a member of the instructional team to verify that the installation was successful. 55 | 56 | #### Windows 57 | 58 | 2. __Install Git__ 59 | 60 | Git is a tool used to track the state of your code over time. 61 | [GitHub](https://github.com) is a company that has made a business on top of 62 | the Git technology. We will be using both Git and GitHub in this class to distribute 63 | code, submit assignments and offer feedback. 64 | 65 | Git can be downloaded and installed from 66 | [this](https://git-scm.com/download/win) URL. 67 | 68 | 3. __Configure Git__ 69 | 70 | In order to interact with Git, you'll need to first open the Git Bash utility. 71 | A quick way to access this terminal is by right clicking your desktop and 72 | choosing "Git Bash". 73 | 74 | Please copy and paste the following two commands (separately) into your 75 | terminal. You'll want to replace the name and email address values with your 76 | own. 77 | 78 | ```bash 79 | git config --global user.name "Steve Jobs" 80 | git config --global user.email "steve@apple.com" 81 | ``` 82 | 83 | 3. __Install Node__ 84 | 85 | Next up is installing Node.js. The best way to install it is from the package installer on their [website](https://nodejs.org/en/). Follow the steps to get it set up. 86 | 87 | 4. __Install Atom__ 88 | 89 | Atom can be found [here](http://atom.io), but you are free to use any code editor that you are comfortable with. Another popular choice is [Sublime Text](http://www.sublimetext.com/3). 90 | 91 | Once complete, please raise your hand and ask a member of the instructional team to verify that the installation was successful. 92 | 93 | #### Linux (Ubuntu) 94 | 95 | 1. __Install Git__ 96 | 97 | Git is a tool used to track the state of your code over time. 98 | [GitHub](https://github.com) is a company that has made a business on top of 99 | the Git technology. We will be using both Git and GitHub in this class to distribute 100 | code, submit assignments and offer feedback. 101 | 102 | Git can be installed by running the following command: 103 | 104 | ```bash 105 | sudo apt-get install build-essential git-core curl 106 | ``` 107 | 108 | 2. __Configure Git__ 109 | 110 | Please copy and paste the following two commands (separately) into your 111 | terminal. You'll want to replace the name and email address values with your 112 | own. 113 | 114 | ```bash 115 | git config --global user.name "Steve Jobs" 116 | git config --global user.email "steve@apple.com" 117 | ``` 118 | 119 | 3. __Install Node.js__ 120 | 121 | ```bash 122 | curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash - 123 | sudo apt-get install --yes nodejs 124 | apt-get install --yes build-essential 125 | ``` 126 | 127 | 4. __Installing Atom__ 128 | 129 | [Atom](http://atom.io). 130 | 131 | ### Helpful Debugging Tips 132 | 133 | __Error installing due to permissions__ 134 | 135 | It is common when you are installing things on the terminal to run into permissions issues. In order to install command line utilities, you will need to be signed into a user account on your computer that has administrator-level rights. If you have trouble with this, please ask a member of the instructional team for help. 136 | 137 | __Google is your friend__ 138 | 139 | Even experienced programmers Google error messages. If you have an error, there is a very high likelihood that someone else had the error as well. Copy and paste the error message you received into Google. A good reference site is StackOverflow. Make sure to remove any reference to your computer since that will be unique to you. Try to hone in on just the error message itself. 140 | 141 | 142 | >__Common Issues and Fixes:__ 143 | 144 | >The following remedies are recommended in order to help resolve common issues that might arise during the installation of command line utilities: 145 | 146 | >* Some students with Macs may experience an issue where the outdated version of Git that was installed with Xcode is given precedence in the terminal. These students will need to adjust their shell path by following the instructions under "Trumping Xcode's Older Git" [in this article](http://coolestguidesontheplanet.com/install-update-latest-version-git-mac-osx-10-9-mavericks/). 147 | 148 | >* Students with Macs running OS 10.11 and later may need to [disable the System Integrity Protection](http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/) on their machine before installing certain command line utilities. 149 | 150 | >* Students who run into an EACCES error, should change directory permissions to install Node and npm without having to use sudo: 151 | `sudo chown -R $(whoami) /usr/local/lib/node_modules` 152 | 153 | >* Students who have previously installed Homebrew on their machines will likely want to run `brew update` in order to update Homebrew to the latest version. 154 | 155 | >* Students who need to update their installations of npm can run `npm install -g npm`. 156 | 157 | >* Students with an existing, outdated installation of Node should be able to update their install by following the directions above (i.e. using the package installer). 158 | -------------------------------------------------------------------------------- /05-04-CRUD/readme.md: -------------------------------------------------------------------------------- 1 | ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) 2 | 3 | #Intro to CRUD (3:00) 4 | 5 | 6 | ### Objectives 7 | 8 | _After this lesson, students will be able to:_ 9 | 10 | - Explain what CRUD is. 11 | - Explain the HTTP methods associated with CRUD. 12 | - Build a basic CRUD front end app 13 | 14 | ### Preparation 15 | 16 | _Before this lesson, students should already be able to:_ 17 | 18 | - Identify all the HTTP Verbs & their uses. 19 | - Describe APIs & how to make calls and consume API data. 20 | 21 | --- 22 | 23 | 24 | ## Introduction to CRUD and Parse (10 min) 25 | 26 | In terms of an app's functionality, in general, most app's share the purpose of being able to show, create, update and delete data. For example, with Instagram a user is allowed to create and show data by uploading pictures with captions and share them with all their followers to see. Further, if the user wanted to go back and update the data, say they wanted to change the caption, they could do so by editing the caption or they could even delete all the data by removing the entire post. Similarly, with Tumblr, users can create posts they wish to share which they can edit later or even delete entirely. Being made aware of this pattern in apps can you name two or more apps and how they go about performing this functionality? 27 | 28 | This common app functionality dealing with data is known as CRUD (Create, Read, Update and Delete). For today's lesson we will not only become familiar with this concept, but learn how to implement it with the help of a back-end service known as Parse as we build out our very own CRUD application. 29 | 30 | --- 31 | 32 | 33 | ## A Little Review...A Lotta CRUD (20 min) 34 | 35 | Even though we have never explicitly covered the term CRUD in this course, we have covered some of the technical implementations of performing CRUD. Can you think of what we have learned in an earlier lesson that relates to an application's ability to create, read, update and delete data? If it is not apparent as of yet, take a step back to think about what we know is needed in order to "play" with data. If the term API comes to mind you're on the right track. Using our _Advanced APIs_ lesson as an example, when we wanted to get Instagram post data, we had to ping one of Instagram's API endpoints to do so. But how exactly did we go about communicating with Instagram's endpoint? Herein lies the answer to our original question of what technical feature we have already learned which is related to CRUD, and that is _HTTP_. 36 | 37 | When developing an application that deals with data, a developer must be able to communicate with the application program interface (API) using various HTTP methods. To better understand how the different HTTP methods we already know perform CRUD checkout at the following table: 38 | 39 | |HTTP Method|CRUD|Further explanation| 40 | |:---|:-----|:-----| 41 | |POST| Create|Most-often utilized to _create_ new resources. On successful creation returns a 201 status code. 42 | |GET| Read|The HTTP GET method is used to _read_ a representation of a resource. Upon success, returns data in the form of XML or JSON with a 200 status code. Upon failure, often returns a 404 or 400. 43 | |PUT| Update|Most often utilized to for _update_ capabilities. Upon successful update, often returns a 200 or 204. 44 | |DELETE| Delete|Used to _delete_ a resources. Upon successful deletion, most often returns a 200 status code. 45 | 46 | --- 47 | 48 | 49 | ## Understand CRUD Through Public APIs (15 min) 50 | 51 | Now that you have an understanding of what CRUD is and how HTTP methods help you implement it, spend the next 15 minutes with a partner researching two of the following APIs to see what HTTP methods a developer must use to perform at least one instance of create, read, update and destroy. Further, you must define what exactly is being created, read, updated or deleted. For example, for Facebook what HTTP method on what endpoint must you ping in order to create a post in a feed? 52 | 53 | API options: 54 | 55 | - Facebook 56 | - Instagram 57 | - Twitter 58 | 59 | > **Note:** Certain APIs may not allow for full CRUD functionality. If you're researching one of these APIs be sure to point out its limitations. 60 | 61 | --- 62 | 63 | 64 | ## Back-end Service (10 min) 65 | 66 | So far in this course we have covered how to consume data from third-party APIs, but have not yet created our own API. The work that we have been doing is what is known in the tech industry as client-side or _front-end_ development. 67 | 68 | > Front end development, also known as client side development is the practice of producing HTML, CSS and JavaScript for a website or web application so that a user can see and interact with them directly. 69 | 70 | > -wikipedia 71 | 72 | The process of actually creating the API, not consuming it, is what is known as _back-end_ development. You can think of back-end code as all the code living on the server-side, the code that app users never interact with directly. It is the "non-HTML-CSS-JavaScript" code. 73 | 74 | Even though we don't have all the skills needed to roll out our own fully custom back-end, today we are going to learn how to use Parse, a back-end as a service (BEaaS), to help us create our very own API! 75 | 76 | Parse serves as the entire back-end of an application, meaning its biggest features include working as a database for your app as well as providing you with a Javascript library to interact with said database. It's truly a great tool for designers/front-end developers that are either not familiar or don’t want to deal with building out the back-end. Sometimes you just want to quickly prototype and focus on your UX! 77 | 78 | --- 79 | 80 | 81 | ## GA Parse Server (35 min) 82 | 83 | We've created a very simple JS library which will communicate with a backend server. 84 | 85 | ![it's alive](https://media.giphy.com/media/d3Kq5w84bzlBLVDO/giphy.gif) 86 | 87 | --- 88 | 89 | 90 | 91 | ## Create 92 | 93 | The first part of CRUD we'll be covering is _C_, create. 94 | 95 | ```javascript 96 | // ParseObjectType is a global function that allows you to create new object types! 97 | var Vehicle = new ParseObjectType('Vehicle'); 98 | 99 | // now you need to define some properties for the car 100 | var props = { wheelCount: 4 }; 101 | 102 | // now just call .create and pass in the props! 103 | Vehicle.create(props, function(err, result) { 104 | // if an error exists, read it in the console 105 | if (err) { 106 | console.log(err); 107 | } else { 108 | // otherwise, you'll get a result with the new object and an assigned objectId 109 | console.log(result); // { wheelCount: 4, objectId: '10iedlfd' } 110 | } 111 | }) 112 | ``` 113 | 114 | 115 | --- 116 | 117 | 118 | ## Get 119 | 120 | Now that we see how we can _create_ objects, how can we get objects? 121 | 122 | ```javascript 123 | // Once we have an object's 'objectId', we can fetch that object based on it! 124 | Vehicle.get(objectId, function(err, car) { 125 | // check for error 126 | 127 | // if there's no error, take a look at the vehicle object 128 | console.log(car); // { wheelCount: 4, objectId } 129 | }); 130 | ``` 131 | 132 | ## Get All 133 | 134 | ```javascript 135 | // Once we have an object's 'objectId', we can fetch that object based on it! 136 | Vehicle.getAll(function(err, allCars) { 137 | // check for error 138 | 139 | console.log(allCars); 140 | }); 141 | ``` 142 | 143 | --- 144 | 145 | 146 | ## Update 147 | 148 | ```js 149 | // Having the objectId also allows us to update an object 150 | Vehicle.update(objectId, { wheelCount: 2 }, function(err, result) { 151 | // check for the error 152 | 153 | console.log(result); // { updatedAt: 'some date string' } 154 | }); 155 | ``` 156 | 157 | --- 158 | 159 | 160 | ## Delete 161 | 162 | ```javascript 163 | // and to delete, use the remove() method 164 | 165 | Vehicle.remove(objectId, function(err){ 166 | // check for err 167 | 168 | // if there is no error, the object was successfully removed 169 | }) 170 | ``` 171 | 172 | --- 173 | 174 | 175 | ## Conclusion (5 min) 176 | 177 | - What does CRUD stand for? 178 | - What HTTP methods are associated with C, R, U and D? 179 | - What is a BEaaS? 180 | - Do all apps have CRUD? 181 | - How would you explain the front-end vs. the back-end to a fellow developer? 182 | 183 | ### Before Next Class 184 | | | | 185 | |---|---| 186 | | **UPCOMING PROJECTS** | [Project 3: Final Project](../../projects/unit4) | 187 | --------------------------------------------------------------------------------