/Users/alelevier/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/pdb.sublime-snippet
<snippet>
| from nose.result import TextTestResult as NoseTextTestResult | |
| class TextTestResult(NoseTextTestResult): | |
| def getDescription(self, test): | |
| """ | |
| Overrides the default test header, so the failed test name | |
| can be copied as is and syntax works to be able to run the | |
| single test "as copied" from this output. |
| pullandpush () { | |
| if [ $# -eq 0 ] | |
| then | |
| echo "branch name not specified" | |
| else | |
| branch=$1 | |
| git checkout master | |
| git pull --rebase | |
| git checkout $branch | |
| git rebase origin/master |
| testuntilfail () { | |
| if [ $# -eq 0 ] | |
| then | |
| echo "Django test path must be specified" | |
| else | |
| RUNS_BEFORE_FAILURE=0 | |
| while [ $? = 0 ]; do | |
| let RUNS_BEFORE_FAILURE=RUNS_BEFORE_FAILURE+1 | |
| echo "Beginning run number: $RUNS_BEFORE_FAILURE" | |
| ./manage.py test $1 |
| alias gitlog='git log --pretty=format:"%h%x09%an%x09%ad%x09%s"' | |
| alias gs='git status' | |
| alias gd='git diff' | |
| alias gds='git diff --staged' | |
| alias gl='git log' | |
| alias ga='git add' | |
| alias gb='git branch' | |
| alias gc='git commit' | |
| alias gco='git checkout' | |
| alias gpr='git pull --rebase' |
| backupdb () { | |
| if [ $# -eq 0 ] | |
| then | |
| echo "db_name not specified" | |
| else | |
| db_name=$1 | |
| db_name_copy=${db_name}_copy | |
| psql -c "DROP DATABASE $db_name_copy;" | |
| psql -c "CREATE DATABASE $db_name_copy WITH TEMPLATE $db_name;" | |
| fi |
| import requests | |
| import json | |
| url = "https://tidesandcurrents.noaa.gov/api/datagetter?begin_date=20170816&end_date=20170816&station=9410230&datum=MLLW&product=predictions&units=english&time_zone=lst&format=json" | |
| r = requests.get(url, headers=headers) | |
| content = r.content.decode('utf8') | |
| if 'wrong' not in content.lower(): | |
| try: | |
| data = json.loads(content) | |
| except Exception: |
| drop database ci_copy; | |
| create database ci_copy with template ci; | |
| \q | |
| drop database ci; | |
| create database ci with template ci_copy; | |
| \q | |
| drop database persistent_copy; | |
| create database persistent_copy with template persistent; |
/Users/alelevier/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/pdb.sublime-snippet
<snippet>
def func(x, y, *args, **kwargs):
"""Summary
Parameters:
x (int) : first parameter
y: second parameter
with longer description
Raises:Got this error when changing a ManyToMany 'through' table name
(django19)[~/Documents/bsrs/bsrs-django/bigsky]$ ./manage.py migrate
Operations to perform:
Apply all migrations: accounting, category, flatpages, contenttypes, admin, sites, person, ticket, auth, work_request, dtd, third_party, work_order, location, contact, generic, setting, translation, sessions, utils
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.