You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>[Here](/Week3/README.md) you find the readings you have to complete before the ninth lecture.
11
-
12
-
## Step 1: Feedback
13
-
14
-
**_Deadline Monday_**
15
-
16
-
Please provide feedback on last week's homework from a fellow student as a GitHub issue.
17
-
18
-
## Step 2: Single Page Application :sweat_drops:
10
+
## Step 1: Single Page Application :sweat_drops:
19
11
20
12
**_Deadline Thursday_**
21
13
22
14
_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!)._
23
15
24
-
### 2.1 Introduction
16
+
### 1.1 Introduction
17
+
18
+
> In this assignment you will built upon some existing code that is already pre-written by your teachers. Your homework consist of writing the code to make the application work as requested per week.
25
19
26
20
You are going to write a _Single Page Application_ (SPA) that uses the [GitHub API](https://developer.github.com/guides/getting-started/).
27
21
@@ -36,15 +30,13 @@ Figure 1 below shows an example of what your application could look like. Note t
36
30
37
31

38
32
39
-
In this assignment you will built upon some existing code that is already pre-written by your teachers. Your homework consist of writing the code to make the application work as requested per week.
40
-
41
33
<small>Figure 1. Example User Interface using [Material Design](https://material.io/guidelines/) principles.</small>
42
34
43
35
A live version of this application can be found here: http://hyf-github.netlify.com/
44
36
45
-
### 2.2 The GitHub API
37
+
### 1.2 The GitHub API
46
38
47
-
#### 2.2.1 Get a list of HYF repositories
39
+
#### 1.2.1 Get a list of HYF repositories
48
40
49
41
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)):
50
42
@@ -58,90 +50,113 @@ If you open this URL in the browser (_try it!_) you will receive JSON data about
58
50
59
51
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.
60
52
61
-
#### 2.2.2 Get contributor information for a repository
53
+
#### 1.2.2 Get contributor information for a repository
62
54
63
55
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.
64
56
65
-
#### 2.2.3 GitHub API documentation
57
+
#### 1.2.3 GitHub API documentation
66
58
67
59
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.
68
60
69
61
> GitHub API documentation: https://developer.github.com/v3/
70
62
71
-
### 2.3 Preparation
63
+
### 1.3 Coding Style
72
64
73
-
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.
65
+
In this homework we will be introducing a preferred coding style and supporting tools to help you write _"clean code"_. A number of popular [_JavaScript Style Guides_](https://codeburst.io/5-javascript-style-guides-including-airbnb-github-google-88cbc6b2b7aa) have recently emerged of which the one developed by [Airbnb](https://github.com/airbnb/javascript) has been chosen for this homework and is recommended for subsequent use during the HYF curriculum. It is documented here:
74
66
75
-
| Week | Branch | Assignment |
76
-
|:----:|--------|------------|
77
-
| 1 |`week1`| Create a basic application using callbacks to handle network requests. |
78
-
| 2 |`week2`| - Refactor the callbacks to promises.<br>- Make the UI responsive.|
79
-
| 3 |`week3`| - Refactor the application to use ES6 Classes and async/await.<br>- Make the app ARIA-compliant. |
While you do not need to read this guide in detail, it is recommended that you review sections 1-8, 12-13, 15-21 and 23. The tools installed during the project preparation step below will help you to implement these guidelines in your code. You will see error and warning messages in the VSCode editor when your code deviates from the recommended style. An additional check will be done when you submit your homework as a pull request on GitHub.
70
+
71
+
### 1.5 Preparation
72
+
73
+
You will be working on the 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.
|~~`Contributor.js`~~| Not used in week 1 and 2. |
102
112
|`hyf.png`| Contains the HackYourFuture logo. |
103
-
| `index.html` | The application's HTML file. |
104
-
| `index.js` | A starter JavaScript file. |
105
-
| ~~`Repository.js`~~ | Not used in week 1 and 2. |
106
-
| `style.css` | A starter CSS file. |
107
-
| ~~`Util.js`~~ | Not used in week 1 and 2. |
113
+
|`index.html`| The application's HTML file. |
114
+
|~~`index2.html`~~| Not used in week 1 and 2. |
115
+
|`index.js`| A starter JavaScript file. |
116
+
|~~`Repository.js`~~| Not used in week 1 and 2. |
117
+
|`style.css`| A starter CSS file. |
118
+
|~~`Util.js`~~| Not used in week 1 and 2. |
108
119
109
120
In week 1, you should only modify `index.js` and `style.css`.
110
121
111
122
_**Do not modify any other files at this time!**_
112
123
113
-
#### 2.4.1 A first examination
124
+
Although you should only modify files in the `homework` folder, we recommend that you always open the `JavaScript3` folder rather than directly opening the `homework` folder in VSCode. The `JavaScript3` folder contains the actual git repository and the configuration files required by the installed tools.
125
+
126
+
_**Do not change or delete any files outside of the `homework` folder!**_
127
+
128
+
#### 1.5.1 A first examination
114
129
115
130
1. Open `index.html` and examine its contents (but don't modify anything). Notice that the HTML `body` looks like this:
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.
141
156
142
157
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).
143
158
144
-
### 2.5 Week 1 Assignment
159
+
### 1.6 Week 1 Assignment
145
160
146
161
The assignment is to produce an application similar to the one illustrated in Figure 1 above.
147
162
@@ -151,7 +166,7 @@ It should include the following components:
151
166
2. A left-hand column that displays basic information about the selected repository.
152
167
3. A right-hand column that displays a list of contributors to the repository.
153
168
154
-
>In case you run out of time, you can also do the contributors list in week 2.
169
+
> In case you run out of time, you can also do the contributors list in week 2.
155
170
156
171
**Functional Requirements:**
157
172
@@ -181,37 +196,45 @@ It should include the following components:
181
196
182
197
- 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:
183
198
184
-
```html
185
-
<select>
186
-
<option value="0">alumni</option>
187
-
<option value="1">angular</option>
188
-
<!-- etc -->
189
-
</select>
190
-
```
199
+
```html
200
+
<select>
201
+
<optionvalue="0">alumni</option>
202
+
<optionvalue="1">angular</option>
203
+
<!-- etc -->
204
+
</select>
205
+
```
191
206
207
+
* 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).
192
208
193
-
- 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).
209
+
* Use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) to make the UI responsive.
194
210
195
-
- Use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) to make the UI responsive.
211
+
* 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`.
196
212
197
-
- 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`.
213
+
### 1.7 Handing in your homework
198
214
215
+
If necessary, review the instructions how to [Hand in homework](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/homework_pr.md) using GitHub pull request.
199
216
200
-
### 2.5 Handing in your homework
217
+
To test whether your code will be accepted when you submit your homework as a pull request you need to ensure that it does not contain ESLinr errors. Open a terminal window in VSCode and type the following command:
218
+
219
+
```
220
+
npm test
221
+
```
222
+
223
+
If any errors or warnings are reported by this command you need to fix them before submitting a pull request.
224
+
225
+
In addition, check for the following:
201
226
202
227
- Have you removed all commented out code (should never be present in a PR)?
203
-
- Have you used `const` and `let` and avoided `var`?
204
228
- Do the variable, function and argument names you created follow the [Naming Conventions](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)?
205
229
- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/code_formatting.md))?
206
-
- Have you resolved all issues flagged by ESLint and the spell checker (no wavy red and green underlines in VSCode)?
207
230
208
-
If the answer is 'yes' to all preceding questions you are ready to follow these instructions:
231
+
If the answer is 'yes' to the preceding questions you are ready to follow these instructions:
Copy file name to clipboardExpand all lines: Week1/README.md
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -20,3 +20,15 @@ Here are resources that we like you to read as a preparation for the first lectu
20
20
### XMLHttpRequests
21
21
22
22
-[Making HTTP Requests in JavaScript](https://www.kirupa.com/html5/making_http_requests_js.htm)
23
+
24
+
### Clean Code
25
+
26
+
-[How to write clean code? Lessons learnt from “The Clean Code” — Robert C. Martin](https://medium.com/mindorks/how-to-write-clean-code-lessons-learnt-from-the-clean-code-robert-c-martin-9ffc7aef870c).
27
+
28
+
> Note that this article includes some code examples writte in Java, but the same principles can equally be applied to JavaScript.
29
+
30
+
-[Clean Code concepts adapted for JavaScript](https://github.com/ryanmcdermott/clean-code-javascript)
31
+
32
+
### Handing in homework using GitHub pull requests
33
+
34
+
-[Handing in homework](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/homework_pr.md)
@@ -35,9 +34,9 @@ The homework for week 2 will build on the work you did in week 1. You will creat
35
34
1. Make sure that you committed all changes in the week 1 version of your homework.
36
35
2. Create a new `week2` branch:
37
36
38
-
```
39
-
git checkout -b week2
40
-
```
37
+
```
38
+
git checkout -b week2
39
+
```
41
40
42
41
### 3.2 Assignment
43
42
@@ -50,19 +49,29 @@ You will continue to work on the files `index.js` and (possibly) `style.css`.
50
49
51
50
### 3.3 Handing in your homework
52
51
52
+
If necessary, review the instructions how to [Hand in homework](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/homework_pr.md) using GitHub pull request.
53
+
54
+
To test whether your code will be accepted when you submit your homework as a pull request you need to ensure that it does not contain ESLinr errors. Open a terminal window in VSCode and type the following command:
55
+
56
+
```
57
+
npm test
58
+
```
59
+
60
+
If any errors or warnings are reported by this command you need to fix them before submitting a pull request.
61
+
62
+
In addition, check for the following:
63
+
53
64
- Have you removed all commented out code (should never be present in a PR)?
54
-
- Have you used `const` and `let` and avoided `var`?
55
65
- Do the variable, function and argument names you created follow the [Naming Conventions](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)?
56
-
- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md))?
57
-
- Have you resolved all issues flagged by ESLint and the spell checker (no wavy red and green underlines in VSCode)?
66
+
- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/code_formatting.md))?
58
67
59
-
If the answer is 'yes' to all preceding questions you are ready to follow these instructions:
68
+
If the answer is 'yes' to the preceding questions you are ready to follow these instructions:
60
69
61
70
1. Push your `week2` branch to GitHub:
62
71
63
-
```
64
-
git push -u origin week2
65
-
```
72
+
```
73
+
git push -u origin week2
74
+
```
66
75
67
76
2. Create a pull request for your `week2` branch.
68
77
@@ -74,4 +83,3 @@ Note:
74
83
## Step 4: Read before next lecture
75
84
76
85
Go through the reading material in the [README.md](../Week3/README.md) to prepare for your next class.
0 commit comments