Skip to content

Instantly share code, notes, and snippets.

@renooble
renooble / autocomplete_address.js
Created January 28, 2014 03:29
autocomplete address with
// this is the get the address with hitting the enter button without submitting
$(function() {
$("#id_address")
.geocomplete()
.bind("geocode:result", function(event, result){
$.log(result.formatted_address);
@renooble
renooble / fabfile.py
Last active December 14, 2015 10:59
update_testing site
from fabric.api import *
from fabric.contrib.files import sed
from fabric.operations import run
def update_testing():
dep_path = "/home/user/webapps/testing_site/mysite"
parent = "origin"
branch = "master"
run("cd %s; git pull %s %s" % (dep_path, parent, branch))
@renooble
renooble / views.py
Last active December 14, 2015 10:28
Decorating Django methods
# source: https://docs.djangoproject.com/en/1.4/topics/auth/#the-login-required-decorator
from django.contrib.auth.decorators import login_required
@login_required
def my_view(request):
...
@renooble
renooble / gist:5070373
Last active December 14, 2015 10:10
Transferring Django flatpages from the local testing server to the production server
> Dump all flatpages into a json file
$ python manage.py dumpdata flatpages --indent=2 > /folder/to/flatpage/app/backup.json
> Add the backup file to the latest git commit
$ git add /folder/to/flatpage/app/backup.json
$ git commit -m "Flatpage sql dump for production"
$ git push
> On the production server
$ git pull