From b598185e2184fe1e176e7bb0e74222c780a3541a Mon Sep 17 00:00:00 2001 From: Thom Page Date: Wed, 25 May 2016 16:26:35 -0400 Subject: [PATCH] stuff --- .../bubble_sort/bubble_sort.md | 15 +++ ...ject_constructors_iteration_walkthrough.md | 16 ++++ .../homework/to_do_starter/css/style.css | 48 ++++++++++ .../w03d04/homework/to_do_starter/index.html | 31 +++++++ .../homework/to_do_starter/instructions.md | 93 +++++++++++++++++++ .../w03d04/homework/to_do_starter/js/app.js | 2 + 6 files changed, 205 insertions(+) create mode 100644 unit_01/w03d04/homework/object_constructors_iteration_walkthrough.md create mode 100644 unit_01/w03d04/homework/to_do_starter/css/style.css create mode 100644 unit_01/w03d04/homework/to_do_starter/index.html create mode 100644 unit_01/w03d04/homework/to_do_starter/instructions.md create mode 100644 unit_01/w03d04/homework/to_do_starter/js/app.js diff --git a/morning_exercise_resources/bubble_sort/bubble_sort.md b/morning_exercise_resources/bubble_sort/bubble_sort.md index 4892b88..afe833c 100644 --- a/morning_exercise_resources/bubble_sort/bubble_sort.md +++ b/morning_exercise_resources/bubble_sort/bubble_sort.md @@ -1,3 +1,18 @@ +![ga](http://mobbook.generalassemb.ly/ga_cog.png) + +# WDI-PANTHALASSA + +--- +Title: Bubble Sort
+Type: Exercise
+Creator: + Thom Page
+ Course: WDIr-Panthalassa
+Competencies: While loops, for loops, conditionals, functions, nested loops
+ +--- + + # BUBBLE SORT #### .. and nested loops diff --git a/unit_01/w03d04/homework/object_constructors_iteration_walkthrough.md b/unit_01/w03d04/homework/object_constructors_iteration_walkthrough.md new file mode 100644 index 0000000..884d1ef --- /dev/null +++ b/unit_01/w03d04/homework/object_constructors_iteration_walkthrough.md @@ -0,0 +1,16 @@ +### Object Constructors and Iteration, Walkthrough + + +1. Make an array called `fearNames` and put in five strings of technical fear names, eg. "Deipnophobia". + +2. Make an array called 'fearDescriptions' and put in five descriptions that match the fears in `fearNames`. If "Deipnophobia" comes first in `fearNames`, the description for it: "An abnormal fear of dining and dinner conversation." comes first in `fearDescriptions`. + +3. Make an object constructor function called `Fear`. A Fear will take two parameters, `name` and `description`. The properties of a Fear will use the `this` keyword. + +4. Make an empty array called `fearObjects`. + +5. Using a for loop, iterate over the `fearNames` array. Use the keyword `new` to make a new Fear object and push that newly constructed Fear into `fearObjects`. A new Fear should have both a name and a description from the `fearNames` and `fearDescriptions` arrays. (You do not need a nested loop). + +6. console.log the `fearObjects` array. You should see five Fear objects each with the applicable name and description. + +7. That's it. You did it. That's ... yeah it's over. You generated many objects using an object constructor function by means of iteration. \ No newline at end of file diff --git a/unit_01/w03d04/homework/to_do_starter/css/style.css b/unit_01/w03d04/homework/to_do_starter/css/style.css new file mode 100644 index 0000000..8e0ae8c --- /dev/null +++ b/unit_01/w03d04/homework/to_do_starter/css/style.css @@ -0,0 +1,48 @@ +/*uncomment to see div layout*/ +/*div { + border: 1px solid firebrick; +}*/ + +body { + font-family: monospace; +} + +#container { + width: 800px; height: 730px; + margin: 0 auto; +} + +#header { + text-align: center; +} + +#input-container { + text-align: center; +} + +#input-box { + height: 30px; width: 300px; +} + +#submit { + height: 30px; width: 100px; + border: none; + background-color: firebrick; + color: white; +} + +#to-do-list, #completed { + display: inline-block; + margin-left: 10px; + margin-top: 10px; + text-align: center; +} + +#to-do-list { + width: 380px; height: 600px; +} + +#completed { + width: 380px; height: 600px; +} + diff --git a/unit_01/w03d04/homework/to_do_starter/index.html b/unit_01/w03d04/homework/to_do_starter/index.html new file mode 100644 index 0000000..898bf19 --- /dev/null +++ b/unit_01/w03d04/homework/to_do_starter/index.html @@ -0,0 +1,31 @@ + + + To Do + + + + +
+ + + +
+ + +
+ +
+

things to do

+
+ +
+

things that are done

+
+ +
+ + + + \ No newline at end of file diff --git a/unit_01/w03d04/homework/to_do_starter/instructions.md b/unit_01/w03d04/homework/to_do_starter/instructions.md new file mode 100644 index 0000000..2c0ad5d --- /dev/null +++ b/unit_01/w03d04/homework/to_do_starter/instructions.md @@ -0,0 +1,93 @@ +# WHAT TO DO ? + +![nothing](http://www.likecool.com/Gear/Pic/Nothing%20to%20do/Nothing-to-do.jpg) + + +## To-Do List +Build a To-Do list app with two columns: one for things to do, and another for things that have been done. Use jQuery to give your app functionality. + +### Starter code +To get straight to the jQuery portion of the homework, feel free to use the starter code and fill in the javascript. You can make the page look nice afterwards. If you don't want to use the starter code and want to practise page layout, or just layout your own to do app from scratch, that's cool too, but it will take more time. Budget accordingly! + +### User Stories + +#####In the starter code: +1. the user should see two columns and an input field. +2. the user should be able to type a to-do item into an input box. +3. the user should be able to click an `add` button next to this input. + +##### Stuff for you to do: +1. When the user clicks the `add` button, the input box value should be added to his/her to-do list. +3. The user should be able to see all of the todos that they have created. +5. The user should be able to click 'done' on a todo and have it move to the completed column. +4. The user should be able to delete a to-do item from the completed list. + +Hint: jQuery has a useful function that gets whatever the user typed into the input box called `.val()`. + + +### General Flow + +First, add the jQuery library to your project. Go to https://code.jquery.com/ and copy the url of a minified jQuery. Use this url in a script tag. Alternatively, go to https://cdnjs.com/ and search for jQuery. + +Include any code that affects the DOM inside a window onload. jQuery has a shorthand for window onload: + +``` +$(function() { + + // DOM stuff + +}) +``` + +Try it out. + +Remember the general flow of what is happening. The user makes an action, you run some code in order to process this action, the results of the action are rendered to the page, and then you wait until another action takes place. + +### Make it look pretty +Use the CSS knowledge that you've gained over the past few weeks. In addition, think about icons or elements that you can use. + + +### jQuery cheat sheet examples + +- this: `$(this)` + +- create element: `$('
')`, `$('

')`, etc. + +- select all elements of type: `$('div')`, `$('p')`, etc. + +- ^^ The two commands above are very similar but they do completely different things! + +- you can get the body of the document with: `$('body')` + +- get element by id: `$('#idName')` + +- get elements by class: `$('.className')` + +- set id on element: `jQueryElement.attr('id', 'idName')` + +- set class on element `jQueryElement.addClass('className')` + +- click listener: `jQueryElement.click( function )` + +- get value from input box after click: `$('#idName').val()` + +- append elements: `jQueryElement.append( //stuff )` + +- prepend elements: `jQueryElement.prepend( // stuff )` + +- remove elements: `jQueryElement.remove()` + +- set text inside element: `jQueryElement.text("some text")` + +- set html inside element: `jQueryElement.html("")` + +- check if element has a class: `jQueryElement.hassClass('.someClass')` + +- set a css property on an element: `jQueryElement.css('property', 'value')` + + + + + +### Super Super Bonus +The browser has something called [local storage](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage). This allows us to cache data in the browser. Using local storage, make this application remember the to-dos that have already been entered in, even if the page is closed. \ No newline at end of file diff --git a/unit_01/w03d04/homework/to_do_starter/js/app.js b/unit_01/w03d04/homework/to_do_starter/js/app.js new file mode 100644 index 0000000..86b0c5c --- /dev/null +++ b/unit_01/w03d04/homework/to_do_starter/js/app.js @@ -0,0 +1,2 @@ +console.log('app.js'); +