Skip to content

Instantly share code, notes, and snippets.

@anandkunal
anandkunal / list_predicates.py
Created March 8, 2010 07:07
Python List Predicates
from types import FunctionType
from UserList import UserList
class PredicateList(UserList):
def Exists(self, predicate):
"""Returns true if the predicate is satisfied by at least one list member."""
if type(predicate) is FunctionType:
for item in self.data:
if predicate(item):
return True
@anandkunal
anandkunal / gmail_pagination_hack.js
Created March 8, 2010 07:03
Gmail Pagination Hack
// 1: older page for all mail
49: function() {
currentPage = GrabCurrentAllMailPage();
if (currentPage >= 2) {
window.location.hash = "#all/p" + (currentPage-1);
}
},
// 2: newer page for all mail
50: function() {