Skip to content

Instantly share code, notes, and snippets.

Avatar
😊

Rajagopal rajagopalx

😊
View GitHub Profile
@rajagopalx
rajagopalx / kwacros.py
Created Jul 27, 2016 — forked from skyl/kwacros.py
Django Template macros with args and kwargs
View kwacros.py
#
# 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 Jun 22, 2016 — forked from revolunet/.htaccess
global enable CORS without touching code
View .htaccess
# 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