routes
– an array of route objectsrequest
- configuration of a request.response
- configuration of the response.resourcePath
- relative path of the resource to serve, if the request was matched.contentType
- optional an override for the resource content type. By default it's automatically deduced from the file MIME type.
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
1 | |
2 | |
fizz | |
4 | |
buzz | |
fizz | |
7 | |
8 | |
fizz | |
buzz |
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 Cocoa | |
import GameplayKit | |
let randoms = NSCountedSet() | |
let shuffles = NSCountedSet() | |
let gausians = NSCountedSet() | |
let randomD3 = GKRandomDistribution(lowestValue: 1, highestValue: 3) | |
let shuffledD3 = GKShuffledDistribution(lowestValue: 1, highestValue: 3) | |
let gausianD3 = GKGaussianDistribution(lowestValue: 1, highestValue: 3) |
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
let str: String | |
dispatch_sync(dispatch_get_global_queue(QOS_CLASS_UTILITY, 0)) { // Variable 'str' used before being initialized | |
str = "Hello" | |
} | |
print(str) // Variable 'str' used before being initialized |
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
#ifdef DEBUG | |
#import "WMLSwizzler.h" | |
static SEL wml_loadViewSEL; | |
static void wml_swizzleLoadViewForClass(Class class) { | |
typedef void(*load_view_t)(id, SEL); | |
__block load_view_t loadView = (load_view_t)[class S_replaceInstanceMethod:wml_loadViewSEL withBlock:^(UIViewController *self){ | |
loadView(self, wml_loadViewSEL); |
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 <Foundation/Foundation.h> | |
@interface WMLPushNotificationRegistrationService : NSObject | |
+ (instancetype)sharedInstance; | |
@property (nonatomic, readonly, getter=isRegisteredForPushNotifications) BOOL registeredForPushNotifications; | |
/** | |
* Must be called every app startup, once got user's permission to send push notificaitons |
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 <Foundation/Foundation.h> | |
@interface Node : NSObject <NSCopying, NSMutableCopying> | |
@property (nonatomic, weak, readonly) Node *parent; | |
@property (nonatomic, strong, readonly) Node *left; | |
@property (nonatomic, strong, readonly) Node *right; | |
- (instancetype)initWithParent:(Node *)parent left:(Node *)left right:(Node *)right; | |
@end | |
@interface MutableNode : Node |
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
func memoize<T: Hashable, U>( body: ((T)->U, T)->U ) -> (T)->U { | |
var memo = Dictionary<T, U>() | |
var result: ((T)->U)! | |
result = { x in | |
if let q = memo[x] { return q } | |
let r = body(result, x) | |
memo[x] = r | |
return r | |
} | |
return result |
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
@implementation NSProcessInfo (WMLCompatibility) | |
+ (void)wml_addSelector:(SEL)originalSelector implementedWithSelector:(SEL)newSelector { | |
if (![self instancesRespondToSelector:originalSelector]) { | |
Method newMethod = class_getInstanceMethod(self, newSelector); | |
class_addMethod(self, originalSelector, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)); | |
} | |
} | |
+ (void)load { |