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
guard let keypath = dictionary["field"] as? String, | |
let rule = dictionary["rule"] as? String, | |
let comparator = FormFieldDisplayRuleComparator(rawValue: rule), | |
let value = dictionary["value"] | |
else | |
{ | |
return nil | |
} |
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 SomeViewController: UIViewController { | |
private typealias My = SomeViewController | |
private let videoPlayer: AVPlayer | |
private let videoPlayerLayer: AVPlayerLayer | |
override init(nibName: String?, bundle nibBundle: NSBundle?) { | |
(videoPlayer, videoPlayerLayer) = My.commonInit() | |
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
#!/usr/bin/env xcrun swift -F Carthage/Build/Mac | |
import Foundation | |
import Markingbird | |
protocol Streamable { | |
var title: String { get } | |
var body: String { get } | |
} |
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 UIKit | |
// 1 | |
private var maxLengths = [UITextField: Int]() | |
// 2 | |
extension UITextField { | |
// 3 | |
@IBInspectable var maxLength: Int { |
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
enum Media { | |
case Book(title: String, author: String, year: Int) | |
case Movie(title: String, director: String, year: Int) | |
case WebSite(urlString: String) | |
} | |
let mediaList: [Media] = [ | |
.Book(title: "Harry Potter and the Philosopher's Stone", author: "J.K. Rowling", year: 1997), | |
.Movie(title: "Harry Potter and the Philosopher's Stone", director: "Chris Columbus", year: 2001), | |
.Book(title: "Harry Potter and the Chamber of Secrets", author: "J.K. Rowling", year: 1999), |
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 TheOneAndOnlyKraken { | |
static let sharedInstance = TheOneAndOnlyKraken() | |
} |
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
+ (UIImage *)chevronImageWithColor:(UIColor *)color | |
{ | |
NSArray *asciiRep = | |
@[ | |
@"· · · · · · · · · · · ·", | |
@"· · · 1 2 · · · · · · ·", | |
@"· · · 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
+ (NSDateFormatter *)dateReader | |
{ | |
NSMutableDictionary *dictionary = [[NSThread currentThread] threadDictionary]; | |
NSDateFormatter *dateReader = [dictionary objectForKey:@"SCDateReader"]; | |
if (!dateReader) | |
{ | |
dateReader = [[[NSDateFormatter alloc] init] autorelease]; | |
dateReader.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]; | |
dateReader.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; | |
dateReader.dateFormat = @"EEE, dd MMM yyyy HH:mm:ss Z"; |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |