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
## no classes | |
def Monster(name, hp, strength): | |
return {"name": name, "hp": hp, "hp_left": hp, "strength": strength} | |
def describe_monster(monster): | |
return "A wild %s. %d/%d HP." % (monster["name"], monster["hp_left"], monster["hp"]) | |
def sustain_damage(monster, damage): | |
if damage > monster["hp_left"]: |
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
TEST_CASES = [ | |
('\x00', '37CE6F8BDF1ECE1E6771D61F3477C4EE71CF3793A0'), | |
('\x01\x02\x03\x04', '060960EAF8755D47AB14F62948CEE0ED010378755BB4A788'), | |
('\xFF', '0D295288F8563D9AA6324875B3EA7A9C841321F6CD'), | |
# watch out: not '\xFF\xFF'. Typo is my fault. | |
('\xFFFF', '88C41CB3F295FD198F0351D44A1AF4BE4DB526D3341C52'), | |
(''.join(map(chr, xrange(256))), '5E78B8D2B8A93AF01590AB44E647F8D0CFF663E3E120479B0C903E76199A6B8CA1B2073583B63A4A28A31C34B3B6355175983CEB7C452731712C83F6AE551511BBE2827603F1F4B8714E8A8584BD75B04811CFA65CDA95DB47E7F35BD49443FF2820C2AAA35E6B0701F932053212976A94EBDFA96F87FE7E9FA4E52CC87322E4A6B75AE762BC72704D2C48BF8A374C31B5D6733F5B1C42B85A7306FF8B4273DFE423845141B2777049FFEBB2730EBC8684FAA69371834FDF6A5F3850D4E185E2DFE16A860AF376FCCB34CA86068D08E8760B3C9A3C32511EE39EF38EECF2A89A2324BE0661A044313C7C3F160193B4C000A5D6EC7711FEF5D1EDCB95C455A9DF9438644D50F51928EED7F17CA42D589DD78D36C5')] | |
if __name__ == '__main__': | |
for plain, cipher in TEST_CASES: |
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 numpy | |
DIMENSIONS = 3 | |
SCREEN_DIMENSIONS = 2 | |
class Palette(object): | |
def __init__(self, zero, one): | |
self.zero, self.one = numpy.array(zero), numpy.array(one) | |
def color(self, 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
.table-container th.asc:after { | |
content: '\0000a0\0025b2'; | |
} | |
.table-container th.desc:after { | |
content: '\0000a0\0025bc'; | |
} | |
.pagination { | |
text-align: center; | |
} |
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
""" | |
$ python event_test.py | |
Traceback (most recent call last): | |
File "event_test.py", line 14, in <module> | |
assert value | |
AssertionError | |
Exception in thread Thread-1 (most likely raised during interpreter shutdown): | |
""" | |
from threading import Thread, Event |
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
commit 0fe549297387bf971f96154d9339ed7ee478a029 | |
Author: Aur Saraf <[email protected]> | |
Date: Thu Jun 5 03:18:14 2014 +0300 | |
google analytics activity tracking | |
diff --git a/v3/js/riveted.js b/v3/js/riveted.js | |
index 5d8bf9e..b337113 100644 | |
--- a/v3/js/riveted.js | |
+++ b/v3/js/riveted.js |
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
++2008+07+10 | |
+ + | |
+ Aur Saraf | |
+ 200031177 | |
+[050<2422820 | |
+Neve+America 83+2+6 | |
+Technion Haifa 32000 | |
> |
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 csv | |
from icalendar import Calendar, Event | |
from datetime import datetime, timedelta | |
from icalendar import LocalTimezone | |
HOUR = 60*60 | |
start_hour = timedelta(0, 17*HOUR) | |
day_duration = timedelta(0, 4*HOUR) | |
r = csv.reader(open('e:\\temp\\luz.csv', 'rb')) |
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
# a beginning of a song, using my work-in-progress midi API `melody` at https://github.com/SonOfLilit/melody | |
from music import * | |
def walk(duration, scale, bassline): | |
result = [] | |
for i in xrange(len(bassline) - 1): | |
n = dict(bassline[i]) | |
result.append(n) | |
if n['pitch'] == play.EMPTY: |
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
All Gists | |
SonOfLilit | |
Edit | |
Delete | |
Star0 | |
SonOfLilit / choose |
OlderNewer