Skip to content

Instantly share code, notes, and snippets.

Avatar

Oliver George olivergeorge

  • Tasmania, Australia
View GitHub Profile
@olivergeorge
olivergeorge / example-vhost.conf
Created Oct 3, 2009
Good Apache vhost defaults
View example-vhost.conf
<Directory ~ ".*\.svn">
Order allow,deny
Deny from all
Satisfy All
</Directory>
View README
Tweaked Django project template (based on django-admin.py startproject myproject).
View README
Tweaked django application templates (based on "django-admin startapp myapp")
View jquery-tinymce-example.js
<!-- Load jQuery -->
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3");
</script>
<!-- Load jQuery build -->
<script type="text/javascript" src="<your installation path>/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
View Git tips and tricks
# SETUP A LOCAL COPY OF A REMOTE BRANCH
# From: the github branch called "foo-qa"
# To: local branch called "qa"
go -t -b qa origin/foo-qa
# REMOTE PUSH
# From: local branch called "qa"
# To: the github branch called "foo-qa"
@olivergeorge
olivergeorge / forms.py
Created Dec 20, 2009
Django form validation logic helpers
View forms.py
from models import *
from django import forms
from django.forms.util import ErrorList
class PatientAdminForm(forms.ModelForm):
class Meta:
model = Patient
def require_fields(self, *fields):
View gist:718687
from django.core.exceptions import ValidationError
from django.db.models import Field, CharField
__all__ = ['MultiColumnField']
try:
from hashlib import md5
except ImportError:
from md5 import new as md5
@olivergeorge
olivergeorge / google_doc_downloader.py
Created Dec 1, 2010
Download documents from Google Docs in doc, html, zip and pdf format. Note: zip=html+images
View google_doc_downloader.py
import gdata.docs.data
import gdata.docs.client
import re
def print_feed(feed):
if not feed.entry:
print 'No entries in feed.'
for entry in feed.entry:
print entry.title.text.encode('UTF-8'), entry.GetDocumentType(), entry.resource_id.text
@olivergeorge
olivergeorge / handler.py
Created Jan 30, 2011
Simple use case of Django Piston
View handler.py
from piston.handler import BaseHandler
from myapp.models import Blogpost
class BlogpostHandler(BaseHandler):
allowed_methods = ('GET',)
model = Blogpost
# fields = ('title', 'description', ('tags', ('name')))
def read(self, request, blogpost_id=None):
"""
@olivergeorge
olivergeorge / form_logic.html
Created Feb 20, 2011
Experiment in using backbone to manage form logic
View form_logic.html
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script>
<script src="http://www.plexical.com/sandbox/jsdeps/json2.js"></script>
<script src="http://www.plexical.com/sandbox/jsdeps/underscore.js"></script>
<script src="http://www.plexical.com/sandbox/jsdeps/backbone.js"></script>
<script type="text/javascript" charset="utf-8">
$(function(){