Skip to content

Instantly share code, notes, and snippets.

@maccman
maccman / jquery.ajax.queue.coffee
Last active January 13, 2018 12:03
Queueing jQuery Ajax requests. Usage $.ajax({queue: true})
$ = jQuery
queues = {}
running = false
queue = (name) ->
name = 'default' if name is true
queues[name] or= []
next = (name) ->
@davidfraser
davidfraser / OfficeCleaner.py
Created March 19, 2013 08:24
Clean up XHTML by removing extraneous things - in particular those generated by copying and pasting out of Microsoft Office products
import cssutils
from xml.sax import saxutils
from lxml.html import tostring, fromstring, clean
from lxml import etree
import logging
class Cleaner(clean.Cleaner):
def clean_html(self, html):
if not isinstance(html, unicode):
@electroniceagle
electroniceagle / dropdown.html
Created August 4, 2012 03:00
django mezzanine alternative dropdown menu with login_required filter
{# place this at templates/pages/menus/dropdown.html to override the mezzanine dropdown menu #}
{% load i18n pages_tags %}
{% spaceless %}
{% if page_branch_in_menu %}
{% if branch_level == 0 %}
<ul class="nav pull-right">
{% for page in page_branch %}
{% if page.in_menu %}
{% if page.login_required and request.user.is_authenticated or not page.login_required %}