Skip to content

Commit 1f4c7ac

Browse files
committed
Finished Day 2 and started Day 3
1 parent c29f83f commit 1f4c7ac

File tree

8 files changed

+221
-0
lines changed

8 files changed

+221
-0
lines changed

2-Http+exercise/extras/form.css

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
form input, form select {
3+
4+
display: block;
5+
width: 100%;
6+
height: calc(1.5em + .75rem + 2px);
7+
padding: .375rem .75rem;
8+
font-size: 1rem;
9+
font-weight: 400;
10+
line-height: 1.5;
11+
color: #495057;
12+
background-color: #fff;
13+
background-clip: padding-box;
14+
border: 1px solid #ced4da;
15+
border-radius: .25rem;
16+
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
17+
18+
}
19+
20+
form input::placeholder {
21+
color: #6c757d;
22+
opacity: 1;
23+
}
24+
25+
button {
26+
display: inline-block;
27+
font-weight: 400;
28+
color: #212529;
29+
text-align: center;
30+
vertical-align: middle;
31+
-webkit-user-select: none;
32+
-moz-user-select: none;
33+
-ms-user-select: none;
34+
user-select: none;
35+
background-color: transparent;
36+
border: 1px solid transparent;
37+
border-top-color: transparent;
38+
border-right-color: transparent;
39+
border-bottom-color: transparent;
40+
border-left-color: transparent;
41+
padding: .375rem .75rem;
42+
font-size: 1rem;
43+
line-height: 1.5;
44+
border-radius: .25rem;
45+
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
46+
}
47+
48+
49+
button {
50+
51+
color: #fff;
52+
background-color: #28a745;
53+
border-color: #28a745;
54+
55+
}

2-Http+exercise/extras/form_hook.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
$(document).ready(function () {
2+
3+
$("form").submit(function (e) {
4+
e.preventDefault()
5+
6+
const $inputs = $('form :input');
7+
8+
let values = {}
9+
$inputs.each(function () {
10+
if (this.name) {
11+
values[this.name] = $(this).val();
12+
}
13+
})
14+
15+
alert(JSON.stringify(values, null, 2))
16+
17+
return false
18+
})
19+
})

2-Http+exercise/extras/site.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
form {
3+
margin-left: auto;
4+
margin-right: auto;
5+
max-width: 350px;
6+
background-color: white;
7+
padding: 20px;
8+
padding-right: 30px;
9+
border-radius: 10px;
10+
}
11+
12+
form > * {
13+
margin: 10px;
14+
}
15+
16+
form > div {
17+
text-align: right;
18+
margin-right: -10px;
19+
}
20+
21+
body {
22+
background-color: #84cbff;
23+
}
24+
25+
h1 {
26+
color: white;
27+
text-align: center;
28+
margin-top: 50px;
29+
margin-bottom: 50px;
30+
font-size: 64px;
31+
font-weight: lighter;
32+
}

2-Http+exercise/google_index.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
</head>
7+
<body>
8+
<center>
9+
<h1 style="color:indigo">Google</h1>
10+
</center>
11+
<center>
12+
<div>
13+
<form action="" method="post">
14+
<div>Search the Web using Google!</div>
15+
<div><input type="text" required placeholder="search"></div>
16+
<div><button type="submit">Google Search</button><button type="reset">I'm feeling lucky</button></div>
17+
</form>
18+
</div>
19+
<table border="0" width="90%">
20+
<tr>
21+
<td bgcolor="#40e0d0">
22+
<p>Special Searches</p>
23+
<a href="#">Stanford Search</a><br>
24+
<a href="#">Linux Search</a>
25+
</td>
26+
<td bgcolor="#48d1cc">
27+
<a href="#">Help!</a><br>
28+
<a href="#">About Google!</a><br>
29+
<a href="#">Company Info</a><br>
30+
<a href="#">Google! Logos</a>
31+
</td>
32+
<td bgcolor="#00ced1">
33+
<p>Get Google!<br> Updates monthly:</p>
34+
<form>
35+
<input type="email" required placeholder="your e-mail"><br>
36+
<button type="submit">Subscribe</button>
37+
<a href="#">Archive</a>
38+
</form>
39+
</td>
40+
</tr>
41+
</table>
42+
</center>
43+
<center>
44+
<a href="google_login.html">Log In</a>
45+
</center>
46+
</body>
47+
<footer>
48+
<center>
49+
Copyright 1998 Google Inc.
50+
<center>
51+
</footer>
52+
</html>

2-Http+exercise/google_login.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
</head>
7+
<body>
8+
<div>
9+
<form>
10+
<input type="text" required name="full name" placeholder="fullname">
11+
<input type="email" required name="email" placeholder="email">
12+
<input type="number" required name="age" min="18" placeholder="age in years">
13+
<input type="password" required minlength="6" name="password" placeholder="password">
14+
<button type="submit">Log In</button>
15+
</form>
16+
</div>
17+
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
18+
<script src="extras/form_hook.js"></script>
19+
</body>
20+
</html>

2-Http+exercise/index.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Sign Up for FoxRem</title>
6+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
7+
<link rel="stylesheet" href="extras/form.css">
8+
<link rel="stylesheet" href="extras/site.css">
9+
</head>
10+
<body>
11+
<h1>FoxRem Sign Up</h1>
12+
<form action="" method="post">
13+
<input type="text" name="fullname" required placeholder=" full name">
14+
<input type="email" name="email" required placeholder=" email">
15+
<input type="number" min="18" name="age" required placeholder=" age in years">
16+
<input type="password" minlength="6" name="password" required placeholder=" password">
17+
<select name="heard_of">
18+
<option value="" selected>Please select an Option</option>
19+
<option value="podcast">Podcast</option>
20+
<option value="book">Book</option>
21+
<option value="tiktok">TikTok</option>
22+
<option value="other">Other</option>
23+
</select>
24+
<button type="submit">Register</button>
25+
</form>
26+
27+
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
28+
<script src="extras/form_hook.js"></script>
29+
</body>
30+
</html>

3-fastAPI/main.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import fastapi
2+
import uvicorn
3+
4+
api = fastapi.FastAPI()
5+
6+
@api.get('/api/calculate')
7+
def calculate():
8+
return 2+2
9+
10+
uvicorn.run(api, host='0.0.0.0', port=8000)

3-fastAPI/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
black
2+
fastapi
3+
uvicorn

0 commit comments

Comments
 (0)