Skip to content

Instantly share code, notes, and snippets.

View douglasmiranda's full-sized avatar
👽

Douglas Miranda douglasmiranda

👽
  • Earth, Brazil
View GitHub Profile
@flavianmissi
flavianmissi / json_response_generic_view.py
Created December 13, 2011 17:57
Simple json response generic view
from django.views.generic import View
from django.utils import simplejson
class JSONResponseView(View):
def render_to_response(self, data, **httpresponse_kwargs):
"Retuns a json response based on the context"
json_data = simplejson.dumps(data)
return HttpResponse(json_data, content_type="application/json", **httpresponse_kwargs)
@andrewsmedina
andrewsmedina / Makefile
Created December 5, 2011 01:03 — forked from turicas/Makefile
Create slugs using Python
test:
clear
nosetests --with-coverage --cover-package slugfy test_slugfy.py
clean:
find -regex '.*\.pyc' -exec rm {} \;
find -regex '.*~' -exec rm {} \;
.PHONY: test clean
@douglasmiranda
douglasmiranda / 1ntro.markdown
Last active January 13, 2020 03:28
Django + git + apache mod_wsgi na Kinghost

#Django + git + apache mod_wsgi na Kinghost

NOTE: Atualmente não é necessário tanto para fazer deploy de aplicações Django na Kinghost.

I hope you like it!

##Início

Talvez você não queira ficar digitando a senha toda vez que usar o ssh, então adicione sua chave pública ao seu host:

@andrewsmedina
andrewsmedina / gist:1154225
Created August 18, 2011 14:54
python *args, **kwargs
>>> def teste(nome, idade):
... print nome, idade
...
>>> teste('andrews', 26)
andrews 26
>>> teste(nome='andrews', idade=26)
andrews 26
>>> lista = ['pacote', 200]
>>> teste(*lista)
pacote 200
@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#