Skip to content

Instantly share code, notes, and snippets.

var showRebookDialog = function () {
var $conversation = $(this).closest('.conversation');
var providerUrl = $conversation.attr('data-provider-url');
var requesterUrl = $conversation.attr('data-requester-url');
$.getJSON(providerUrl, function (provider) {
$.getJSON(requesterUrl, function (requester) {
var view = new RebookDialogView({
el: '.js-rebook-dialog-container',
sender: provider,
receiver: requester,
BeautifulSoup==3.2.1
Django==1.4.8
FuelSDK==0.9.0
GnuPGInterface==0.3.2
Landscape-Client==12.05
M2Crypto==0.22.3
Mako==0.7.3
Markdown==2.3.1
MarkupSafe==0.15
MySQL-python==1.2.3
@professorplumb
professorplumb / more_itertools.py
Created July 26, 2013 00:47
Several Python sequence-related functions I find myself using over and over again and tire of reimplementing. :) These probably all originally came from StackOverflow answers of one sort or another.
from itertools import tee, izip, izip_longest
def pairwise_overlapping(iterable, n=2):
"""
Given a sequence, returns a list of pairs/tuples of length n, each comprised of sequential values
from the sequence. Each tuple starts with the subsequent value from the original sequence.
>>> s = 1, 2, 3, 4, 5
>>> list(pairwise_overlapping(s))
@professorplumb
professorplumb / tastypie_related_resources.py
Last active December 19, 2015 23:49
When displaying resources for a one-to-many model relationship in Tastypie, I often find myself using a pattern where the "base" (one) model has a URI to its associated collection of "related" (many) models. I wrote this gist which patches the resource classes to automatically add in the URI field, URL pattern, and related list view functions. S…