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
| - (NSString *) hostname | |
| { | |
| char baseHostName[256]; // Thanks, Gunnar Larisch | |
| int success = gethostname(baseHostName, 255); | |
| if (success != 0) return nil; | |
| baseHostName[255] = '\0'; | |
| return [NSString stringWithFormat:@"%s", baseHostName]; | |
| } |
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 FontSizesDataSource: UITableViewDataSource { | |
| private let fontSizeMultiplierDescriptions: [FontSizeMultiplier] = [.small, .normal, .large, .extraLarge] | |
| var numberOfSections: Int { | |
| return 1 | |
| } | |
| func numberOfItemsInSection(index: Int) -> Int { | |
| return fontSizeMultiplierDescriptions.count |
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
| extension UINavigationController { | |
| open override var preferredStatusBarStyle: UIStatusBarStyle { | |
| return topViewController?.preferredStatusBarStyle ?? .default | |
| } | |
| } |
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 Foundation | |
| import CommonCryptoKit | |
| enum CryptoAlgorithm { | |
| case MD5, SHA1, SHA224, SHA256, SHA384, SHA512 | |
| var HMACAlgorithm: CCHmacAlgorithm { | |
| var result: Int = 0 | |
| switch self { | |
| case .MD5: result = kCCHmacAlgMD5 |
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 Dynamic<T> { | |
| typealias Listener = T -> Void | |
| var listener: Listener? | |
| func bind(listener: Listener?) { | |
| self.listener = listener | |
| } | |
| func bindAndFire(listener: Listener?) { | |
| self.listener = listener |
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
| extension UIView { | |
| func xscale() -> CGFloat { | |
| let t = self.transform | |
| return sqrt(t.a * t.a + t.c * t.c) | |
| } | |
| func yscale() -> CGFloat { | |
| let t = self.transform | |
| return sqrt(t.b * t.b + t.d * t.d); | |
| } |
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
| let defaultOptions: [String: AnyObject] = [ | |
| "NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints": true | |
| ] | |
| NSUserDefaults.standardUserDefaults().registerDefaults(defaultOptions) |
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 ReplaceSegue: UIStoryboardSegue { | |
| override func perform() { | |
| let containerViewController = sourceViewController | |
| if containerViewController.childViewControllers.count == 0 { | |
| return; | |
| } | |
| let sourceVC = containerViewController.childViewControllers[0] | |
| containerViewController.addChildViewController(destinationViewController) |
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 UIKit | |
| class ExpenseListViewController : UITableViewController, UITableViewDataSource, UITableViewDelegate { | |
| struct TableViewCellIdentifiers { | |
| static let BasicCell = "BasicCell" | |
| } | |
| // MARK: - UITableViewDataSource | |
NewerOlder