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 | |
class QueryResult {} // if I make this class public then the compiler says that generate has to be declared public. | |
// If I make generate public I get a different error... | |
// But QueryResult is a class which has to be public... it is part of my public API... | |
public class Row {} | |
class QueryResultGenerator : GeneratorType { | |
typealias Element = Row | |
func next() -> 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
background: linear-gradient(330deg, #5599ae, #556eae, #9655ae); | |
background-size: 600% 600%; | |
-webkit-animation: AnimationName 28s ease infinite; | |
-moz-animation: AnimationName 28s ease infinite; | |
-o-animation: AnimationName 28s ease infinite; | |
animation: AnimationName 28s ease infinite; | |
@-webkit-keyframes AnimationName { | |
0%{background-position:19% 0%} | |
50%{background-position:82% 100%} | |
100%{background-position:19% 0%} |
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 unwrap<T1, T2>(optional1: T1?, optional2: T2?) -> (T1, T2)? { | |
switch (optional1, optional2) { | |
case let (.Some(value1), .Some(value2)): | |
return (value1, value2) | |
default: | |
return nil | |
} | |
} | |
func unwrap<T1, T2, T3>(optional1: T1?, optional2: T2?, optional3: T3?) -> (T1, T2, T3)? { |
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
@interface UIColor (WBDebugExtensions) | |
@end | |
@implementation UIColor (DebugExtensions) | |
- (id)debugQuickLookObject { | |
UIGraphicsBeginImageContext(CGSizeMake(128, 128)); | |
[self setFill]; | |
[[UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 128, 128)] fill]; |
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
BOOL MTDIsBoldTextEnabled(void) { | |
static BOOL boldTextEnabled = NO; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
// Hack that checks if the "bold text" flag in the accessibility settings is enabled | |
UIFont *font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; | |
boldTextEnabled = [font.fontName rangeOfString:@"MediumP4"].location != NSNotFound; | |
}); |
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
#define MSDesignatedInitializer(__SEL__) __attribute__((unavailable("Invoke the designated initializer `" # __SEL__ "` instead."))) | |
// Sample usage: | |
- (instancetype)initWithObject:(id)object; | |
- (instancetype)init MSDesignatedInitializer(initWithObject:); // <- This even gets auto-complete. | |
// Now calling init on this class would throw a warning. |