Skip to content

Instantly share code, notes, and snippets.

View rajagopalx's full-sized avatar
😊

Rajagopal rajagopalx

😊
View GitHub Profile
@rajagopalx
rajagopalx / kwacros.py
Created July 27, 2016 20:36 — forked from skyl/kwacros.py
Django Template macros with args and kwargs
#
# templatetags/kwacros.py - Support for macros in Django templates
#
# Based on snippet by
# Author: Michal Ludvig <michal@logix.cz>
# http://www.logix.cz/michal
#
# modified for args and kwargs by Skylar Saveland http://skyl.org
#
@rajagopalx
rajagopalx / .htaccess
Last active June 22, 2016 04:04 — forked from revolunet/.htaccess
global enable CORS without touching code
# with AJAX withCredentials=false (cookies NOT sent)
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]]
# with AJAX withCredentials=true (cookies sent, SSL allowed...)
SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1