Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump qs and express in /edi-calendar #44

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9eb8f2b
Adaptive design
sivukhin Nov 16, 2016
6d7dfdd
Refactore sources of adaptive_design
sivukhin Nov 16, 2016
b87ec4e
Refactor quiz code
sivukhin Nov 17, 2016
00dd7a0
Change style of gallery scroll
sivukhin Nov 17, 2016
a5f4422
Add prob theory hw
sivukhin Dec 19, 2016
9013345
Calendar
sivukhin Feb 3, 2017
555b616
Fix bug and add field for custom date
sivukhin Feb 3, 2017
6feeabc
Add events
sivukhin Feb 3, 2017
25ae02f
Remove exclamation sign in caption div
sivukhin Feb 4, 2017
8e38694
New Prob HW
sivukhin Feb 22, 2017
4a7740c
Small fix in Home work and fix calendar
sivukhin Feb 24, 2017
82f77e0
New prob theory HW
sivukhin Mar 1, 2017
d592c3f
Prob HW
sivukhin Mar 29, 2017
ac0f1b1
Fix bug in prob_theory4 solution
sivukhin Mar 29, 2017
51454c5
Add edi-calendar static files and React sources
sivukhin Sep 16, 2018
d764ae9
Fix css in edi-calendar a little
sivukhin Sep 17, 2018
4182f8e
Adjust date in edi-calendar
Umqra Dec 11, 2019
0cca2fc
Adjust date in the minified javascript
Umqra Dec 11, 2019
772da2b
Rename main.4ba9e5f9.js to main.4ba9e5f9_2.js
Umqra Dec 11, 2019
bc3f5ef
Update index.html
Umqra Dec 11, 2019
28f25de
Add garland
sivukhin Dec 13, 2019
680da89
Add string compression slides
sivukhin Sep 6, 2020
ef746b8
Update talk slides
sivukhin Sep 9, 2020
36d9e1d
Add simple quiz
sivukhin Dec 23, 2020
4a41022
Add sources for quiz
sivukhin Dec 23, 2020
55da575
Update code
sivukhin Dec 23, 2020
51af443
Update game data and production bundle
sivukhin Dec 23, 2020
b0e4c39
Update code
sivukhin Dec 24, 2020
c9102bb
Update bundle.js
sivukhin Dec 24, 2020
07c032d
Adjust layout
sivukhin Dec 24, 2020
0292d1f
Update bundle.js
sivukhin Dec 24, 2020
78825c0
update code
sivukhin Dec 25, 2020
9c57195
Update bundle
sivukhin Dec 25, 2020
a97a7f8
Bump qs and express in /edi-calendar
dependabot[bot] Dec 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
edi-calendar/build
78 changes: 78 additions & 0 deletions adaptive_design/books_quiz.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!-- head -->
<link href="quiz_style.css" rel="stylesheet" type="text/css"/>
<script src="https://blueimp.github.io/JavaScript-MD5/js/md5.js"></script>
<script src="quiz_script.js"></script>
<!-- article id:content -->
<h1 class="text_centered">Book quiz</h1>
<p>
This is simple interactive quiz where you need to guess book title by words cloud, built on text of book. Let's start!
</p>
<div class="quiz_wrapper">
<p class="text_centered quiz_area">
<span class="sub_title_text">
For the first example I choose song instead of book. Guess it!
</span>

<img class="quiz_image" src="images/book_quiz/1.png"/>
<input type="text" spellcheck="false" class="guess_input"/>
<input type="button" value="Guess" class="guess_button"/>
</p>

<p class="text_centered quiz_area">
<span class="sub_title_text">
It was easy. Guess this very interesting book.
</span>

<img class="quiz_image" src="images/book_quiz/2.png"/>
<input type="text" spellcheck="false" class="guess_input"/>
<input type="button" value="Guess" class="guess_button"/>
</p>

<p class="text_centered quiz_area">
<span class="sub_title_text">
I think you can easily cope with this.
</span>

<img class="quiz_image" src="images/book_quiz/3.png"/>
<input type="text" spellcheck="false" class="guess_input"/>
<input type="button" value="Guess" class="guess_button"/>
</p>

<p class="text_centered quiz_area">
<span class="sub_title_text">
Maybe you read it at school...
</span>

<img class="quiz_image" src="images/book_quiz/4.png"/>
<input type="text" spellcheck="false" class="guess_input"/>
<input type="button" value="Guess" class="guess_button"/>
</p>

<p class="text_centered quiz_area">
<span class="sub_title_text">
Awesome book, based on real story.
</span>

<img class="quiz_image" src="images/book_quiz/5.png"/>
<input type="text" spellcheck="false" class="guess_input"/>
<input type="button" value="Guess" class="guess_button"/>
</p>

<p class="text_centered quiz_area">
<span class="sub_title_text">
The last question in this quiz.
</span>

<img class="quiz_image" src="images/book_quiz/6.png"/>
<input type="text" spellcheck="false" class="guess_input"/>
<input type="button" value="Guess" class="guess_button"/>
</p>

<p class="text_centered quiz_area">
<span class="sub_title_text">
Great! Good job!
</span>
</p>


</div>
156 changes: 156 additions & 0 deletions adaptive_design/books_quiz.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<!DOCTYPE html>
<html>
<head>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>
Adaptive site
</title>
<link href="https://fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet"/>
<link href="style.css" rel="stylesheet" type="text/css"/>
<link href="logo_style.css" rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js">
</script>
<script src="scripts.js">
</script>
<meta charset="utf-8"/>
<link href="quiz_style.css" rel="stylesheet" type="text/css"/>
<script src="https://blueimp.github.io/JavaScript-MD5/js/md5.js">
</script>
<script src="quiz_script.js">
</script>
</head>
<body>
<div class="centered" id="main_wrapper">
<header id="header">
<div id="logo">
</div>
<div id="title">
Site with simple prekols
</div>
</header>
<div class="centering_wrapper">
<nav id="navigation">
<div class="nav_item shadowed_element">
<a href="index.html">
Main page
</a>
</div>
<div class="nav_item shadowed_element">
<a href="prekols.html">
Simple prekols
</a>
</div>
<div class="nav_item shadowed_element">
<a href="links.html">
Useful links
</a>
</div>
<div class="nav_item shadowed_element">
<a href="gallery.html">
Gallery
</a>
</div>
<div class="nav_item shadowed_element">
<a href="contacts.html">
Contacts
</a>
</div>
</nav>
</div>
<div id="site_area">
<article class="left_aligned" id="content">
<h1 class="text_centered">
Book quiz
</h1>
<p>
This is simple interactive quiz where you need to guess book title by words cloud, built on text of book. Let's start!
</p>
<div class="quiz_wrapper">
<p class="text_centered quiz_area">
<span class="sub_title_text">
For the first example I choose song instead of book. Guess it!
</span>
<img class="quiz_image" src="images/book_quiz/1.png"/>
<input class="guess_input" spellcheck="false" type="text"/>
<input class="guess_button" type="button" value="Guess"/>
</p>
<p class="text_centered quiz_area">
<span class="sub_title_text">
It was easy. Guess this very interesting book.
</span>
<img class="quiz_image" src="images/book_quiz/2.png"/>
<input class="guess_input" spellcheck="false" type="text"/>
<input class="guess_button" type="button" value="Guess"/>
</p>
<p class="text_centered quiz_area">
<span class="sub_title_text">
I think you can easily cope with this.
</span>
<img class="quiz_image" src="images/book_quiz/3.png"/>
<input class="guess_input" spellcheck="false" type="text"/>
<input class="guess_button" type="button" value="Guess"/>
</p>
<p class="text_centered quiz_area">
<span class="sub_title_text">
Maybe you read it at school...
</span>
<img class="quiz_image" src="images/book_quiz/4.png"/>
<input class="guess_input" spellcheck="false" type="text"/>
<input class="guess_button" type="button" value="Guess"/>
</p>
<p class="text_centered quiz_area">
<span class="sub_title_text">
Awesome book, based on real story.
</span>
<img class="quiz_image" src="images/book_quiz/5.png"/>
<input class="guess_input" spellcheck="false" type="text"/>
<input class="guess_button" type="button" value="Guess"/>
</p>
<p class="text_centered quiz_area">
<span class="sub_title_text">
The last question in this quiz.
</span>
<img class="quiz_image" src="images/book_quiz/6.png"/>
<input class="guess_input" spellcheck="false" type="text"/>
<input class="guess_button" type="button" value="Guess"/>
</p>
<p class="text_centered quiz_area">
<span class="sub_title_text">
Great! Good job!
</span>
</p>
</div>
</article>
<aside class="right_aligned" id="sidebar">
<div class="sidebar_item">
<a href="prekols.html">
<img class="sidebar_image" src="images/prekol_link.png"/>
<div class="image_caption">
Simple prekols
</div>
</a>
</div>
<div class="sidebar_item">
<a href="links.html">
<img class="sidebar_image" src="images/links_link.png"/>
<div class="image_caption">
Useful links
</div>
</a>
</div>
<div class="sidebar_item">
<a href="gallery.html">
<img class="sidebar_image" src="images/gallery_link.png"/>
<div class="image_caption">
Gallery
</div>
</a>
</div>
</aside>
</div>
<footer id="footer">
Sivukhin Nikita © 2016
</footer>
</div>
</body>
</html>
82 changes: 82 additions & 0 deletions adaptive_design/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/python3

import html
from bs4 import BeautifulSoup, Comment, NavigableString
import glob
import time
import sys
import subprocess
import watchdog
import os

from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler

def rebuild():
with open('template.html') as f:
template = f.read()
for name in glob.glob('*.htm'):
print(name)
template_soup = BeautifulSoup(template, 'html.parser')
file_to = os.path.splitext(name)[0] + '.html'
with open(name) as f:
content = f.read()
content_soup = BeautifulSoup(content, 'html.parser')
first_item = None
changed = []
for comment in reversed(content_soup.findAll(text=lambda text: isinstance(text, Comment))):
value = ''
start = False
new_first_item = None
for inner in comment.findNextSiblings():
new_first_item = inner if not new_first_item else new_first_item
if inner == first_item:
break
value += str(inner).strip()
first_item = new_first_item
tokens = comment.string.strip().split()
find_tag = tokens[0]
find_attributes = {}
for token in tokens[1:]:
parts = token.split(':')
if len(parts) == 2:
find_attributes[parts[0]] = parts[1]
for insert_to in template_soup.findAll(find_tag, find_attributes):
changed.append((insert_to, BeautifulSoup(value, 'html.parser')))
for change in reversed(changed):
change[0].append(change[1])

with open(file_to, 'w') as f:
f.write(template_soup.prettify())

class ChangesHandler(PatternMatchingEventHandler):
patterns = ["*.html", "*.htm"]

def process(self, event):
filename = os.path.basename(event.src_path)
if filename == 'template.html' or os.path.splitext(filename)[1] == '.htm':
try:
rebuild()
except Exception:
pass

def on_modified(self, event):
self.process(event)

def on_created(self, event):
self.process(event)

if __name__ == '__main__':
args = sys.argv[1:]
observer = Observer()
observer.schedule(ChangesHandler(), path=args[0] if args else '.')
observer.start()

rebuild()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()

observer.join()
Binary file added adaptive_design/code
Binary file not shown.
17 changes: 17 additions & 0 deletions adaptive_design/code.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <cstdio>
#include <cstdlib>

int f() {
int counter = 0;
for (double x = 0; x < 1; x += 0.1)
counter++;
printf("%d\n", counter); // prints 11
}



int main()
{
f();
return 0;
}
4 changes: 4 additions & 0 deletions adaptive_design/contacts.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- article id:content -->
<h1 class="text_centered">Contacts</h1>
<p>You can contact with me via <a href="http://telegram.me/umqra">Telegram (@umqra)</a></p>
<p>Or you can write me to <a href="mailto:[email protected]">[email protected]</a></p>
Loading