I wanted to write it when I realized Pieter is dying. Thanks God he have been waiting on my article all the time! It is not well thought or structured, just a simple dump of my memory.
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
""" | |
Startup script for Python interactive mode | |
Add these two lines to .bashrc: | |
PYTHONSTARTUP="$HOME/.pythonrc.py" | |
export PYTHONSTARTUP | |
""" | |
import sys, os, readline, atexit |
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
*.pyc |
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
def test_classic_way_with_asserts(testdb): | |
campaign_id = insert_fixture_campaign(testdb) | |
app = App(testdb) | |
response = app.get_campaign(campaign_id) | |
assert response['name'] == 'Test campaign' | |
assert response['slug'] == 'test-campaign' | |
assert response['targeting']['segment'] == 'customers' | |
# assert ... |
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
//How would you change the second line in the following example so that it prints numbers 0, 1, 2, 3 in this order? | |
//Please answer fill only to the registration form for MSD Code Academy :-) | |
for (var i = 0; i < 4; i++) { | |
setTimeout(() => console.log(i), 0) | |
} | |
//A: By changing line 2) ... (function(number) { setTimeout(() => console.log(number), 0)})(i) | |
//B: By changing line 1) ... for (let i = 0; i < 4; i++) { | |
//C: By changing line 2) ... var temp = i; setTimeout(() => console.log(temp), 0) | |
//D: By changing line 2) ... setTimeout((i) => console.log(i), 0) |
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
//Given the following code, I understand what the output will be | |
//Please answer fill only to the registration form for MSD Code Academy :-) | |
const obj = { | |
name: 'John', | |
getName () { | |
return this.name; | |
} | |
}; | |
const name1 = obj.getName(); |
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
from random import randrange | |
cislo = randrange(3) | |
print(cislo) | |
if cislo == 0: | |
tah_pocitace= "kámen" | |
elif cislo == 1: | |
tah_pocitace = "nůžky" | |
else: | |
tah_pocitace = "papír" |
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
#!/usr/bin/env python3 | |
import asyncio | |
import multiprocessing | |
import os | |
import ssl | |
from time import sleep | |
port = 9000 |
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
def vypis_hezky_nasobilku(maximum): | |
for radek in range(maximum): | |
for sloupec in range(maximum): | |
# formátování viz https://naucse.python.cz/2019/pyladies-praha-jaro-ntk/beginners/str/ | |
# Do {} lze zapsat, jak má výstup vypadat viz https://pyformat.info/ | |
# : - pomocný znak, > - zarovnat vpravo, 3 - šířka na 3 znaky | |
print('{:>3}'.format(radek * sloupec), end=' ') | |
print() | |
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
from reportlab.pdfbase import pdfmetrics | |
from reportlab.pdfbase.ttfonts import TTFont | |
FONT = os.path.join(settings.PROJECT_PATH, 'path/to/verah.ttf') | |
FONT_BOLD = os.path.join(settings.PROJECT_PATH, 'path/to/verahb.ttf') | |
FONT_NAME = "ticket_font" | |
FONT_BOLD_NAME = "ticket_font_bold" | |
FONT_FAMILY = "ticket_font_family" |
OlderNewer