Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Week1 medgara #441

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Week1/Images/dog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Week1/homework/js-exercises/Exercise1/getRandomUser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const Http = new XMLHttpRequest();

const url = 'https://www.randomuser.me/api';
Http.open('GET', url);
Http.send();

const axios = require('axios').default;

axios
.get('https://www.randomuser.me/api')
.then((resp) => {
console.log(resp.data);
})
.catch((err) => {
// Handle Error Here
console.error(err);
});

Http.onreadystatechange = (e) => {
console.log(Http.responseText);
};
23 changes: 23 additions & 0 deletions Week1/homework/js-exercises/Exercise2/getRandomUser2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const Http = new XMLHttpRequest();

const url = 'https://xkcd.now.sh/?comic=latest';
Http.open('GET', url);
Http.send();

const axios = require('axios').default;

axios
.get('https://xkcd.now.sh/?comic=latest')
.then((resp) => {
console.log(resp.data);
})
.catch((err) => {
// Handle Error Here
console.error(err);
});
const image = document.createElement('img');
var x = document.getElementById('img');

Http.onreadystatechange = (e) => {
console.log(Http.responseText);
};
38 changes: 38 additions & 0 deletions Week1/homework/js-exercises/Exercise3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script>
const Http = new XMLHttpRequest();

const url = 'https://dog.ceo/api/breeds/image/random';
Http.open('GET', url);
Http.send();

const axios = require('axios').default;

axios
.get('https://dog.ceo/api/breeds/image/random')
.then((resp) => {
console.log(resp.data);
})
.catch((err) => {
// Handle Error Here
console.error(err);
});
const image = document.createElement('img');
var x = document.getElementById('img');

Http.onreadystatechange = (e) => {
console.log(Http.responseText);
};
</script>
<button type="button">Click Me!</button>
<ul>
<li><img src="dog.png" alt="A dog" />A dog</li>
</ul>
</body>
</html>
20 changes: 20 additions & 0 deletions Week2/homework/js-exercises/getName.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const getAnonName = (firstName, newPromise) => {
setTimeout(() => {
if (!firstName)
return Promise(new Error("You didn't pass in a first name!"));

const fullName = `${firstName} Doe`;

return newPromise(fullName);
}, 2000);
};

getAnonName('John', console.log);

const checkDoubleDigits = (number, newPromise) => {
setTimeout(() => {
if (number > 10) return 'The number is bigger than 10!';
else if (number < 10) return 'Error! The number is smaller than 10...';
else return '10';
});
};
Empty file.
9 changes: 9 additions & 0 deletions Week2/homework/pokemon-app/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function main() {
function fetchData() {
const fetchPromise = fetch('https://ghibliapi.herokuapp.com/people');
fetchPromise.then((response) => {
console.log(response);
});
}
function addPokemonToDOM() {}
}
10 changes: 9 additions & 1 deletion hackyourrepo-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<script src="./script.js"></script>
<section></section>
<section></section>
<section></section>
<select>
<option></option>
</select>
<script src="./script.js">
const url = 'https://api.github.com/orgs/HackYourFuture/repos?per_page=100';
</script>
</body>
</html>
9 changes: 9 additions & 0 deletions hackyourrepo-app/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
Write here your CSS rules for HackYourRepo!
*/
* {
flex: 1px;
width: calc(100% - 8px);
}
@media screen and (min-width: 900px) {
head {
margin: 10rem 30rem;
}
}