This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cStringIO import StringIO | |
from decimal import Decimal | |
from PIL import Image | |
from urllib2 import urlopen | |
from django.db import transaction | |
from django.core.files.base import ContentFile | |
from ilovephotos.blacktip import models | |
from ilovephotos.blacktip.util.parse_help import verify_args, get_list_ids |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Implements an anchor-based permalink system, with handlers assigned to a component. | |
* The format used is "/page/#key1:(value1,value2),key2:(value3,value4)[...]" | |
*/ | |
var PermalinkManager = new Class({ | |
Implements: [Events, Class.Binds], | |
Binds: ['processHash'], | |
initialize: function() { | |
this.handlers = new Hash(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Implements an anchor-based permalink system, with handlers assigned to a component. | |
* The format used is "/page/#key1:(value1,value2),key2:(value3,value4)[...]" | |
*/ | |
var PermalinkManager = new Class({ | |
Implements: Class.Binds, | |
Binds: ['processHash'], | |
initialize: function() { | |
this.handlers = new Hash(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Utilities for managing database sessions.""" | |
from __future__ import with_statement | |
import contextlib | |
import functools | |
@contextlib.contextmanager | |
def temp_session(session_cls, **kwargs): | |
"""Quick and dirty context manager that provides a temporary Session object | |
to the nested block. The session is always closed at the end of the block. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Provides a `DateTimeRange` class, which is used for managing ranges of datetimes.""" | |
import datetime | |
class DateTimeRange(object): | |
"""Represents a range of datetimes, with a start and (optionally) an end. | |
Basically implements most of the methods on a standard sequence data type to provide | |
some lovely syntactic sugar. Specifically, you can iterate on this, index it, slice it, | |
use the in operator, reverse it, and use it in a boolean context to see if there is any | |
time in between the start and end.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[color] | |
ui = auto | |
[user] | |
name = Oliver Beattie | |
email = [email protected] | |
[alias] | |
stat = status | |
co = checkout | |
br = branch | |
[core] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Basic color replacements */ | |
a:link, a:visited { | |
color: #039 !important; | |
} | |
a:hover { | |
color: #fff !important; | |
background-color: #039 !important; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Element.implement({ | |
closest: function(selector){ | |
/* Matches the nearest element with the passed selector -- much like | |
* Element.getParent, but with the starting element included */ | |
return (this.match(selector)) ? this : this.getParent(selector); | |
}, | |
addLiveEvent: function(eventType, selector, handler){ | |
/* Binds a 'live event' to all the element. Whenever the event is allowed to bubble | |
* up to this element, event.target is checked to see whether it matches the passed | |
* selector. If it does, the handler will be fired */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.paginator import EmptyPage, InvalidPage, PageNotAnInteger, Page, Paginator | |
class IgnorantPage(Page): | |
"""The just-as-ignorant stepchild of IgnorantPaginator and Page.""" | |
def __init__(self, *args, **kwargs): | |
ret = super(IgnorantPage, self).__init__(*args, **kwargs) | |
# Now, we need to know if we have a first and last dealio | |
self.__has_next = (len(self.object_list) > self.paginator.per_page) | |
self.object_list = self.object_list[:self.paginator.per_page] | |
return ret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Blogger Content Warning Skip | |
// @description Automatically skips the content warning on blogspot.com sites without reloading the page | |
// @match http://*.blogspot.com/* | |
// ==/UserScript== | |
var fireEvent = function(obj,evt){ | |
var fireOnThis = obj; | |
if (document.createEvent) { | |
var evObj = document.createEvent('MouseEvents'); |
OlderNewer