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
Copy file name to clipboardExpand all lines: Week1/MAKEME.md
+86-76Lines changed: 86 additions & 76 deletions
Original file line number
Diff line number
Diff line change
@@ -7,21 +7,15 @@ Topics discussed this week:
7
7
• API calls
8
8
```
9
9
10
-
>[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,111 @@ 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
64
+
65
+
In the JavaScript3 module, we will be introducing a preferred coding style and supporting tools to help you write _"clean code"_. There are a number of popular JavaScript "style guides" available of which the one developed by Airbnb will be adopted for this homework. It is documented here:
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. Adherence to many of the recommendations of this guide is enforced in this homework by tools installed during the project preparation step below. 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
72
73
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.
74
74
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. |
|~~`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 tham the `homework` folder in VSCode. The `JavaScript3` folder contains the actual git repository.
125
+
126
+
#### 1.5.1 A first examination
114
127
115
128
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
154
142
155
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
156
144
-
### 2.5 Week 1 Assignment
157
+
### 1.6 Week 1 Assignment
145
158
146
159
The assignment is to produce an application similar to the one illustrated in Figure 1 above.
147
160
@@ -151,7 +164,7 @@ It should include the following components:
151
164
2. A left-hand column that displays basic information about the selected repository.
152
165
3. A right-hand column that displays a list of contributors to the repository.
153
166
154
-
>In case you run out of time, you can also do the contributors list in week 2.
167
+
> In case you run out of time, you can also do the contributors list in week 2.
155
168
156
169
**Functional Requirements:**
157
170
@@ -181,23 +194,21 @@ It should include the following components:
181
194
182
195
- 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
196
184
-
```html
185
-
<select>
186
-
<option value="0">alumni</option>
187
-
<option value="1">angular</option>
188
-
<!-- etc -->
189
-
</select>
190
-
```
191
-
197
+
```html
198
+
<select>
199
+
<optionvalue="0">alumni</option>
200
+
<optionvalue="1">angular</option>
201
+
<!-- etc -->
202
+
</select>
203
+
```
192
204
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).
205
+
* 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).
194
206
195
-
- Use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) to make the UI responsive.
207
+
* Use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) to make the UI responsive.
196
208
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`.
209
+
* 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`.
198
210
199
-
200
-
### 2.5 Handing in your homework
211
+
### 1.7 Handing in your homework
201
212
202
213
- Have you removed all commented out code (should never be present in a PR)?
203
214
- Have you used `const` and `let` and avoided `var`?
@@ -209,9 +220,9 @@ If the answer is 'yes' to all preceding questions you are ready to follow these
Copy file name to clipboardExpand all lines: Week1/README.md
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -20,3 +20,11 @@ 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)
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.
30
28
31
29
1. Make sure that you committed all changes in the week 2 version of your homework.
32
30
2. Create a new `week3` branch:
33
31
34
-
```
35
-
git checkout -b week3
36
-
```
32
+
```
33
+
git checkout -b week3
34
+
```
37
35
38
36
### 2.2 Assignment
39
37
@@ -43,7 +41,6 @@ This week you will work with all JavaScript files in the `src` folder. The assig
43
41
2. Make your app ARIA-compliant (see below).
44
42
3. Refactor your application to use ES6 classes.
45
43
46
-
47
44
#### 2.2.1 async/await
48
45
49
46
**Instructions:**
@@ -52,7 +49,6 @@ This week you will work with all JavaScript files in the `src` folder. The assig
52
49
53
50
2. Make sure that your error handling code still works. See the week2 MAKEME on how to force an error response from GitHub.
54
51
55
-
56
52
#### 2.2.2 ES6 Classes
57
53
58
54
**_Deadline Saturday_**
@@ -61,12 +57,13 @@ This final assignment requires you to go the extra mile and master Object Orient
61
57
62
58
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`.
63
59
64
-
| File | Description |
65
-
|------------------|-------------|
66
-
| `App.js` | The `App` class contains the start-up code and manages the overall orchestration of the app. |
67
-
| `Repository.js` | The `Repository` class holds code and data for a single repository. |
68
-
| `Contributor.js` | The `Contributor` class holds code and data for a single contributor. |
69
-
| `Util.js` | The `Util` class contains static helper methods for use in the other classes. |
|`index2.html`| You should load this HTML file in your browser instead of `index.html` to work with the classes version of your homework. It loads the following JavaScript files through `<script>` tags in the `<body>` element: |
63
+
|`App.js`| The `App` class contains the start-up code and manages the overall orchestration of the app. |
64
+
|`Repository.js`| The `Repository` class holds code and data for a single repository. |
65
+
|`Contributor.js`| The `Contributor` class holds code and data for a single contributor. |
66
+
|`Util.js`| The `Util` class contains static helper methods for use in the other classes. |
70
67
71
68
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.
- More on ES6 classes: [ES6 Classes in Depth](https://ponyfoo.com/articles/es6-classes-in-depth)
77
74
78
-
_Instructions:_
79
-
80
-
1. Copy `index.html` to file named `classes.html` and change the content of the `body` tag of `classes.html` as follows:
81
-
82
-
```html
83
-
<body>
84
-
<div id="root"></div>
85
-
<script src="./Util.js"></script>
86
-
<script src="./Repository.js"></script>
87
-
<script src="./Contributor.js"></script>
88
-
<script src="./App.js"></script>
89
-
</body>
90
-
```
91
-
92
75
#### 2.2.3 ARIA-compliance (BONUS)
93
76
94
77
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).
@@ -107,9 +90,9 @@ If the answer is 'yes' to all preceding questions you are ready to follow these
107
90
108
91
1. Push your `week3` branch to GitHub:
109
92
110
-
```
111
-
git push -u origin week3
112
-
```
93
+
```
94
+
git push -u origin week3
95
+
```
113
96
114
97
2. Create a pull request for your `week3` branch.
115
98
@@ -124,12 +107,14 @@ Go trough the reading material in the [README.md](https://github.com/HackYourFut
124
107
If you haven't already join our clan: "Hack Your Future" in codewars
- Some more [Homework](https://www.codewars.com/collections/hyf-homework-1)
131
115
132
116
_Hints_
117
+
133
118
- Hint for Q1: split your code into two parts, one part for the case that one of the two strings has an extra letter at the start or the end but is otherwise identical & one part for the case that the strings are the same length but one character is different in one of the strings
134
119
- Also for Q1 this function on strings might be useful: [JavaScript String slice() method](https://www.w3schools.com/jsref/jsref_slice_string.asp)
135
120
- Also potentially useful: [JavaScript String charAt() Method](https://www.w3schools.com/jsref/jsref_charat.asp)
0 commit comments