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
# Set up our path similar to dev_appserver.py | |
EXTRA_PATHS = [ | |
DIR_PATH, | |
os.path.join(DIR_PATH, 'lib', 'antlr3'), | |
os.path.join(DIR_PATH, 'lib', 'django'), | |
os.path.join(DIR_PATH, 'lib', 'ipaddr'), | |
os.path.join(DIR_PATH, 'lib', 'webob'), | |
os.path.join(DIR_PATH, 'lib', 'yaml', 'lib'), | |
os.path.join(os.path.dirname(__file__)), | |
] |
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 AE's api stubs | |
from google.appengine.api import apiproxy_stub_map | |
from google.appengine.api import datastore_file_stub | |
from google.appengine.api import mail_stub | |
from google.appengine.api import urlfetch_stub | |
from google.appengine.api import user_service_stub | |
# Set up our dummy environment | |
APP_ID = 'test_app' | |
AUTH_DOMAIN = 'gmail.com' |
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
# Watch the file given at the command line | |
if __name__ == '__main__': | |
old_mtime = 0 | |
while True: | |
if len(sys.argv) == 1: | |
print 'Usage: python this_file.py your_module.py' | |
sys.exit() | |
else: | |
test = sys.argv[1].split('.')[0] | |
# Load here so we can use imp.reload later |
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
- (void)fetchContours { | |
int currentPixel, currentDir; | |
RSPoint point, nextPoint, testPoint; | |
lastEntryPoint = RSPointMake(0,0); | |
lastPoint = RSPointMake(0,0); | |
lastFoundDir = 4; | |
marching = YES; |
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
-- Make a pattern to match the consonants and vowels in a word where a cons is | |
-- not "aeiou" or y preceded by a cons e.g., "happy" -> ("happy", "cvccv") | |
wordDesc :: String -> (String, String) | |
wordDesc str = | |
(str, [corv (a,b,i) | (a,b,i) <- zip3 str (rotateR str) [0..len]]) | |
where len = length str - 1 | |
corv (a,b,i) | |
| a == 'y' && i /= 0 && b `notElem` vs = 'v' | |
| a `elem` vs = 'v' | |
| otherwise = 'c' |
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
rotateR :: [a] -> [a] | |
rotateR [x] = [x] | |
rotateR xs = last xs : init xs |
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
def cons(self, i): | |
"""cons(i) is TRUE <=> b[i] is a consonant.""" | |
if self.b[i] == 'a' or self.b[i] == 'e' or self.b[i] == 'i' or self.b[i] == 'o' or self.b[i] == 'u': | |
return 0 | |
if self.b[i] == 'y': | |
if i == self.k0: | |
return 1 | |
else: | |
return (not self.cons(i - 1)) | |
return 1 |
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
-- Make a pattern to match the consonants and vowels in a word where a cons is | |
-- not "aeiou" or y preceded by a cons e.g., "happy" -> ("happy", "cvccv") | |
wordDesc :: String -> (String, String) | |
wordDesc str = (str, [corv (a,b,i) | (a,b,i) <- zip3 str (rotateR str) [0..len]]) | |
where len = length str - 1 | |
corv (a,b,i) | |
| a == 'y' && i /= 0 && b `notElem` vs = 'v' | |
| a `elem` vs = 'v' | |
| otherwise = 'c' | |
where vs = "aeiou" |
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
rotateR :: [a] -> [a] | |
rotateR [x] = [x] | |
rotateR xs = last xs : init xs |
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
rotateR :: [a] -> [a] | |
rotateR [x] = [x] | |
rotateR xs = last xs : init xs | |
-- Make a pattern to match the consonants and vowels in a word where a cons is | |
-- not "aeiou" or y preceded by a cons e.g., "happy" -> ("happy", "cvccv") | |
wordDesc :: String -> (String, String) | |
wordDesc str = | |
(str, [corv (a,b,i) | (a,b,i) <- zip3 str (rotateR str) [0..len]]) | |
where len = length str - 1 |
OlderNewer