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
type Callback m a = [String] -> CommandLineT m a | |
type CallbackList m a = Map.Map String (Callback m a) | |
type Environment = Map.Map String String | |
data CommandState m a = CS { registry :: Environment | |
, callbacks :: CallbackList m a | |
} | |
newtype CommandLineT m a = CommandLine (StateT (CommandState m a) (InputT m) a) |
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
// Sample army storage for Ressel:Arena | |
#include <iostream> | |
#include <list> | |
#include <string> | |
using namespace std; | |
// Setting up the Node data structure, in this case a clone of "soldier" | |
// From the Ressel:Arena game.. |
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
post_list = blobs_from_db | |
interested_in_formatting_posts = some_list1 | |
interested_in_formatting_the_page = some_list2 | |
# when modules are loaded they add methods to whatever "interest" lists they want | |
def format_posts(): | |
for element in post_list: # list of text blobs from database | |
for formatter in interested_in_posts: | |
element = formatter(element) |
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 Fastrclient(object): | |
""" Creates a connection object and manages all communication | |
with the server.""" | |
def __init__(self, addr="localhost", port=4168): | |
self.clientsock = s.socket(s.AF_INET,s.SOCK_DGRAM) | |
self.addr = (addr,port) | |
self.count = 0 | |
self.count_l = threading.Lock() | |
NewerOlder