A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| #!/bin/bash | |
| ##################################################### | |
| # Name: Bash CheatSheet for Mac OSX | |
| # | |
| # A little overlook of the Bash basics | |
| # | |
| # Usage: | |
| # | |
| # Author: J. Le Coupanec | |
| # Date: 2014/11/04 |
| " copy all this into a vim buffer, save it, then... | |
| " source the file by typing :so % | |
| " Now the vim buffer acts like a specialized application for mastering vim | |
| " There are two queues, Study and Known. Depending how confident you feel | |
| " about the item you are currently learning, you can move it down several | |
| " positions, all the way to the end of the Study queue, or to the Known | |
| " queue. | |
| " type ,, (that's comma comma) |
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.
# pulling one User object
user = User.query.get(1)
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import subprocess | |
| import re | |
| ntfs_pattern = re.compile(r'File System Personality: NTFS') | |
| ntfs_device_node = re.compile(r'.*Device Node:.*') | |
| device_dict = {} |
| # From http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html | |
| export MARKPATH=$HOME/.marks | |
| function jump { | |
| cd -P $MARKPATH/$1 2> /dev/null || echo "No such mark: $1" | |
| } | |
| function mark { | |
| mkdir -p $MARKPATH; ln -s $(pwd) $MARKPATH/$1 | |
| } | |
| function unmark { | |
| rm -i $MARKPATH/$1 |