Skip to content

Instantly share code, notes, and snippets.

View domguard's full-sized avatar

domguard

  • Europe occidentale
  • 03:59 (UTC +02:00)
View GitHub Profile
@fcurella
fcurella / django_postgis_on_os_x.md
Created July 27, 2012 15:22
Django and Postgis on OS X

Django and Postgis on OS X

Install Homebrew

Install a few things with homebrew:

Notice that some packages give you information at the end, read it carefully. To recall that info use brew info like this: $ brew info postgresql

$ brew install python --universal
@melvincarvalho
melvincarvalho / MyProfile
Created July 10, 2012 09:46
command line to MyProfile
#!/usr/bin/env python
import urllib
import httplib2
cert_file = 'e.pem'
http = httplib2.Http(disable_ssl_certificate_validation=True)
http.add_certificate('', cert_file, domain='')
@deiu
deiu / delegated-webid.py
Created July 6, 2012 11:03
Uses a certificate (in PEM) to authenticate (through WebID) and access a protected page.
#!/usr/bin/env python
import urllib
import httplib2
cert_file = 'my.pem'
http = httplib2.Http(disable_ssl_certificate_validation=True)
http.add_certificate('', cert_file, domain='')
@IlianIliev
IlianIliev / fabfile.py
Created May 28, 2012 11:04
Fabric script that eases the creation of new Django Project
"""
This fabric script automates the creation of a virtual environment and a Django
project. The result will be virtual environtment with the name of the project.
The folder namer where the project code will be placed is specified in
SOURCE_DIRECTORY_NAME, a static root folder will be created and settings.py
will be updated.
"""
try:
from fabric.api import env, run, local
from fabric.context_managers import lcd, prefix
@stephenmcd
stephenmcd / patch_extend_node.py
Created May 8, 2012 12:00
Allow circular Django template inheritance, so projects can both override and extend a reusable app's templates.
from django.template.loader_tags import ExtendsNode
def get_extends_parent(self, context):
"""
Patched onto Django's ``ExtendsNode.get_parent`` which is
responsible for loading the template to extend from with
the ``extends`` template tag.
This patch allows the template foo/bar.html to extend
foo/bar.html, given that there is another version of it that
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@mourner
mourner / TileLayer.Common.js
Created February 11, 2012 23:11
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@jgsogo
jgsogo / LimitedAdminInlineMixin.py
Created February 3, 2012 19:43 — forked from dokterbob/admin.py
InlineAdmin mixin limiting the selection of related items according to criteria which can depend on the current parent object being edited.
import logging
logger = logging.getLogger('commerce')
class LimitedAdminInlineMixin(object):
"""
InlineAdmin mixin limiting the selection of related items according to
criteria which can depend on the current parent object being edited.
A typical use case would be selecting a subset of related items from
other inlines, ie. images, to have some relation to other inlines.
@rolo
rolo / gist:1481128
Created December 15, 2011 13:44
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
if not hasattr(ForeignModel, "tags"):
t = TaggableManager()
t.contribute_to_class(ForeignModel, "tags")