Escreva quase tudo no singular, é mais fácil.
- project: singular
- app: singular
- model: singular
- field: singular
- FK related_name: plural
- url: plural
- views: singular
| Copyright 2023 Carl Mercier | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE |
Escreva quase tudo no singular, é mais fácil.
| """ | |
| Add mypy type-checking cell magic to jupyter/ipython. | |
| Save this script to your ipython profile's startup directory. | |
| IPython's directories can be found via `ipython locate [profile]` to find the current ipython directory and ipython profile directory, respectively. | |
| For example, this file could exist on a path like this on mac: | |
| /Users/yourusername/.ipython/profile_default/startup/typecheck.py |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # This is how I used it: | |
| # $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history | |
| import sys | |
| import time |
| -- Create a group | |
| CREATE ROLE readaccess; | |
| -- Grant access to existing tables | |
| GRANT USAGE ON SCHEMA public TO readaccess; | |
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
| -- Grant access to future tables | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
| [merge] | |
| tool = vimdiff | |
| [mergetool] | |
| prompt = true | |
| [mergetool "vimdiff"] | |
| cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J' | |
| [difftool] | |
| prompt = false | |
| [diff] | |
| tool = vimdiff |
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals, absolute_import, division | |
| import pytest | |
| from django_webtest import DjangoTestApp, WebTestMixin | |
| class Stub(object): | |
| """Stub methods, keep track of calls.""" |
| #!/usr/bin/python | |
| import os | |
| from itertools import groupby | |
| from shutil import rmtree | |
| from pkg_resources import parse_version | |
| def main(): | |
| """Strips the buildout cache from older egg versions |
| #!/bin/sh | |
| REPOSRC=$1 | |
| LOCALREPO=$2 | |
| # We do it this way so that we can abstract if from just git later on | |
| LOCALREPO_VC_DIR=$LOCALREPO/.git | |
| if [ ! -d $LOCALREPO_VC_DIR ] | |
| then |
| # Removes whitespace chars from blank lines | |
| pep8 -r --select=W293 -q --filename=*.py /usr/local/src/madrona/madrona/ | xargs sed -i 's/^[ \r\t]*$//' | |
| # Removes trailing blank lines from files | |
| pep8 -r --select=W391 -q --filename=*.py /usr/local/src/madrona/madrona/ | xargs sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' | |
| # Squashes consecutive blanks lines into one | |
| pep8 -r --select=E303 -q --filename=*.py /usr/local/src/madrona/madrona/ | xargs sed -i '/./,/^$/!d' | |
| # confirm |