Escreva quase tudo no singular, é mais fácil.
- project: singular
- app: singular
- model: singular
- field: singular
- FK related_name: plural
- url: plural
- views: singular
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.""" |
##git mergetool
In the middle file (future merged file), you can navigate between conflicts with ]c
and [c
.
Choose which version you want to keep with :diffget //2
or :diffget //3
(the //2
and //3
are unique identifiers for the target/master copy and the merge/branch copy file names).
:diffupdate (to remove leftover spacing issues)
:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)
#!/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 |