This file contains 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
// 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() { |
This file contains 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 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 |
This file contains 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
<cfset tags_list = " CaMELCaSE comma, 'singlequoted' <b>bold</b> ""doublequoted"" double double this should be over the limit now " /> | |
<cfset amount = 10 /> | |
<cfset length = 20 /> | |
<pre><cfset tags_list = trim(tags_list) /> | |
<cfset tags_list = lcase(tags_list) /> | |
<cfset tags_struct = structnew() /> |
This file contains 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
import Image | |
def is_the_same(base, test_image): | |
for i in range(len(base)): | |
if (base[i] - test_image[i]) != 0: | |
return False | |
return True | |
base = Image.open('base.png').getdata() | |
bad = Image.open('bad.png').getdata() |
This file contains 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
total_pages = 68; | |
full_document_path = "~/Project/Assets/catalog.pdf"; | |
full_output_path = "~/Project/Assets/jpg/"; | |
function open_document(page) { | |
FileReference = new File(full_document_path); | |
PDFOpenOptions = new PDFOpenOptions(); | |
PDFOpenOptions.page = page; | |
PDFOpenOptions.resolution = 72; | |
app.open(FileReference, PDFOpenOptions); |
This file contains 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
import sets | |
import string | |
whitespace = sets.ImmutableSet(string.whitespace) | |
def qs(test_string, abbreviation, offset=None): | |
offset = offset or 0 | |
if len(abbreviation) == 0: return 0.9 | |
if len(abbreviation) > len(test_string): return 0.0 |
This file contains 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
class Stacker(object): | |
""" A minimal calculator that only supports addition/multipliction. """ | |
def __init__(self): | |
self.s = [] | |
self.ops = { | |
'+' : lambda: self.s.append(self.s.pop() + self.s.pop()), | |
'*' : lambda: self.s.append(self.s.pop() * self.s.pop()) | |
} | |
This file contains 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
class Thing(object): | |
def __init__(self): | |
self.__missing_method_name = None # Hack! | |
def __getattribute__(self, name): | |
return object.__getattribute__(self, name) | |
def __getattr__(self, name): | |
self.__missing_method_name = name # Could also be a property | |
return getattr(self, '__methodmissing__') |
This file contains 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
pattern_punctuation = re.compile('(\!|\.|\?|\;|\,|\:|\&|\_|\{|\}|\[|\]|\~|\:|\-|\;|\$|\(|\))') | |
pattern_numbers = re.compile('[0-9]') | |
pattern_plurals = re.compile('\'s$') | |
pattern_possesives = re.compile('s\'$') | |
pattern_quotations = re.compile('(\'|\")') | |
pattern_word = re.compile('[a-z]+') | |
def tokenize_word(word): | |
before = word | |
word = word.lower() |
This file contains 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 __future__ import with_statement | |
import inspect | |
class Test(object): | |
def __init__(self, name): | |
self.name = name | |
def __enter__(self): | |
return self | |
OlderNewer