This file contains hidden or 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 sys | |
| import random | |
| # Read | |
| def read_file(path): | |
| f = open(path) | |
| text = f.read() | |
| f.close() | |
| return text.split() |
This file contains hidden or 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 mimetypes as mime | |
| import os | |
| import socket | |
| import sys | |
| WWW_ROOT = 'www_root' | |
| STATUS_MESSAGES = { 200: 'OK', | |
| 404: 'Not Found', | |
| 500: 'Internal Server Error' } |
This file contains hidden or 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 ExpEndpoint<T> | |
| { | |
| private Queue<T> inputQueue; | |
| private Queue<T> outputQueue; | |
| private Object stateLock = new Object(); | |
| private TaskCompletionSource<T> reader; | |
| public ExpEndpoint(Queue<T> inputQueue, Queue<T> outputQueue) | |
| { | |
| this.inputQueue = inputQueue; |
This file contains hidden or 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
| // | |
| // Program.cs | |
| // | |
| // Author: | |
| // Alex Muscar <muscar@gmail.com> | |
| // | |
| // Copyright (c) 2013 Alex Muscar | |
| // | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy | |
| // of this software and associated documentation files (the "Software"), to deal |
This file contains hidden or 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
| // | |
| // main.cpp | |
| // wirth | |
| // | |
| // Created by Alex Muscar on 6/20/13. | |
| // Copyright (c) 2013 Alex Muscar. All rights reserved. | |
| // | |
| #include <iostream> | |
| #include <vector> |
This file contains hidden or 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
| // | |
| // main.cpp | |
| // wirth | |
| // | |
| // Created by Alex Muscar on 6/20/13. | |
| // Copyright (c) 2013 Alex Muscar. All rights reserved. | |
| // | |
| #include <iostream> | |
| #include <vector> |
This file contains hidden or 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
| struct expr { }; | |
| struct num : expr | |
| { | |
| int value; | |
| num(int value) : value(value) { } | |
| }; | |
| struct plus : expr |
This file contains hidden or 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
| func tryInc(n: Int?) -> Int? { | |
| if let x = n { | |
| return x + 1 | |
| } | |
| return nil | |
| } | |
| func tryIncUnsafe(n: Int!) -> Int? { | |
| return n + 1 | |
| } |
This file contains hidden or 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 Person { | |
| let age: Int | |
| init(age: Int) { | |
| self.age = age | |
| } | |
| } | |
| let p1: Person? = Person(age: 27) | |
| let p2: Person? = nil |
This file contains hidden or 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
| func tryInc(n: Int?) -> Int? { | |
| if let x = n { | |
| return x + 1 | |
| } | |
| return nil | |
| } |
OlderNewer