Skip to content

Instantly share code, notes, and snippets.

View stefanbackor's full-sized avatar

Štefan Bačkor stefanbackor

View GitHub Profile
@stefanbackor
stefanbackor / admin.py
Last active August 29, 2015 14:22
Django Grappelli Admin: sidebar changelist with filter highlight
from django.contrib import admin
class AdminChangelistMixin(admin.ModelAdmin):
change_list_template = "grappelli-overrides/change_list_filter_sidebar.html"
change_list_filter_template = "grappelli-overrides/filter.html"
pass
# Originally from marc-w.com
# Built and tested on Django 1.6
# NOTE: this is not bulletproof for sql injection, but works with INSERT .. SELECT FROM queries.
# thats why you should wrap strings into "" on your own.
from django.db import connection, transaction
class BulkInsertManager(models.Manager):
@stefanbackor
stefanbackor / autodiscover xml
Last active August 29, 2015 14:00
Notes on now email clients check autodiscover domain settings.
• Autodiscover posts request to https://domain.com/Autodiscover/Autodiscover.xml.
where the domain.com is the email domain part of the email address used in account settings.
• Autodiscover posts request to https://autodiscover.domain.com/Autodiscover/Autodiscover.xml.
Autodiscover performs the following redirect check: GET http://autodiscover.domain.com/Autodiscover/Autodiscover.xml
where the domain.com is the email domain part of the email address used in account settings.
• Autodiscover uses DNS SRV lookup for _autodiscover._tcp.domain.com, if it exists, the "mail.domain.com" is returned.
where the email domain in _autodiscover._tcp.domain.com request is email domain name and the email domain name in mail.domain.com response is DNS name of the Kerio Connect server.
Autodiscover posts request to https://mail.domain.com/autodiscover/autodiscover.xml.
Configuration server at ISP
// Speed up your webapp click response using jQuery..
/*
Use case: Lets suppose we are using XMLHttpRequest Ajax calls for page content change - expecting html return to just redraw page container, not whole layout
Solution: Use mousedown instead of click if possible. Don't forget to bypass if any function key or other than left click pressed.
*/
$(document).on("mousedown","a[href^='/']",basicAjaxEvent);
$(document).on("click","a[href^='/']",basicAjaxEvent);
function basicAjaxEvent(e){