A Pen by Alexander Hultnér on CodePen.
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
-- You vaguely remember that the crime was a murder | |
-- that occurred sometime on Jan.15, 2018 and that | |
-- it took place in SQL City. | |
/* | |
select * | |
from crime_scene_report csr | |
where | |
csr.date = '20180115' | |
and type = 'murder' | |
and lower(city) = 'sql city' |
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: https://www.python.org/dev/peps/pep-0572/#syntax-and-semantics | |
# Handle a matched regex | |
if (match := pattern.search(data)) is not None: | |
# Do something with match | |
# A loop that can't be trivially rewritten using 2-arg iter() | |
while chunk := file.read(8192): | |
process(chunk) |
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
sample_data = [ | |
{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": False}, | |
{"userId": 1, "id": 2, "title": "quis ut nam facilis", "completed": False}, | |
{"userId": 1, "id": 3, "title": "fugiat veniam minus", "completed": False}, | |
{"userId": 1, "id": 4, "title": "et porro tempora", "completed": True}, | |
{"userId": 1, "id": 4, "title": None, "completed": True}, | |
] | |
print("With Python 3.8 Walrus Operator:") | |
for entry in sample_data: |
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
$ pyenv shell 3.8-dev | |
$ python --version | |
$ python |
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
$ pyenv install --list | grep 3.8 | |
$ pyenv install 3.8-dev |
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
$ pyenv install --list | grep 3.8 | |
$ pyenv install 3.8-dev |
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
# Install zlib | |
brew install zlib | |
# Add zlib-variables to your shell. | |
tee -a ~/.profile <<<CONF | |
export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig" | |
export LDFLAGS="-L/usr/local/opt/zlib/lib" | |
export CPPFLAGS="-I/usr/local/opt/zlib/include" | |
CONF |
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
$ brew update | |
$ brew install pyenv |
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
# content of conftest.py | |
import pytest | |
import os.path | |
@pytest.hookimpl(tryfirst=True, hookwrapper=True) | |
def pytest_runtest_makereport(item, call): | |
# execute all other hooks to obtain the report object | |
outcome = yield |