-
Install corkscrew
-
Setup corkscrew auth file
echo your_proxy_username:your_proxy_password > ~/.corkscrew_auth
-
Add to
~/.ssh/config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install watchdog | |
watchmedo auto-restart --directory=. ./manage.py -- run_gunicorn --workers=15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.gis.geos import MultiPolygon, Polygon, LinearRing | |
def to_mpoly(osmosis_file): | |
""" Parse an Osmosis polygon filter file | |
Accept a sequence of lines from a polygon file, | |
return a django.contrib.gis.MultiPolygon object. | |
http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L.Icon.Hover = L.Icon.extend({ | |
options: { | |
iconSize: new L.Point(25, 41), | |
iconAnchor: new L.Point(13, 41), | |
popupAnchor: new L.Point(1, -34), | |
shadowSize: new L.Point(41, 41) | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Modified from: https://gist.github.com/967274 | |
CHANGES: | |
* Serialize pk in feature.id and remove from feature.properties | |
* Added default date format and time format for encoder | |
* Allow geometryfield option, which doesn't have to be a field, e.g. a @property | |
USAGE: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create div and call animate on it, from start to end colour for the duration | |
// for each step of the colour change, invoke the callback | |
function fadeColour(start_colour, end_colour, duration, callback) { | |
var ele = $('<div></div>'); | |
$(ele).css('color', start_colour); | |
$(ele).animate({ | |
color: end_colour | |
}, { | |
duration: duration, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
L.EditableCircleMarker is a marker with a radius | |
The marker can be moved and the radius can be changed | |
*/ | |
L.EditableCircleMarker = L.Class.extend({ | |
includes: L.Mixin.Events, | |
options: { | |
weight: 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
GeoJSON layer with mouse hover events to properties for each feature | |
Requires JQuery to handle the AJAX requests | |
Currently only supports FeatureCollections | |
Features must have ID's, so they can be deduplicated across tiles (not rendered twice). | |
*/ | |
/* | |
Control that shows HTML content for a point on hover | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Django view to generate a gradient image. | |
Inputs: | |
* colour_model: "rgb" or "hsl" | |
* direction: "horizontal" or "vertical" | |
* start_rgb: hex colour string, e.g: #BADA55 | |
* end_rgb: hex colour string, e.g: #BEEFED | |
* width: image pixel height | |
* height: image pixel width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install django-orm-extensions | |
from django.contrib.gis.db.models.query import GeoQuerySet | |
from django.contrib.gis.db.models import GeoManager | |
from django_orm.postgresql.hstore.queryset import HStoreQuerySet | |
from django_orm.postgresql.hstore.manager import HStoreManager | |
class GeoHStoreQuerySet(GeoQuerySet, HStoreQuerySet): | |
pass |