graph TD
subgraph "Client Applications"
FE[Frontend]
External[External Clients]
end
subgraph "API Layer"
API[Public API]
AdminAPI[Admin API]
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 ordinal_to_roman(ordinal): | |
""" | |
Converts a chapter ordinal (number, word, or Roman numeral) to a Roman numeral. | |
Args: | |
ordinal: The chapter ordinal, which can be an integer, a word | |
representation of a number (e.g., "one", "two"), or a | |
Roman numeral string. |
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 time | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time.time() | |
result = method(*args, **kw) | |
te = time.time() | |
if 'log_time' in kw: | |
name = kw.get('log_name', method.__name__.upper()) | |
kw['log_time'][name] = int((te - ts) * 1000) |
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
GameInstance (an object spawned when you launch the application and that remains the same until you close it) | |
GameMode (spawned when a level is loaded) | |
GameState (spawned by the gameMode) | |
PlayerState (spawned when a PlayerController is spawned = when a player arrives in the game) | |
You have to pay close attention to what you do and where you do it | |
when coding a multiplayer game. When it comes to singleplayer, you can’t | |
really “have it wrong” except for GameInstance stuff. | |
But here are the general guidelines I follow: | |
GameInstance - Holds any non-pointer persistent | |
variables (persistent means that you need to store in between two levels |
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 some_function(value): | |
value = value or "Potato" |
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
<snippet> | |
<content><![CDATA[ | |
import ipdb;ipdb.set_trace() | |
]]></content> | |
<!-- ipdb breakpoint snippet --> | |
<scope>source.python</scope> | |
<tabTrigger>ipdb</tabTrigger> | |
</snippet> |
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 string | |
import itertools | |
all_3_raw = list(itertools.permutations([chr(i) for i in range(97, 123)], 3)) | |
all_3 = [''.join(w) for w in all_3_raw] | |
scrabble_3words_raw = 'aah aal aas aba abo abs aby ace act add ado ads adz aff aft aga age ago ags aha ahi ahs aid ail aim ain air ais ait ala alb ale all alp als alt ama ami amp amu ana and ane ani ant any ape apo app apt arb arc are arf ark arm ars art ash ask asp ate att auk ava ave avo awa awe awl awn axe aye ays azo baa bad bag bah bal bam ban bap bar bas bat bay bed bee beg bel ben bes bet bey bib bid big bin bio bis bit biz boa bob bod bog boo bop bos bot bow box boy bra bro brr bub bud bug bun bur bus but buy bye bys cab cad cam can cap car cat caw cay cee cel cep chi cig cis cob cod cog col con coo cop cor cos cot cow coy coz cru cry cub cud cue cup cur cut cwm dab dad dag dah dak dal |
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 threading import Thread | |
q = [] | |
running = True | |
def publish(thing): | |
print('publishing: {}'.format(thing)) | |
q.append(thing) |
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
# WHY parameters that are mutable in params | |
def foo_str(l='A', a=None): | |
print('BEFORE') | |
print(l) | |
print("AFTER") | |
l + a | |
print(l) |
NewerOlder