Happy New Year!

Signed-off-by: thematdev <thematdev@gmail.com>
This commit is contained in:
thematdev 2021-12-31 18:50:07 +03:00
parent 74de406f1d
commit fc593405bb
10 changed files with 30 additions and 19 deletions

View File

@ -3,6 +3,7 @@ from flask import Flask, url_for, render_template
import os
import json
import numpy.random as gaussian_rnd
from app.snowfall import generate_snowfall
load_dotenv()
@ -67,4 +68,5 @@ def index():
data = json.loads(file.read())
cols = data['cols']
projects = data['projects']
return render_template('index.html', random_number=generate_iq(), projects=projects)
snowflake_image_url = dated_url_for('static', filename='images/snowflake.png')
return render_template('index.html', random_number=generate_iq(), projects=projects, snowfall=generate_snowfall(snowflake_image_url))

16
app/snowfall.py Normal file
View File

@ -0,0 +1,16 @@
'''
Source files of snowfall, including CSS you can find at https://github.com/Artimon/pure-css-snowfall
'''
SNOWFLAKE_CHARACTERS = ['\U0001f342', '\U0001f49d', '\U0001f31f', '\U0001f381']
SNOWFLAKE_IMAGE_COUNT = 15
def generate_snowfall(snowflake_image_url):
snowfall = []
for char in SNOWFLAKE_CHARACTERS:
snowfall.append(f'<span>{char}</span>')
snowfall += [f'<img src="{snowflake_image_url}">'] * SNOWFLAKE_IMAGE_COUNT
return snowfall

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

View File

@ -4,14 +4,19 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ url_for('static', filename='css/fonts.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/snowfall.css') }}">
<title>thematdev</title>
</head>
<body>
<snowfall>
{% for snowflake in snowfall %}
<snowflake>{{snowflake|safe}}</snowflake>
{% endfor %}
</snowfall>
<div class="pagehead">
<div class="pagehead-inner">
<h1 class="mainh">С Новым Годом!</h1>
<h1 class="mainh">thematdev</h1>
<p> Тут можно подпись какую-то сделать </p>
<p> Ваш IQ: {{ random_number }}</p>
<div class="btn-container">
<a class="btn" href="https://git.thematdev.org">
Git
@ -25,24 +30,11 @@
<a class="btn" href="mailto:thematdev@thematdev.org">
@
</a>
<a class="btn" href="https://codeforces.com/profile/thematdev">
CF
</a>
</div>
</div>
</div>
<div class="pagebody" id="pb">
<div class="pagebody-inner-section" id="pbi">
<h1><strike>Мои проекты</strike> Кладбище</h1>
<div class="project-container" id="pbic">
{% for project in projects %}
<div class="project-element">
<h1> {{ project.title }}</h1>
<img src="{{ url_for('static', filename=project.image)}}" width=200 height=200>
<p> {{project.description|safe}} </p>
</div>
{% endfor %}
</div>
</div>
</div>
<script src="{{ url_for('static', filename='js/projects.js') }}"></script>
Идея про Гауссово распределение вместо обычного рандома: <a href="https://t.me/Prentor">Prentor</a> и <a href="https://t.me/pavel_the_best"> pavel_the_best </a>
</body>
</html>