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
#!/usr/bin/env python | |
from json import load | |
from collections import defaultdict, deque, namedtuple | |
# handle transaction cancellations | |
# disallow payments with insufficient balance | |
# (- allow deferred up to ... time) | |
# handle payments to (but not from) unknown accounts |
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
protocol StringEnum { | |
var rawValue: String { get } | |
} | |
extension Dictionary { | |
subscript(enumKey: StringEnum) -> Value? { | |
get { | |
if let key = enumKey.rawValue as? Key { | |
return self[key] | |
} |
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
@property (nonatomic, strong) dispatch_semaphore_t waitSemaphore | |
- (void)setUp { | |
[super setUp]; | |
// Set-up code here. | |
self.waitSemaphore = dispatch_semaphore_create(0); | |
} |
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
//get a unique ID | |
NSString *deviceID = nil; | |
UIDevice *device = [UIDevice currentDevice]; | |
if ([device respondsToSelector:@selector(identifierForVendor)]) { | |
deviceID = [[device identifierForVendor] UUIDString]; | |
} | |
else { | |
//retrieve an NSDefaults stored UUID | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
NSString *uuidKey = @"UUID"; |