[2024-10-12] Adding footer, minor fixes to Python

This commit is contained in:
Andrew Conlin 2024-10-12 10:59:43 +01:00
parent f1c63d0ecf
commit 7356b00de1
3 changed files with 37 additions and 25 deletions

View File

@ -6,9 +6,10 @@ body {
div.content { div.content {
width: 50%; width: 50%;
height: auto; height: 100%;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
border: 1px solid var(--bg);
} }
@media screen and (max-width: 1440px) { @media screen and (max-width: 1440px) {
@ -45,7 +46,7 @@ progress {
} }
div.left { div.left {
border: 2px solid black; border: 2px solid var(--fg);
width: fit-content; width: fit-content;
height: fit-content; height: fit-content;
padding: 5px; padding: 5px;
@ -55,7 +56,7 @@ div.left {
} }
div.right { div.right {
border: 2px solid black; border: 2px solid var(--fg);
width: fit-content; width: fit-content;
height: fit-content; height: fit-content;
padding: 5px; padding: 5px;
@ -63,3 +64,13 @@ div.right {
margin-left: auto; margin-left: auto;
margin-right: 0; margin-right: 0;
} }
div.footer {
position: absolute;
left: 0;
right: 0;
bottom: 5px;
margin-left: auto;
margin-right: auto;
width: 100%; /* Need a specific value to work */
}

View File

@ -33,8 +33,13 @@
<div class="left"> <div class="left">
🧬 the history of life on Earth, {{ homoSapiens }} 🧬 the history of life on Earth, {{ homoSapiens }}
</div><br> </div><br>
<footer> <br>
</footer> <div class="footer">
<a href="mailto:andrew@andrewconl.in">📨 Suggestions?</a> |
<a href="https://github.com/andrwcnln/year-progress">🧑‍💻 Source</a> |
<a href="https://concrete.style">🎨 Style</a> |
<a href="https://ko-fi.com">☕ Buy me a coffee!</a>
</div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -35,7 +35,6 @@ def cartesianToLatLong(x,y,z):
return lat, long return lat, long
def getPercentageLatLong(yearPercent,lat1,long1,lat2,long2): def getPercentageLatLong(yearPercent,lat1,long1,lat2,long2):
# http://www.geomidpoint.com/calculation.html # http://www.geomidpoint.com/calculation.html
x1, y1, z1 = latLongToCartesian(lat1,long1) x1, y1, z1 = latLongToCartesian(lat1,long1)
@ -73,46 +72,46 @@ def abbeyRoad(yearPercent):
# 3:27 # 3:27
elif numSeconds <= 441+(3*60+27): elif numSeconds <= 441+(3*60+27):
return "Maxwell's Silver Hammer" return "Maxwell's Silver Hammer"
#3:27 # 3:27
elif numSeconds <= 648+(3*60+27): elif numSeconds <= 648+(3*60+27):
return "Oh! Darling" return "Oh! Darling"
#2:50 # 2:50
elif numSeconds <= 855+(2*60+50): elif numSeconds <= 855+(2*60+50):
return "Octopus's Garden" return "Octopus's Garden"
#7:47 # 7:47
elif numSeconds <= 1025+(7*60+47): elif numSeconds <= 1025+(7*60+47):
return "I Want You (She's So Heavy)" return "I Want You (She's So Heavy)"
#3:05 # 3:05
elif numSeconds <= 1492+(3*60+5): elif numSeconds <= 1492+(3*60+5):
return "Here Comes The Sun" return "Here Comes The Sun"
#2:45 # 2:45
elif numSeconds <= 1677+(2*60+45): elif numSeconds <= 1677+(2*60+45):
return "Because" return "Because"
#4:02 # 4:02
elif numSeconds <= 1842+(4*60+2): elif numSeconds <= 1842+(4*60+2):
return "You Never Give Me Your Money" return "You Never Give Me Your Money"
#2:26 # 2:26
elif numSeconds <= 2084+(2*60+26): elif numSeconds <= 2084+(2*60+26):
return "Sun King" return "Sun King"
#1:06 # 1:06
elif numSeconds <= 2230+(1*60+6): elif numSeconds <= 2230+(1*60+6):
return "Mean Mr. Mustard" return "Mean Mr. Mustard"
#1:12 # 1:12
elif numSeconds <= 2296+(1*60+12): elif numSeconds <= 2296+(1*60+12):
return "Polythene Pam" return "Polythene Pam"
#1:58 # 1:58
elif numSeconds <= 2368+(1*60+58): elif numSeconds <= 2368+(1*60+58):
return "She Came In Through The Bathroom Window" return "She Came In Through The Bathroom Window"
#1:31 # 1:31
elif numSeconds <= 2486+(1*60+31): elif numSeconds <= 2486+(1*60+31):
return "Golden Slumbers" return "Golden Slumbers"
#1:36 # 1:36
elif numSeconds <= 2577+(1*60+36): elif numSeconds <= 2577+(1*60+36):
return "Carry That Weight" return "Carry That Weight"
#2:21 # 2:21
elif numSeconds <= 2673+(2*60+21): elif numSeconds <= 2673+(2*60+21):
return "The End" return "The End"
#0:25 # 0:25
else: else:
return "Her Majesty" return "Her Majesty"
@ -127,7 +126,7 @@ def transatlanticFlight(yearPercent):
long2 = -73.780968 long2 = -73.780968
lat, long = getPercentageLatLong(yearPercent,lat1,long1,lat2,long2) lat, long = getPercentageLatLong(yearPercent,lat1,long1,lat2,long2)
return lat, long return round(lat,2), round(long,2)
def getHomoSapiens(yearPercent): def getHomoSapiens(yearPercent):
totalYears = 4.3e9 totalYears = 4.3e9
@ -148,7 +147,7 @@ def getTemplate():
yearPercent = delta/totalDays yearPercent = delta/totalDays
footballMinute = math.floor(yearPercent*90) footballMinute = math.floor(yearPercent*90)
workDay, workTime = workWeek(yearPercent) workDay, workTime = workWeek(yearPercent)
marathonMile = 26.2 - math.floor(yearPercent*26.2) marathonMile = round(26.2 - math.floor(yearPercent*26.2),2)
abbeyRoadSong = abbeyRoad(yearPercent) abbeyRoadSong = abbeyRoad(yearPercent)
hobbitChapter = "having an unexpected party" hobbitChapter = "having an unexpected party"
lat, long = transatlanticFlight(yearPercent) lat, long = transatlanticFlight(yearPercent)
@ -156,9 +155,6 @@ def getTemplate():
return now.year, nowTime, nowDate, round(yearPercent*100,2), footballMinute, workDay, workTime, marathonMile, abbeyRoadSong, hobbitChapter, lat, long, homoSapiens return now.year, nowTime, nowDate, round(yearPercent*100,2), footballMinute, workDay, workTime, marathonMile, abbeyRoadSong, hobbitChapter, lat, long, homoSapiens
# Transatlantic flight
# History of the earth
@app.route("/") @app.route("/")
def index(): def index():
year, nowTime, nowDate, yearPercent, footballMinute, workDay, workTime, marathonMile, abbeyRoadSong, hobbitChapter, lat, long, homoSapiens = getTemplate() year, nowTime, nowDate, yearPercent, footballMinute, workDay, workTime, marathonMile, abbeyRoadSong, hobbitChapter, lat, long, homoSapiens = getTemplate()