Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am evanbeard on github.
* I am evanbeard (https://keybase.io/evanbeard) on keybase.
* I have a public key whose fingerprint is 0428 FAF6 4974 4DEC 62ED 5CFC 4578 A4B5 963C 426B
To claim this, I am signing this object:
@evanbeard
evanbeard / registrations_controller.rb
Created May 11, 2012 19:53 — forked from jwo/registrations_controller.rb
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@evanbeard
evanbeard / Django_JSONP_Decorator.py
Created September 27, 2010 21:33
A Django JSONP Decorator
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
class AllowJSONPCallback(object):
"""This decorator function wraps a normal view function
so that it can be read through a jsonp callback.
Usage:
@AllowJSONPCallback