diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..6c589c2f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,61 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +.netlify +dist/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 6e2e53564..f7a55df12 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,10 @@ { + "editor.formatOnSave": true, + "editor.formatOnType": true, + "editor.formatOnPaste": true, + "editor.detectIndentation": false, + "editor.tabSize": 2, "cSpell.words": [ - "orgs", - "repos" + "tabindex" ] } \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..79285a5eb --- /dev/null +++ b/LICENSE @@ -0,0 +1,3 @@ +This work is licensed under the Creative Commons Attribution 4.0 International License. +To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ +or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. \ No newline at end of file diff --git a/README.md b/README.md index f4e140762..fa97dad57 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Here you can find course content and homework for the JavaScript3 modules |----|-----|----|--------| |1.|• Structure for a basic SPA (Single Page Application)
• [XMLHttpRequests](../../../fundamentals/blob/master/fundamentals/XMLHttpRequest.md)
• API calls|[Reading Week 1](/Week1/README.md)|[Homework Week 1](/Week1/MAKEME.md)| |2.|• [Event Loop (order of execution)](../../../fundamentals/blob/master/fundamentals/event_loop.md)
• [Promises](../../../fundamentals/blob/master/fundamentals/promises.md)|[Reading Week 2](/Week2/README.md)|[Homework Week 2](/Week2/MAKEME.md)| -|3.|• [try...catch](../../../fundamentals/blob/master/fundamentals/try_catch.md)
• [async/await](../../../fundamentals/blob/master/fundamentals/async_await.md)
• [Object Oriented Programming and ES6 Classes](../../../fundamentals/blob/master/fundamentals/oop_classes.md)
• [The `this` keyword](../../../fundamentals/blob/master/fundamentals/this.md)
• call, apply, bind |[Reading Week 3](/Week3/README.md)|[Homework Week 3](/Week3/MAKEME.md)| +|3.|• [try...catch](../../../fundamentals/blob/master/fundamentals/try_catch.md)
• [async/await](../../../fundamentals/blob/master/fundamentals/async_await.md)
• [The `this` keyword](../../../fundamentals/blob/master/fundamentals/this.md)
• call, apply, bind
• [Object Oriented Programming and ES6 Classes](../../../fundamentals/blob/master/fundamentals/oop_classes.md)|[Reading Week 3](/Week3/README.md)|[Homework Week 3](/Week3/MAKEME.md)| __Kind note:__ @@ -19,3 +19,5 @@ We expect you to __always__ come prepared to the class on Sunday. A good understanding of all the above mentioned topics. Want to check your Knowledge? Go through the [JavaScript Fundamentals README](../../../fundamentals/blob/master/README.md) and research/ ask for help (Slack!) with the concepts that are not entirely clear. *The HackYourFuture curriculum is subject to CC BY copyright. This means you can freely use our materials, but just make sure to give us credit for it :)* + +Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/Week1/MAKEME.md b/Week1/MAKEME.md index a1c527078..f6bd345b6 100644 --- a/Week1/MAKEME.md +++ b/Week1/MAKEME.md @@ -7,108 +7,219 @@ Topics discussed this week: • API calls ``` - >[Here](/Week3/README.md) you find the readings you have to complete before the ninth lecture. ## Step 1: Feedback -_Deadline Monday_ - -Please provide feedback in an issue. - -_Deadline Monday_ +**_Deadline Monday_** -## Step 2: FINISH ALL YOUR JAVASCRIPT HOMEWORK +Please provide feedback on last week's homework from a fellow student as a GitHub issue. -_Deadline Saturday_ +## Step 2: Single Page Application :sweat_drops: -:point_up: +**_Deadline Thursday_** -## Step 3: SPA :sweat_drops: +_This homework is more extensive and challenging than previous homework! Please read the instructions below carefully and follow them with great attention to detail. Start this homework as soon as you can and allow time for discussion and questions (slack!)._ -_Deadline Saturday_ +### 2.1 Introduction -You are going to write a SPA (Single Page Application) that uses the [GitHub API](https://developer.github.com/guides/getting-started/). +You are going to write a _Single Page Application_ (SPA) that uses the [GitHub API](https://developer.github.com/guides/getting-started/). -This application should display information about the available [HYF repositories](https://github.com/hackyourfuture): +This application should display information about the available [HYF GitHub repositories](https://github.com/hackyourfuture). The functionalities we would like to see in your application are as follows: -- You should be able to select a repository from a list of available repositories. +- The user should be able to select a repository from a list of available repositories. - The application should display high-level information about the selected repository and show a list of its contributors. +- When clicking on the name of the selected repository the GitHub page for the corresponding repository should be opened in a new browser tab. +- When clicking on a contributor, the GitHub page for the contributor should be opened in a new browser tab. Figure 1 below shows an example of what your application could look like. Note that this is just an example. If you find it boring or unimaginative, please improve on it! On the other hand, a simpler version is OK too, so long as you implement the expected functionality. ![UI Example](./assets/hyf-github.png) -Figure 1. Example User Interface using [Material Design](https://material.io/guidelines/) principles. +Figure 1. Example User Interface using [Material Design](https://material.io/guidelines/) principles. -### Instructions +A live version of this application can be found here: http://hyf-github.netlify.com/ -1. Create this application in the `week1` folder of your `hyf-javascript1` repo. Your application should at minimum consist of the files `index.html`, `style.css` and `app.js`. -2. Your `index.html` file should load the `style.css` and `app.js` files, using the appropriate HTML tags. -3. The `body` of your `index.html` should contain a single `div` element like this: `
`. -4. All other HTML elements should be generated programmatically by your `app.js` file and ultimately be hanging off the root `div` element. -5. Implement the repository selection list by means of an HTML [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select) element. +### 2.2 The GitHub API -You will need to use XMLHttpRequests against the GitHub API to get the relevant information. The GitHub API documentation is very extensive. An overview is given [here](https://developer.github.com/v3/) but we will point you to the relevant sections in the documentation needed for this assignment. +#### 2.2.1 Get a list of HYF repositories -#### List of repositories - -You can obtain a list of HYF repositories through this API endpoint ([What is an API Endpoint?](https://teamtreehouse.com/community/what-is-an-api-endpoint)): +You can fetch a list of HYF repositories through this API endpoint ([What is an API Endpoint?](https://teamtreehouse.com/community/what-is-an-api-endpoint)): ``` https://api.github.com/orgs/HackYourFuture/repos?per_page=100 ``` -GitHub API documentation: [List organization repositories](https://developer.github.com/v3/repos/#list-organization-repositories) +If you open this URL in the browser (_try it!_) you will receive JSON data about the available HYF repositories. This is the data that you will need to work with in this assignment. + +Note the query string `?per_page=100` in the above URL. If you don't specify this query string you will only get the first 30 repositories (the default `per_page` is 30). HackYourFuture has more than 30 repositories but less than 100. + +The returned JSON data contains some basic information about each repository, such as `name`, `full_name`, `description` etc. There are also many properties that contain URLs that can be used to obtain detail information about certain aspects of the repository. + +#### 2.2.2 Get contributor information for a repository + +The JSON data that is returned from the initial request to get repository information includes a property named `contributors_url`. Use the value of this property to fetch a list of contributors. + +#### 2.2.3 GitHub API documentation + +You can find detailed information about the GitHub API by means of the link listed below. However, the documentation is very extensive and not easy to digest. For this homework it is not necessary to study the GitHub API documentation. We provide the link here for completeness. + +> GitHub API documentation: https://developer.github.com/v3/ + +### 2.3 Preparation + +You will be working on this same application during the next three weeks. For each week you will need to create a new Git branch, as listed in the Table 1 below. + +| Week | Branch | Assignment | +|:----:|--------|------------| +| 1 | `week1` | Create a basic application using callbacks to handle network requests. | +| 2 | `week2` | - Refactor the callbacks to promises.
- Make the UI responsive.| +| 3 | `week3` | - Refactor the application to use ES6 Classes and async/await.
- Make the app ARIA-compliant. | + +Table 1. Homework schedule + +**Instructions** + +1. Fork the JavaScript3 repository (_this repository_) to your own GitHub account. +2. Clone the fork to your laptop. +3. Open the `homework` folder inside the cloned repository in VSCode. +4. Create a new branch for the week 1 homework with the following command: + + ``` + git checkout -b week1 + ``` + +### 2.4 Code Overview + +The files that make up the application are located in the `src` folder. It contains the following files: + +| Filename | Description | +|------------------|-------------| +| ~~`App.js`~~ | Not used in week 1 and 2. | +| ~~`Contributor.js`~~ | Not used in week 1 and 2. | +| `hyf.png` | Contains the HackYourFuture logo. | +| `index.html` | The application's HTML file. | +| `index.js` | A starter JavaScript file. | +| ~~`Repository.js`~~ | Not used in week 1 and 2. | +| `style.css` | A starter CSS file. | +| ~~`Util.js`~~ | Not used in week 1 and 2. | + +In week 1, you should only modify `index.js` and `style.css`. + +_**Do not modify any other files at this time!**_ -Note the query string `?per_page=100`. If you don't specify this query string you will only get the first 30 repositories (the default `per_page` is 30 and HYF has more than 30 - but less than 100). +#### 2.4.1 A first examination -#### Get contributor information +1. Open `index.html` and examine its contents (but don't modify anything). Notice that the HTML `body` looks like this: -The response object that is returned by GitHub from the request to get repository information includes a property with the `contributors_url`. Use the value of this property to make a new request to GitHub to obtain a list of contributors. + ```html + +
+ + + ``` -In the lecture we developed some utility functions to simplify making XMLHttpRequests (function `fetchJSON()`) and creating and manipulating HTML elements (function `createAndAppend()`). You are free to copy and use these utility functions, but if you do we expect that you can explain how they work. + The `body` tag contains a single `div` to which you will need to dynamically append HTML elements through your JavaScript code in `index.js`. -### Refinements +2. Open `index.js`. This file contains a starter set of code for you to expand. It contains the following three functions: -- Make all the repositories link to their own page in GitHub. Use the value of the key: `name` to make this work (hint: GitHub urls always look like this https://api.github.com/repos/HackYourFuture/[repositoryName] where [repositoryName] would be replaced by the actual `name` of the repository, for example `CommandLine`). -- Make sure the link opens in a new tab. + | Function | Description | + |----------|-------------| + | `fetchJSON` | Uses `XMLHttpRequest` to fetch JSON data from an API end point. This function uses an asynchronous callback. | + | `createAndAppend` | A utility function for easily creating and appending HTML elements. | + | `main` | Contains the start-up code for the application. | + + `index.js` also contains a constant with the URL for the HYF repositories as listed in section 2.2.1: -### Important + ```js + const HYF_REPOS_URL = 'https://api.github.com/orgs/HackYourFuture/repos?per_page=100'; + ``` -- Do not duplicate code! This is especially important for making requests since we are making multiple ones with different urls and we want to do different actions based on the call we are making. Here are some handles to get you started: - - Write a function called `fetchJSON` (or copy from the lecture code) which accepts (at least) the following parameters: `url` and `callback`. - - Make sure your `callback` is called when the request errors or when it sends a response (look at the documentation) - - Your `callback` functions should accept two parameters so it can handle both errors: `err` and `response`. - So when a user selects a repository from the list you want to call `fetchJSON` with a different `url` and supply it with a function that handles both errors (display an error message to the user for example) and responses (render it correctly as HTML elements in your page). -- When the user changes the selected repository, any existing repository information in your page should be cleared before displaying the new information. -- Make your functions small and reusable (modular)! That means create separate functions to handle certain steps. +3. Open the `index.html` file in your browser. Notice that it produces the same JSON output that you saw previously when you opened the URL directly in the browser. -Note: +4. Review the `main()` function in `index.js` and examine how this code renders the JSON output in the browser by means of a `pre` HTML element (for demonstration purposes). -1. Please remove all redundant, commented-out code and console.log's from your files before pushing your homework as finished. There is no need for your mentors to review this stuff. -2. Please make sure your code is well-formatted and follows the recommended naming conventions. +### 2.5 Week 1 Assignment -_GO WILD_ +The assignment is to produce an application similar to the one illustrated in Figure 1 above. -Again, check out the GitHub API documentation to see what kind of magic stuff you can do with it. +It should include the following components: -The assignment is to implement something extra that is not in the assignment :scream: (nice and vague, right?) +1. An HTML `select` element from which the user can select a HYF repository. This `select` element must be populated with `option` elements, one for each HYF repository. +2. A left-hand column that displays basic information about the selected repository. +3. A right-hand column that displays a list of contributors to the repository. -Endless fun and possibilities. Need inspiration? Check out the GitHub API documentation. Oh, and please make it look nice (hint: use the stuff you learned in HTML/CSS)! +**Functional Requirements:** +1. The list of repositories in the `select` element should be sorted (case-insensitive) on repository name. +2. At start-up your application should display information about the first repository as displayed in the `select` element. +3. When the user changes the selection, the information in the web page should be refreshed for the newly selected repository. +4. You should be able to click on the repository name of the selected repository to open a new browser tab with the GitHub page for that repository. +5. You should be able to click on a contributor to open a new browser tab with the GitHub page for that contributor. +6. You should render network errors to the DOM (see Figure 2 below for an example). Do not use `console.log` as regular users will not see the console output. +7. Your UI should be responsive. Try it with Chrome Developer Tools in the browser, using a mobile phone format and a tablet format, portrait and landscape. If necessary, you can also do this work in week 2. + +![Error rendering](./assets/hyf-github-error.png) + +Figure 2. Rendering of network errors. + +**Code modifications:** + +**`index.js`** + +- Add new functions and modify function `main()` as you see fit. It is not likely that you will need to modify `fetchJSON()` and `createAndAppend()`. + +**`style.css`** + +- Add your own styling. + +**Hints:** + +- Add one `option` element per repository to the `select` element, where each `option` element has the array index of the repository as its `value` attribute and the name of the repository as its text content: + + ```html + + ``` + + +- To sort the list repositories use [`.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) and [`.localeCompare()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare). + +- Use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) to make the UI responsive. + +- To force a `404` network error so that you can test the rendering of errors, change the URL to make an invalid GitHub request, e.g. append an `x` to `orgs`: `orgsx`. + + +### 2.5 Handing in your homework + +- Have you removed all commented out code (should never be present in a PR)? +- Have you used `const` and `let` and avoided `var`? +- Do the variable, function and argument names you created follow the [Naming Conventions](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)? +- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md))? +- Have you resolved all issues flagged by ESLint and the spell checker (no wavy red and green underlines in VSCode)? + +If the answer is 'yes' to all preceding questions you are ready to follow these instructions: + +1. Push your `week1` branch to GitHub: + + ``` + git push -u origin week1 + ``` + +2. Create a pull request for your `week1` branch. + +--- _BONUS_ : Code Kata Race - [Codewars](https://www.codewars.com/collections/hyf-homework-number-2) -## Step 5: Read before next lecture +## Step 3: Read before next lecture _Deadline Sunday morning_ -Go trough the reading material in the [README.md](/Week2/README.md) to prepare for your next class. - ->Commit and push your homework in your "hyf-javascript3" GitHub repository. -Make sure that your commit message are meaningful. -Place the link to your repository folder in Trello. \ No newline at end of file +Go through the reading material in the [README.md](/Week2/README.md) to prepare for your next class. diff --git a/Week1/assets/hyf-github-error.png b/Week1/assets/hyf-github-error.png new file mode 100644 index 000000000..545c658f4 Binary files /dev/null and b/Week1/assets/hyf-github-error.png differ diff --git a/Week2/MAKEME.md b/Week2/MAKEME.md index 493e41685..04c09b4da 100644 --- a/Week2/MAKEME.md +++ b/Week2/MAKEME.md @@ -20,25 +20,51 @@ Topics discussed this week: - YouTube: [promises](https://www.youtube.com/watch?v=WBupia9oidU) -## Step 2: Feedback +## Step 2: Implement requested PR changes -- Create at least 2 issues (bug / feature / code improvement) on another student's GitHub repository. -- Solve the issue(s) proposed by another students in your GitHub repository. More info [here](https://hackyourfuture.slack.com/files/michahell/F31BX1XT6/Merging_a_local_branch_into_master). +- Fix Requested Changes (if any) on the Pull Request. -## Step 3: Promises +## Step 3: Convert callbacks to promises -_Deadline Saturday_ +**_Deadline Thursday_** -The assignment for this week is: +### 3.1 Preparation + +The homework for week 2 will build on the work you did in week 1. You will create a new branch based on the `week1` branch. + +1. Make sure that you committed all changes in the week 1 version of your homework. +2. Create a new `week2` branch: + + ``` + git checkout -b week2 + ``` + +### 3.2 Assignment + +You will continue to work on the files `index.js` and (possibly) `style.css`. - Complete your GitHub app code from the previous week, if needed, to meet the requirements from that week's assignment. - Replace all asynchronous callbacks (e.g. as used with XMLHttpRequest) by ES6 promises. - Beautify your app's styling. +- If not yet completed in week 1, make your app responsive (use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)). + +### 3.3 Handing in your homework + +- Have you removed all commented out code (should never be present in a PR)? +- Have you used `const` and `let` and avoided `var`? +- Do the variable, function and argument names you created follow the [Naming Conventions](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)? +- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md))? +- Have you resolved all issues flagged by ESLint and the spell checker (no wavy red and green underlines in VSCode)? + +If the answer is 'yes' to all preceding questions you are ready to follow these instructions: + +1. Push your `week2` branch to GitHub: -Bonus assignments: + ``` + git push -u origin week2 + ``` -- Make your app responsive (using media queries) -- Make your app ARIA-compliant +2. Create a pull request for your `week2` branch. Note: diff --git a/Week3/MAKEME.md b/Week3/MAKEME.md index 95372e913..ad6e7286e 100644 --- a/Week3/MAKEME.md +++ b/Week3/MAKEME.md @@ -7,170 +7,119 @@ Topics discussed this week: • call, apply, bind ``` -## Step 1: Give feedback + +## Step 1: Fix requested changes _Deadline Monday_ -Give feedback on Step 3 of last weeks homework. Please provide the feedback in an issue. +- Fix Requested Changes (if any) on the Pull Request. -## Step 2: Issues +## Step 2 -_Deadline Monday_ +**_Deadline Thursday_** -- Solve all your Git issues. DO NO CLOSE AN ISSUE WITHOUT AN EXPLANATION OR CODE COMMIT REFERENCING THAT ISSUE. +### 2.1 Preparation -## Step 3: Fix issues +**Read the fundamental pages on:** + +- [try...catch](../../../../fundamentals/blob/master/fundamentals/try_catch.md) +- [async/await](../../../../fundamentals/blob/master/fundamentals/async_await.md) -_Deadline Wednesday_ -- Fix the issues from the last weeks and make sure you explain how you fixed the issue in a comment (or commit message) +The homework for week 3 will build on the work you did in week 2. You will create a new branch based on the `week2` branch. -## Step 4 +1. Make sure that you committed all changes in the week 2 version of your homework. +2. Create a new `week3` branch: -_Deadline Thursday_ + ``` + git checkout -b week3 + ``` -- Sort the list the repositories in the ` element - } - - /** - * Fetch information for the selected repository and render the - * information as HTML elements in the DOM - * @param {*} repoName The name of the selected repository - */ - async fetchAndRender(repoName) { - const leftDiv = ...; - const rightDiv = ...; - - // ... - - try { - const contributors = await repo.fetchContributors(); - repo.render(leftDiv); - contributors - .map(contributor => new Contributor(contributor)) - .forEach(contributor => contributor.render(contributorList)); - } - catch (error) { - createAndAppend('div', container, { html: error.message, class: 'alert alert-error' }); - } - } - - /** - * Fetch API data as JSON data in a promise - * @param {string} url The URL of the API endpoint. - * @returns A promise. - */ - fetchJSON(url) { - // Add your code here - } - } - - window.onload = () => new View(); -} -``` -Note: +#### 2.2.1 async/await + +**Instructions:** + +1. Refactor all `.then()` and `.catch()` methods with `async`/`await` and `try...catch`. + +2. Make sure that your error handling code still works. See the week2 MAKEME on how to force an error response from GitHub. + + +#### 2.2.2 ES6 Classes + +**_Deadline Saturday_** + +This final assignment requires you to go the extra mile and master Object Oriented Programming and ES6 classes. + +In this assignment you need to redistribute and adapt the code from `index.js` to the files `App.js`, `Repository.js` and `Contributor.js`. You do not need to modify `Util.js`. + +| File | Description | +|------------------|-------------| +| `App.js` | The `App` class contains the start-up code and manages the overall orchestration of the app. | +| `Repository.js` | The `Repository` class holds code and data for a single repository. | +| `Contributor.js` | The `Contributor` class holds code and data for a single contributor. | +| `Util.js` | The `Util` class contains static helper methods for use in the other classes. | + +The `App.js`, `Repository.js` and `Contributor.js` files each contain skeleton code that you can use to migrate portions of your code from `index.js` to. + +_Read:_ + +- HYF fundamental: [ES6 Classes](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/oop_classes.md#es6-classes) +- More on ES6 classes: [ES6 Classes in Depth](https://ponyfoo.com/articles/es6-classes-in-depth) + +_Instructions:_ + +1. Copy `index.html` to file named `classes.html` and change the content of the `body` tag of `classes.html` as follows: + + ```html + +
+ + + + + + ``` + +#### 2.2.3 ARIA-compliance (BONUS) + +Please review the material from the HTML/CSS module: [Get familiar with Accessible Rich Internet Applications (ARIA)](https://github.com/HackYourFuture/HTML-CSS/tree/master/Week1#get-familiar-with-accessible-rich-internet-applications-aria). + +For the GitHub application ARIA-compliance means that the Contributors list should either be a native HTML list (i.e. using `ul` and `li` elements) or otherwise marked with an appropriate ARIA **role**. Furthermore, a user should be able to navigate through all interactive elements using the keyboard (e.g., using the **Tab** key). Pressing **Enter** on such an element should be equivalent to clicking the mouse. + +#### 2.2.4 Handing in your homework + +- Have you removed all commented out code (should never be present in a PR)? +- Have you used `const` and `let` and avoided `var`? +- Do the variable, function and argument names you created follow the [Naming Conventions](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)? +- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md))? +- Have you resolved all issues flagged by ESLint and the spell checker (no wavy red and green underlines in VSCode)? + +If the answer is 'yes' to all preceding questions you are ready to follow these instructions: + +1. Push your `week3` branch to GitHub: + + ``` + git push -u origin week3 + ``` + +2. Create a pull request for your `week3` branch. -1. Please remove all redundant, commented-out code and console.log's from your files before pushing your homework as finished. There is no need for your mentors to review this stuff. -2. Please make sure your code is well-formatted and follows the recommended naming conventions. -## Step 6: Read before next lecture +## Step 3: Read before next lecture _Deadline Sunday morning_ Go trough the reading material in the [README.md](https://github.com/HackYourFuture/Node.js) of the Node repository to prepare for your next class. -## _BONUS_ : Code Kata Race +## Alternative _BONUS_ : Code Kata Race If you haven't already join our clan: "Hack Your Future" in codewars diff --git a/Week3/README.md b/Week3/README.md index a7472cff3..2c317379f 100644 --- a/Week3/README.md +++ b/Week3/README.md @@ -21,4 +21,9 @@ Here are resources that we like you to read as a preparation for the third lectu - [Function.prototype.bind()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) +## Recommended Readings + +[Eloquent JavaScript: Chapter 6 - The Secret Life of Objects](http://eloquentjavascript.net/06_object.html). Read up to the section of **Maps**. + + _Please go through the material and come to class prepared!_ \ No newline at end of file diff --git a/homework/.eslintrc b/homework/.eslintrc new file mode 100644 index 000000000..ae8189517 --- /dev/null +++ b/homework/.eslintrc @@ -0,0 +1,47 @@ +{ + "env": { + "browser": true, + "commonjs": true, + "es6": true, + "node": true + }, + "parserOptions": { + "ecmaVersion": 2017, + "ecmaFeatures": { + "jsx": true + }, + "sourceType": "module" + }, + "extends": [ + "eslint:recommended" + ], + "rules": { + "no-const-assign": "warn", + "no-this-before-super": "warn", + "no-undef": "warn", + "no-unreachable": "warn", + "no-unused-vars": "warn", + "constructor-super": "warn", + "valid-typeof": "warn", + "no-var": "warn", + "prefer-const": "warn", + "no-multiple-empty-lines": "warn", + "eol-last": [ + "error", + "always" + ], + "no-console": "off", + "camelcase": "warn", + "eqeqeq": [ + "error", + "always", + { + "null": "ignore" + } + ], + "semi": [ + "warn", + "always" + ] + } +} \ No newline at end of file diff --git a/homework/src/App.js b/homework/src/App.js new file mode 100644 index 000000000..e1fb13db2 --- /dev/null +++ b/homework/src/App.js @@ -0,0 +1,72 @@ +'use strict'; + +/* global Util, Repository, Contributor */ + +class App { + constructor(url) { + this.initialize(url); + } + + /** + * Initialization + * @param {string} url The GitHub URL for obtaining the organization's repositories. + */ + async initialize(url) { + // Add code here to initialize your app + // 1. Create the fixed HTML elements of your page + // 2. Make an initial XMLHttpRequest using Util.fetchJSON() to populate your