Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| """ | |
| This is a quick hack that adds a bulk_delete function, which given a queryset will run the Django | |
| implemented DeleteQuery. The purpose of this is when you have thousands (or in my case, millions) | |
| of records to delete, I did not want to get the pk_list of every record and store that into memory, | |
| like Django does naturally, and instead just execute a single query with its WHERE clauses. | |
| There are probably some issues with this, in regards to ForeignKeys and cascading. More info can | |
| be found in this ticket, which looks to implement a bulk_delete functionality into the core: | |
| https://code.djangoproject.com/ticket/9519 |
This gist has been migrated to a real repository: https://github.com/wolever/pip2pi
| from django.conf import settings | |
| from django.core.management.base import CommandError | |
| from optparse import make_option | |
| import re | |
| import sys | |
| try: | |
| from south.management.commands.test import Command as BaseCommand | |
| except ImportError: |
| $(document).bind('ajaxError', function(e, jqXHR){ | |
| if (jqXHR.status == 500){ | |
| var erframe = document.createElement('iframe'); | |
| $('body').append(erframe); | |
| $(erframe).css({ | |
| 'position': 'absolute', | |
| 'top': '5%', 'left': '50%', | |
| 'width': '90%', 'height': '90%', | |
| 'marginLeft': '-45%' | |
| }).attr('id', 'errorframe'); |
| from django.contrib.sessions.backends.base import SessionBase, CreateError | |
| from django.conf import settings | |
| from django.utils.encoding import force_unicode | |
| import redis | |
| class SessionStore(SessionBase): | |
| """ Redis store for sessions""" | |
| def __init__(self, session_key=None): | |
| self.redis = redis.Redis( |
| #!/bin/bash | |
| VENV=$1 | |
| if [ -z $VENV ]; then | |
| echo "usage: runinenv [virtualenv_path] CMDS" | |
| exit 1 | |
| fi | |
| . ${VENV}/bin/activate | |
| shift 1 | |
| echo "Executing $@ in ${VENV}" | |
| exec "$@" |
| /* | |
| * A simple Google maps Javascript widget which will display a map and | |
| * a marker with the ability to move the marker, then setting the | |
| * lat/lng of the marker into the specified (or default) fields. | |
| */ | |
| var google_map_location = new function() { | |
| var jQuery; | |
| var init_options; | |
| var geocoder; |
| #!/usr/bin/env python | |
| """ | |
| Run Django Tests with full test coverage | |
| This starts coverage early enough to get all of the model loading & | |
| other startup code. It also allows you to change the output location | |
| from $PROJECT_ROOT/coverage by setting the $TEST_COVERAGE_OUTPUT_DIR | |
| environmental variable. | |
| """ |