Skip to content

Instantly share code, notes, and snippets.

@wengole
wengole / conf.py
Last active October 13, 2015 13:31 — forked from ferrouswheel/conf.py
Sphinx add-on to annotate Django models based on fields and their help_text.Based on https://djangosnippets.org/snippets/2533/ - but adds ForeignKey resolution, and ensure field.rel.to is an actual model instead of a string.
import sys, os
local_path = lambda path: os.path.join(os.path.dirname(__file__), path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'PROJECTNAME.settings'
sys.path.append(local_path('..'))
... # Rest of conf.py goes here
@wengole
wengole / angular-directives.md
Last active August 29, 2015 14:26 — forked from mikesigs/angular-directive-priority.md
Angular.js directives sorted by priority
Directive Priority Terminal Creates new scope Can be used as multiElement
ngSwitch 1200 X
ngNonBindable 1000 X
ngRepeat 1000 X X X
ngIf 600 X X X
ngController 500 X
ngInit 450
ngInclude 400 X X
ngView 400 X
def extract_and_add(file_upload, obj, workspace=None, token=None):
"""Extracts temporary attachments from storage and attaches them into `obj`
Extract file data `from file_upload`, create file/image objects and add
them as attachments to ``obj``. If workspace and token are given, reuse
previously uploaded temporary attachments if they exist.
"""
  • Update HISTORY.rst
  • Update version number in my_project/__init__.py
  • Update version number in setup.py
  • Install the package again for local development, but with the new version number:
python setup.py develop
  • Run the tests:
python setup.py test
@wengole
wengole / gist:da32d292b42b9195ceaf
Last active November 9, 2017 18:35
Install xapian and bindings for python3 inside virtualenv
export VENV=$VIRTUAL_ENV
mkdir $VENV/packages && cd $VENV/packages
export XAP_VER=1.3.2
curl -O http://oligarchy.co.uk/xapian/$XAP_VER/xapian-core-$XAP_VER.tar.xz
curl -O http://oligarchy.co.uk/xapian/$XAP_VER/xapian-bindings-$XAP_VER.tar.xz
tar xvf xapian-core-$XAP_VER.tar.xz
tar xvf xapian-bindings-$XAP_VER.tar.xz
<aside class="sidebar left tagging-off" id="sidebar" tal:attributes="data-tile string:${workspace_url}/@@sidebar.tile">
<div class="" id="" tal:attributes="data-tile string:${workspace_url}/@@navigation.tile">
</div>
</aside>
apt-get install zlib1g-dev
apt-get install g++
export VENV=$VIRTUAL_ENV
mkdir $VENV/packages && cd $VENV/packages
XAPIAN_VERSION=1.2.20
curl -O http://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-core-$XAPIAN_VERSION.tar.xz
curl -O http://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-bindings-$XAPIAN_VERSION.tar.xz