Skip to content

Instantly share code, notes, and snippets.

Travis Tilley ttilley

Block or report user

Report or block ttilley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:571030
class QuerySetDoubleIteration(Exception):
"A QuerySet was iterated over twice, you probably want to list() it."
pass
# "Skinny" here means we use iterator by default, rather than
# ballooning in memory.
class SkinnyManager(Manager):
def get_query_set(self):
return SkinnyQuerySet(self.model, using=self._db)
View search.coffee
dojo.provide 'cdoc.mixins.search'
dojo.require "dijit.form.ValidationTextBox"
dojo.require "dijit.layout.BorderContainer"
dojo.require "dijit.layout.ContentPane"
dojo.require "dojo.data.ItemFileReadStore"
dojo.require "cdoc.string.quicksilver"
dojo.declare "cdoc.mixins.search", [dijit.layout.BorderContainer], {
title: "Mixins"
View quicksilver.coffee
cdoc.string.quicksilver: (string, abbreviation, offset) ->
offset: or 0
len: abbreviation.length
return 0.9 if len is 0
return 0.0 if len > string.length
for i in [len...0]
sub_abbreviation: abbreviation.substring 0, i
You can’t perform that action at this time.