- If you can't test the code efficiently, refactor the code.
- Don't hardcode URLs in views, templates and tests. (Use
revert
instead?) - Use named views and reverse URL resolution, instead.
- Never refactor against failing UNIT tests.
- Don't forget the REFACTOR on 'Red, Green, Refactor'.
- Tests makes possible using the application state as a save-points for refactors. Once you get to them again, you'll know your refactoring is done.
- Every single FT doesn't need to test every single part of your application, but use caution when de-duplicating your FTs. (FTs exist to catch unpredictable interactions between different parts of your application, after all)
- Use loggers named after the module you're in. Follow the
logging.getLogger(__filename__)
pattern to get a logger that's unique to your module, but that inherits from a top-level configuration you control.
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
[global_config] | |
title_hide_sizetext = True | |
title_transmit_bg_color = "#3686d9" | |
tab_position = bottom | |
[keybindings] | |
[profiles] | |
[[default]] | |
scrollbar_position = hidden | |
palette = "#2d2d2d:#f2777a:#99cc99:#ffcc66:#6699cc:#cc99cc:#66cccc:#d3d0c8:#747369:#f2777a:#99cc99:#ffcc66:#6699cc:#cc99cc:#66cccc:#f2f0ec" | |
background_image = None |
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
\[\033[38;5;10m\]\u@\h:\[(B[m\]\[\033[38;5;6m\]\w\[(B[m\]\[\033[38;5;15m\]\n\[[1m\]\[(B[m\]\[\033[38;5;190m\]λ\[(B[m\]\[(B[m\]\[\033[38;5;15m\] \[(B[m\] |
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
filetype plugin indent on | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
syntax on | |
set t_Co=256 | |
colorscheme badwolf | |
map <F7> :tabp<CR> |
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
import re | |
import sys | |
import yaml | |
from bs4 import BeautifulSoup | |
field_types = { | |
'Branco(s)': None, | |
'Zero(s)': None, | |
'R$': 'decimal', |
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
import rows | |
from collections import Counter | |
base_svg = '/path/to/drawing.svg' | |
base_name = 'Fulano de Tal e Coisa' | |
participants_table = rows.import_from_csv('/path/to/pyse-participantes.csv') | |
with open(base_svg) as f: | |
svg = f.read() |
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
import psycopg2 | |
from itertools import chain, permutations | |
from graphviz import Digraph | |
DB_SETTINGS = dict( | |
host='localhost', | |
database='database_name', | |
user='user', | |
password='*****', |
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
import zipfile | |
from io import BytesIO | |
def zipwalk(current_file, curr_path=''): | |
"""Recursively walks into a zipped file tree while yielding non-zipped | |
files content. | |
""" | |
data = BytesIO(current_file.read()) |
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 python | |
import json | |
import sys | |
def pprint_specfile(path, filters): | |
record_fmt = '{r[name]}: {r[label]}' | |
field_fmt = ' {f[order]}-{f[name]}' |
OlderNewer