Skip to content

Commit 9c1e06d

Browse files
Added Day 23
1 parent 453857a commit 9c1e06d

3 files changed

Lines changed: 2557 additions & 0 deletions

File tree

public/23/index.html

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="icon" href="/assets/icon.png" />
7+
<script src="/lib/figlet.js"></script>
8+
<title>Day 23/100</title>
9+
</head>
10+
<body>
11+
<main>
12+
<div id="ascii-art">
13+
<div class="ascii-line" id="ascii-line-1"></div>
14+
<div class="ascii-line" id="ascii-line-2"></div>
15+
<div class="ascii-line" id="ascii-line-3"></div>
16+
<div class="ascii-line" id="ascii-line-4"></div>
17+
<div class="ascii-line" id="ascii-line-5"></div>
18+
<div class="ascii-line" id="ascii-line-6"></div>
19+
<div class="ascii-line" id="ascii-line-7"></div>
20+
<div class="ascii-line" id="ascii-line-8"></div>
21+
<div class="ascii-line" id="ascii-line-9"></div>
22+
</div>
23+
</main>
24+
25+
<style>
26+
@font-face {
27+
font-family: "SFMono";
28+
src: url("/assets/SFMono-Bold.woff2") format("woff2");
29+
font-weight: 700;
30+
}
31+
32+
@font-face {
33+
font-family: "SFMono";
34+
src: url("/assets/SFMono-Medium.woff2") format("woff2");
35+
font-weight: 500;
36+
}
37+
38+
@font-face {
39+
font-family: "SFMono";
40+
src: url("/assets/SFMono-Regular.woff2") format("woff2");
41+
font-weight: 400;
42+
}
43+
44+
body {
45+
background-color: #fff;
46+
overflow: hidden;
47+
display: flex;
48+
justify-content: center;
49+
align-items: center;
50+
min-height: 100vh;
51+
margin: 0;
52+
}
53+
54+
#ascii-art {
55+
text-align: center;
56+
}
57+
58+
.ascii-line {
59+
font-size: min(1.3vw, 16px);
60+
line-height: 1.2;
61+
font-family: "SFMono", monospace;
62+
font-weight: 700;
63+
white-space: pre;
64+
margin: 0;
65+
padding: 0;
66+
color: #000;
67+
}
68+
</style>
69+
70+
<script>
71+
figlet.defaults({ fontPath: "/assets/" });
72+
73+
function updateASCIITime(time) {
74+
figlet.text(
75+
time,
76+
{
77+
font: "SlantRelief",
78+
},
79+
function (err, data) {
80+
if (err) {
81+
console.error(err);
82+
} else {
83+
const lines = data.split("\n");
84+
document.getElementById("ascii-line-1").textContent = lines[0];
85+
document.getElementById("ascii-line-2").textContent = lines[1];
86+
document.getElementById("ascii-line-3").textContent = lines[2];
87+
document.getElementById("ascii-line-4").textContent = lines[3];
88+
document.getElementById("ascii-line-5").textContent = lines[4];
89+
document.getElementById("ascii-line-6").textContent = lines[5];
90+
document.getElementById("ascii-line-7").textContent = lines[6];
91+
document.getElementById("ascii-line-8").textContent = lines[7];
92+
document.getElementById("ascii-line-9").textContent = lines[8];
93+
}
94+
}
95+
);
96+
}
97+
98+
function updateClock() {
99+
const now = new Date();
100+
let milliseconds = now.getMilliseconds();
101+
let seconds = now.getSeconds();
102+
let minutes = now.getMinutes();
103+
let hours = now.getHours();
104+
105+
if (hours > 12) {
106+
hours -= 12;
107+
}
108+
109+
const time = `${hours.toString().padStart(2, "0")}:${minutes
110+
.toString()
111+
.padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
112+
updateASCIITime(time);
113+
114+
const millisecondsToNextSecond = 1000 - now.getMilliseconds();
115+
setTimeout(updateClock, millisecondsToNextSecond);
116+
}
117+
118+
updateClock();
119+
</script>
120+
</body>
121+
</html>

0 commit comments

Comments
 (0)