Skip to content

Instantly share code, notes, and snippets.

View littlepea's full-sized avatar

Evgeny Demchenko littlepea

View GitHub Profile
@littlepea
littlepea / middleware.py
Created March 9, 2013 01:47
SEO fix for Django 1.4 LocaleMiddleware based on this article: http://blog.yawd.eu/2012/impact-django-page-redirects-seo/
from django.conf import settings
from django.core.urlresolvers import is_valid_path
from django.http import HttpResponsePermanentRedirect
from django.middleware.locale import LocaleMiddleware
from django.utils import translation
from django.utils.cache import patch_vary_headers
class UpdatedLocaleMiddleware(LocaleMiddleware):
def process_response(self, request, response):
from fabric.api import run, local, task
@task(alias='hd')
def heroku_deploy(scale='yes', runtime='no', runtime_version=None):
"""
Deploys heroku app
Usage examples:
@littlepea
littlepea / kill.sh
Created February 1, 2013 07:25
shell
echo "Kill processes containing '$1'"
ps aux | grep $1 | grep -v grep | awk '{print$2}' | xargs kill -9
@littlepea
littlepea / demorest - place checkin
Created February 22, 2012 12:39
/api/v1/places/1/checkin
{
"response": {
"status": "success",
"meta": {},
"data": {
"checkin": {
"time": 6,
"id": null,
"user": {
"username": "yy",
@littlepea
littlepea / demorest - place details
Created February 22, 2012 12:29
/api/v1/places/1?lat=111&lng=111
{
"response": {
"meta": {},
"data": {
"distance": 0,
"name": "北京",
"lat": 111,
"lng": 111,
"checkins": [
{