Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 613f4d9

Browse files
authored
Merge pull request HackYourFuture#1 from HackYourFuture/master
pull
2 parents 8e292b3 + ea48a05 commit 613f4d9

File tree

9 files changed

+306
-292
lines changed

9 files changed

+306
-292
lines changed

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cSpell.words": [
3+
"orgs",
4+
"repos"
5+
]
6+
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Here you can find course content and homework for the JavaScript3 modules
66

77
|Week|Topic|Read|Homework|
88
|----|-----|----|--------|
9-
|1.|[Object Oriented Programming and Classes](../../../fundamentals/blob/master/fundamentals/oop_classes.md)<br>• [The `this` keyword](../../../fundamentals/blob/master/fundamentals/this.md) |[Reading Week 1](/Week1/README.md)|[Homework Week 1](/Week1/MAKEME.md)|
10-
|2.|Structure for a basic SPA (Single Page Application) <br>• [XMLHttpRequests](../../../fundamentals/blob/master/fundamentals/XMLHttpRequest.md) <br>• API calls|[Reading Week 2](/Week2/README.md)|[Homework Week 2](/Week2/MAKEME.md)|
11-
|3.|[Promises](../../../fundamentals/blob/master/fundamentals/promises.md)<br> • (re)writing data structures (in JSON) <br>• Async vs Sync <br>• [Event Loop (order of execution)](../../../fundamentals/blob/master/fundamentals/event_loop.md) |[Reading Week 3](/Week3/README.md)|[Homework Week 3](/Week3/MAKEME.md)|
9+
|1.|Structure for a basic SPA (Single Page Application) <br>• [XMLHttpRequests](../../../fundamentals/blob/master/fundamentals/XMLHttpRequest.md) <br>• API calls|[Reading Week 1](/Week1/README.md)|[Homework Week 1](/Week1/MAKEME.md)|
10+
|2.|[Event Loop (order of execution)](../../../fundamentals/blob/master/fundamentals/event_loop.md)<br>• [Promises](../../../fundamentals/blob/master/fundamentals/promises.md)|[Reading Week 2](/Week2/README.md)|[Homework Week 2](/Week2/MAKEME.md)|
11+
|3.|[try...catch](../../../fundamentals/blob/master/fundamentals/try_catch.md)<br>[async/await](../../../fundamentals/blob/master/fundamentals/async_await.md)<br>• [Object Oriented Programming and ES6 Classes](../../../fundamentals/blob/master/fundamentals/oop_classes.md)<br>• [The `this` keyword](../../../fundamentals/blob/master/fundamentals/this.md)<br>• call, apply, bind |[Reading Week 3](/Week3/README.md)|[Homework Week 3](/Week3/MAKEME.md)|
1212

1313
__Kind note:__
1414

1515
We expect you to __always__ come prepared to the class on Sunday.
1616

1717
### Overall
18-
A good understanding of all the above mentioned topics. Want to check your Knowledge? Go through the [JavaScript Fundamentals README](fundamentals/README.md) and research/ ask for help (Slack!) with the concepts that are not entirely clear.
18+
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.
1919

2020
*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 :)*

Week1/MAKEME.md

Lines changed: 61 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -2,168 +2,113 @@
22

33
```
44
Topics discussed this week:
5-
• Object Oriented Programming
6-
• this
7-
• call
8-
• apply
9-
• bind
10-
• Code flow (order of execution)
5+
• Structure for a basic SPA
6+
• XMLHttpRequests
7+
• API calls
118
```
129

13-
>[Here](/Week2/README.md) you find the readings you have to complete before the eighth lecture.
1410

15-
## Step 1: Give feedback
11+
>[Here](/Week3/README.md) you find the readings you have to complete before the ninth lecture.
1612
17-
_Deadline Monday_
18-
19-
Give feedback on Step 4 and 5 of last weeks homework. Please provide the feedback in an issue.
20-
21-
## Step 2: Issues
13+
## Step 1: Feedback
2214

2315
_Deadline Monday_
2416

25-
- Solve all your Git issues. DO NO CLOSE AN ISSUE WITHOUT AN EXPLANATION OR CODE COMMIT REFERENCING THAT ISSUE.
26-
17+
Please provide feedback in an issue.
2718

28-
## Step 3: Fix issues
29-
30-
_Deadline Thursday_
31-
32-
- Fix the issues from the last weeks and make sure you explain how you fixed the issue in a comment (or commit message)
19+
_Deadline Monday_
3320

34-
## Step 4: Some Challenges
21+
## Step 2: FINISH ALL YOUR JAVASCRIPT HOMEWORK
3522

3623
_Deadline Saturday_
3724

38-
Let's practice working with Objects and Arrays. Go to FreeCodeCamp and complete all challenges under "Object Oriented and Functional Programming" and the _first four challenges_ under "Basic Algorithm Scripting", up until 'Find the longest word in a string.'
39-
40-
Also make:
25+
:point_up:
4126

42-
1. [Comparisons with the Logical And Operator](https://www.freecodecamp.com/challenges/comparisons-with-the-logical-and-operator)
27+
## Step 3: SPA :sweat_drops:
4328

44-
2. [Record Collection](https://www.freecodecamp.com/challenges/record-collection)
45-
46-
3. [Iterate over Arrays with map](https://www.freecodecamp.com/challenges/iterate-over-arrays-with-map)
47-
48-
## Step 5: OOP
29+
_Deadline Saturday_
4930

50-
_Deadline Wednesday_
31+
You are going to write a SPA (Single Page Application) that uses the [GitHub API](https://developer.github.com/guides/getting-started/).
5132

52-
Complete the following code:
33+
This application should display information about the available [HYF repositories](https://github.com/hackyourfuture):
5334

54-
```js
55-
class Movie {
56-
constructor(title, director) {
57-
// add your code here
58-
}
35+
- You should be able to select a repository from a list of available repositories.
36+
- The application should display high-level information about the selected repository and show a list of its contributors.
5937

60-
getTitle() {
61-
// add your code here
62-
}
38+
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.
6339

64-
getDirector() {
65-
// add your code here
66-
}
40+
![UI Example](./assets/hyf-github.png)
6741

68-
addStar(star) {
69-
// add your code here
70-
}
42+
Figure 1. Example User Interface using [Material Design](https://material.io/guidelines/) principles.
7143

72-
getStars() {
73-
// add your code here
74-
}
44+
### Instructions
7545

76-
addWriter(writer) {
77-
// add your code here
78-
}
46+
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`.
47+
2. Your `index.html` file should load the `style.css` and `app.js` files, using the appropriate HTML tags.
48+
3. The `body` of your `index.html` should contain a single `div` element like this: `<div id="root"></div>`.
49+
4. All other HTML elements should be generated programmatically by your `app.js` file and ultimately be hanging off the root `div` element.
50+
5. Implement the repository selection list by means of an HTML [\<select\>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select) element.
7951

80-
getWriters() {
81-
// add your code here
82-
}
52+
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.
8353

84-
addRating(rating) {
85-
// add your code here
86-
}
54+
#### List of repositories
8755

88-
getAverageRating() {
89-
// add your code here
90-
}
56+
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)):
9157

92-
// ... Add yours :-) Look to IMDB for inspiration
93-
}
58+
```
59+
https://api.github.com/orgs/HackYourFuture/repos?per_page=100
60+
```
9461

95-
class StaffMember {
96-
constructor(name, role, dateOfBirth) {
97-
// add your code here
98-
}
62+
GitHub API documentation: [List organization repositories](https://developer.github.com/v3/repos/#list-organization-repositories)
9963

100-
addMovie(movie) {
101-
// add your code here
102-
}
64+
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).
10365

104-
getName() {
105-
// add your code here
106-
}
66+
#### Get contributor information
10767

108-
getRole() {
109-
// add your code here
110-
}
68+
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.
11169

112-
getAge() {
113-
// add your code here
114-
}
115-
}
70+
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.
11671

117-
// Pick your favorite movie from http://www.imdb.com/
72+
### Refinements
11873

119-
const myMovie = new Movie(...);
74+
- 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`).
75+
- Make sure the link opens in a new tab.
12076

121-
const firstActor = new StaffMember(...);
122-
myMovie.addStar(firstActor);
123-
// create and add more staff members
77+
### Important
12478

125-
// Make sure that the following actions work.
126-
console.log(myMovie.getStars().map(actor => `${actor.getName()} ${actor.getAge()}`));
127-
const director = myMovie.getDirector();
128-
console.log(`Director: ${director.getName()}`);
129-
```
79+
- 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:
80+
- Write a function called `fetchJSON` (or copy from the lecture code) which accepts (at least) the following parameters: `url` and `callback`.
81+
- Make sure your `callback` is called when the request errors or when it sends a response (look at the documentation)
82+
- Your `callback` functions should accept two parameters so it can handle both errors: `err` and `response`.
83+
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).
84+
- When the user changes the selected repository, any existing repository information in your page should be cleared before displaying the new information.
85+
- Make your functions small and reusable (modular)! That means create separate functions to handle certain steps.
13086

131-
Fun extra step: If you get bored, template them and make a page by rendering the results in HTML :smile: with something like `document.querySelector('.move').innerHTML = ...`
87+
Note:
13288

133-
## Step 6: Read before next lecture
89+
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.
90+
2. Please make sure your code is well-formatted and follows the recommended naming conventions.
13491

135-
_Deadline Sunday morning_
92+
_GO WILD_
13693

137-
Go trough the reading material in the [README.md](/Week2/README.md) to prepare for your next class
94+
Again, check out the GitHub API documentation to see what kind of magic stuff you can do with it.
13895

139-
## _BONUS_ : Code Kata Race
96+
The assignment is to implement something extra that is not in the assignment :scream: (nice and vague, right?)
14097

141-
If you haven't already join our clan: "Hack Your Future" in codewars
98+
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)!
14299

143-
Solve the following problems:
144-
- [Problem 1](https://www.codewars.com/kata/keep-up-the-hoop)
145-
- [Problem 2](https://www.codewars.com/kata/find-the-first-non-consecutive-number)
146-
- [Problem 3](https://www.codewars.com/kata/negation-of-a-value)
147-
- Some more [Homework](https://www.codewars.com/collections/hyf-homework-1)
148100

149-
_Hints_
150-
- 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
151-
- Also for Q1 this function on strings might be useful: [JavaScript String slice() method](https://www.w3schools.com/jsref/jsref_slice_string.asp)
152-
- Also potentially useful: [JavaScript String charAt() Method](https://www.w3schools.com/jsref/jsref_charat.asp)
153-
- [Hint for Q2](https://www.w3schools.com/jsref/jsref_sort.asp) Also there are no sample tests, you need to use submit
101+
_BONUS_ : Code Kata Race
154102

155-
Remember the person with the most kata points gets a prize from Gijs (and you can do exercises on this website without us assigning them - anything kyu 7 or kyu 8 you can try to do - kyu 6 or lower is probably too hard) -->
103+
- [Codewars](https://www.codewars.com/collections/hyf-homework-number-2)
156104

157-
-[MORE BONUS](https://www.codewars.com/collections/hyf-homework-1-bonus-credit) :collision:
158105

159-
## To watch before the next lecture:
106+
## Step 5: Read before next lecture
160107

161-
(watch in this order)
108+
_Deadline Sunday morning_
162109

163-
1. [Stacks/Queues](https://www.youtube.com/watch?v=wjI1WNcIntg) (5 mins)
164-
2. [JS Event Loops](https://www.youtube.com/watch?v=8aGhZQkoFbQ) (26 mins, watch this one twice or until you understand it)
110+
Go trough the reading material in the [README.md](/Week2/README.md) to prepare for your next class.
165111

166-
>Create a new repository "hyf-javascript3". Also create a new folder "week1" inside this repository.
167-
Upload your homework files inside the week1 folder and write a description for this “commit”.
168-
Your hyf-javascript3/week1 should now contain the files of your homework.
169-
Place the link to your repository folder in Trello.
112+
>Commit and push your homework in your "hyf-javascript3" GitHub repository.
113+
Make sure that your commit message are meaningful.
114+
Place the link to your repository folder in Trello.

Week1/README.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,21 @@
22

33
```
44
In week one we will discuss the following topics:
5-
• (Object Oriented Programming)
6-
• this
7-
• call
8-
• apply
9-
• bind
10-
• Promises
5+
• Structure for a basic SPA (Single Page Application)
6+
• XMLHttpRequests
7+
• API calls
118
```
129

13-
### Here are resources that we like you to read as a preparation for the coming lecture:
10+
Here are resources that we like you to read as a preparation for the first lecture:
1411

15-
### `call` `apply`, `bind`
16-
- [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call)
17-
- [Function.prototype.apply()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)
18-
- [Function.prototype.bind()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind)
12+
### Fundamentals
1913

20-
#### Promises
21-
Some nice resources about promises :ring:
22-
- [Googles post about Promises](https://developers.google.com/web/fundamentals/getting-started/primers/promises)
23-
- [A nice article from David Walsh](https://davidwalsh.name/promises)
24-
- [A real life example](https://github.com/mdn/js-examples/blob/master/promises-test/index.html)
25-
- [stackoverflow](http://stackoverflow.com/questions/13343340/calling-an-asynchronous-function-within-a-for-loop-in-javascript)
26-
- [promises](https://www.youtube.com/watch?v=WBupia9oidU)
14+
- [XMLHttpRequest](../../../../fundamentals/blob/master/fundamentals/XMLHttpRequest.md)
2715

28-
_Please go through the material and come to class prepared!_
16+
### APIs
17+
18+
- Read about APIS: https://www.programmableweb.com/api-university/what-are-apis-and-how-do-they-work
19+
20+
### XMLHttpRequests
21+
22+
- [Making HTTP Requests in JavaScript](https://www.kirupa.com/html5/making_http_requests_js.htm)

Week1/assets/hyf-github.png

69.6 KB
Loading

0 commit comments

Comments
 (0)