-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds week 8 exercises, slides, and source code
- Loading branch information
1 parent
1874174
commit f62cc1d
Showing
64 changed files
with
143,964 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
import requests | ||
import time | ||
|
||
USERNAME = os.getenv("USERNAME") | ||
IP = os.getenv("IP") | ||
URL = f"http://{IP}/api/{USERNAME}/lights/1/state" | ||
|
||
while True: | ||
requests.put(URL, json={"bri": 254, "on": True}) | ||
time.sleep(1) | ||
requests.put(URL, json={"on": False}) | ||
time.sleep(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
import requests | ||
|
||
USERNAME = os.getenv("USERNAME") | ||
IP = os.getenv("IP") | ||
URL = f"http://{IP}/api/{USERNAME}/lights/1/state" | ||
|
||
body = { | ||
"hue": 46290, | ||
"sat": 254 | ||
} | ||
|
||
requests.put(URL, json=body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
import requests | ||
|
||
USERNAME = os.getenv("USERNAME") | ||
IP = os.getenv("IP") | ||
URL = f"http://{IP}/api/{USERNAME}/lights/1/state" | ||
|
||
body = { | ||
"hue": 25500, | ||
"sat": 254 | ||
} | ||
|
||
requests.put(URL, json=body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
import requests | ||
|
||
USERNAME = os.getenv("USERNAME") | ||
IP = os.getenv("IP") | ||
URL = f"http://{IP}/api/{USERNAME}/lights/1/state" | ||
|
||
body = { | ||
"on": False | ||
} | ||
|
||
requests.put(URL, json=body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import os | ||
import requests | ||
|
||
USERNAME = os.getenv("USERNAME") | ||
IP = os.getenv("IP") | ||
URL = f"http://{IP}/api/{USERNAME}/lights/1/state" | ||
|
||
body = { | ||
"bri": 254, | ||
"on": True, | ||
"sat": 0 | ||
} | ||
|
||
requests.put(URL, json=body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
import requests | ||
|
||
USERNAME = os.getenv("USERNAME") | ||
IP = os.getenv("IP") | ||
URL = f"http://{IP}/api/{USERNAME}/lights/1/state" | ||
|
||
body = { | ||
"hue": 65535, | ||
"sat": 254 | ||
} | ||
|
||
requests.put(URL, json=body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
<meta name="viewport" content="initial-scale=1, width=device-width"> | ||
<title>autocomplete</title> | ||
</head> | ||
|
||
<body> | ||
|
||
<input autocomplete="off" autofocus placeholder="Query" type="text"> | ||
|
||
<ul></ul> | ||
|
||
<script src="large.js"></script> | ||
<script> | ||
|
||
let input = document.querySelector('input'); | ||
input.addEventListener('keyup', function(event) { | ||
let html = ''; | ||
if (input.value) { | ||
for (word of WORDS) { | ||
if (word.startsWith(input.value)) { | ||
html += `<li>${word}</li>`; | ||
} | ||
} | ||
} | ||
document.querySelector('ul').innerHTML = html; | ||
}); | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
|
||
<!-- Demonstrates programmatic changes to style --> | ||
|
||
<html lang="en"> | ||
<head> | ||
<title>background</title> | ||
</head> | ||
<body> | ||
<button id="red">R</button> | ||
<button id="green">G</button> | ||
<button id="blue">B</button> | ||
<script> | ||
|
||
let body = document.querySelector('body'); | ||
document.querySelector('#red').onclick = function() { | ||
body.style.backgroundColor = 'red'; | ||
}; | ||
document.querySelector('#green').onclick = function() { | ||
body.style.backgroundColor = 'green'; | ||
}; | ||
document.querySelector('#blue').onclick = function() { | ||
body.style.backgroundColor = 'blue'; | ||
}; | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<script> | ||
|
||
// Toggles visibility of greeting | ||
function blink() | ||
{ | ||
let body = document.querySelector('body'); | ||
if (body.style.visibility == 'hidden') | ||
{ | ||
body.style.visibility = 'visible'; | ||
} | ||
else | ||
{ | ||
body.style.visibility = 'hidden'; | ||
} | ||
} | ||
|
||
// Blink every 500ms | ||
window.setInterval(blink, 500); | ||
|
||
</script> | ||
<title>blink</title> | ||
</head> | ||
<body> | ||
hello, world | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
|
||
<!-- Demonstrates inline CSS --> | ||
|
||
<html lang="en"> | ||
<head> | ||
<title>css</title> | ||
</head> | ||
<body> | ||
<header style="font-size: large; text-align: center;"> | ||
John Harvard | ||
</header> | ||
<main style="font-size: medium; text-align: center;"> | ||
Welcome to my home page! | ||
</main> | ||
<footer style="font-size: small; text-align: center;"> | ||
Copyright © John Harvard | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
|
||
<!-- Demonstrates inheritance --> | ||
|
||
<html lang="en"> | ||
<head> | ||
<title>css</title> | ||
</head> | ||
<body style="text-align: center;"> | ||
<header style="font-size: large;"> | ||
John Harvard | ||
</header> | ||
<main style="font-size: medium;"> | ||
Welcome to my home page! | ||
</main> | ||
<footer style="font-size: small;"> | ||
Copyright © John Harvard | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
|
||
<!-- Demonstrates CSS selectors --> | ||
|
||
<html lang="en"> | ||
<head> | ||
<style> | ||
|
||
header | ||
{ | ||
font-size: large; | ||
text-align: center; | ||
} | ||
|
||
main | ||
{ | ||
font-size: medium; | ||
text-align: center; | ||
} | ||
|
||
footer | ||
{ | ||
font-size: small; | ||
text-align: center; | ||
} | ||
|
||
</style> | ||
<title>css</title> | ||
</head> | ||
<body> | ||
<header> | ||
John Harvard | ||
</header> | ||
<main> | ||
Welcome to my home page! | ||
</main> | ||
<footer> | ||
Copyright © John Harvard | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
|
||
<!-- Demonstrates CSS selectors --> | ||
|
||
<html lang="en"> | ||
<head> | ||
<style> | ||
|
||
body | ||
{ | ||
text-align: center; | ||
} | ||
|
||
header | ||
{ | ||
font-size: large; | ||
} | ||
|
||
main | ||
{ | ||
font-size: medium; | ||
} | ||
|
||
footer | ||
{ | ||
font-size: small; | ||
} | ||
|
||
</style> | ||
<title>css</title> | ||
</head> | ||
<body> | ||
<header> | ||
John Harvard | ||
</header> | ||
<main> | ||
Welcome to my home page! | ||
</main> | ||
<footer> | ||
Copyright © John Harvard | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
|
||
<!-- Demonstrates CSS classes --> | ||
|
||
<html lang="en"> | ||
<head> | ||
<style> | ||
|
||
.centered | ||
{ | ||
text-align: center; | ||
} | ||
|
||
.large | ||
{ | ||
font-size: large; | ||
} | ||
|
||
.medium | ||
{ | ||
font-size: medium; | ||
} | ||
|
||
.small | ||
{ | ||
font-size: small; | ||
} | ||
|
||
</style> | ||
<title>css</title> | ||
</head> | ||
<body class="centered"> | ||
<header class="large"> | ||
John Harvard | ||
</header> | ||
<main class="medium"> | ||
Welcome to my home page! | ||
</main> | ||
<footer class="small"> | ||
Copyright © John Harvard | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.centered | ||
{ | ||
text-align: center; | ||
} | ||
|
||
.large | ||
{ | ||
font-size: large; | ||
} | ||
|
||
.medium | ||
{ | ||
font-size: medium; | ||
} | ||
|
||
.small | ||
{ | ||
font-size: small; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
|
||
<!-- Demonstrates external stylesheets --> | ||
|
||
<html lang="en"> | ||
<head> | ||
<link href="css5.css" rel="stylesheet"> | ||
<title>css</title> | ||
</head> | ||
<body> | ||
<header class="large"> | ||
John Harvard | ||
</header> | ||
<main class="medium"> | ||
Welcome to my home page! | ||
</main> | ||
<footer class="small"> | ||
Copyright © John Harvard | ||
</footer> | ||
</body> | ||
</html> |
Oops, something went wrong.