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
# rd: print recursive description of entire app window, or of a specified view | |
# | |
# usage: rd [view] | |
# | |
# if no view is specified, prints recursive description of app's keyWindow | |
# | |
command regex rd 's/^[[:space:]]*$/po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]/' 's/^(.+)$/po [%1 recursiveDescription]/' | |
# slow-on: turn slow animations on, for testing on device only, and optionally set the speed | |
# |
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
typedef NS_ENUM(NSInteger, kErrorCode) { | |
kErrorCodeInternal = 431432, | |
}; | |
extern NSError *NSErrorMake(NSString *message, NSInteger code, NSDictionary *aUserInfo, NSString *methodOrFunction); | |
#define NSObjcAssert NSAssert | |
#define InvalidConditionString(condition) (@"Invalid condition not satisfying: " #condition) | |
#define GenericAssertCondition(ctype, condition) NS ## ctype ## Assert((condition), InvalidConditionString((condition))) | |
#define GenericErrorMake(condition, func) NSErrorMake(InvalidConditionString((condition)), kErrorCodeInternal, nil, func) |
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
/* | |
* This may be obvious to some, but the most common use of dispatch_once is for the initialisation of | |
* a class singleton, so some people may not know how to do it per instance. | |
* | |
*/ | |
@implementation MyViewController { | |
dispatch_once_t _oncePerInstance; | |
} |
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
// | |
// UIView+NibLoading.swift | |
// Sam Dods on 29/10/2015. | |
// | |
import UIKit | |
/// Protocol to be extended with implementations | |
protocol UIViewLoading {} |
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
// | |
// UIViewController+StoryboardLoading.swift | |
// Sam Dods on 23/08/2016. | |
// | |
import UIKit | |
/// Protocol to be extended with implementations | |
protocol UIViewControllerLoading {} |
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
#!/bin/sh | |
SSHDIR=~/.ssh | |
BKPDIR=$SSHDIR/bkp`date "+%Y%m%d%H%M%S"` | |
mkdir $BKPDIR | |
cp $SSHDIR/id_rsa $BKPDIR | |
cp $SSHDIR/id_rsa.pub $BKPDIR |
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 application(_: UIApplication, didFinishLaunchingWithOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool { | |
Analytics.Config.analyticsKey = Config.analyticsKey | |
Analytics.Config.appVersion = Config.appVersion | |
Home.Config.baseURL = Config.baseURL | |
Home.Config.apiKey = Config.apiKey | |
Home.Config.adUnitPrefix = Config.adUnitPrefix | |
Search.Config.baseURL = Config.baseURL | |
Search.Config.searchURL = Config.searchURL |
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
// | |
// Config.swift | |
// Analytics | |
// | |
final class ConfigType { | |
static fileprivate var shared: ConfigType? | |
let analyticsKey: String | |
let appVersion: String |
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
fileprivate init(_ config: AnalyticsConfig.Type) { | |
self.analyticsKey = config.analyticsKey | |
self.appVersion = config.appVersion | |
} |
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
public protocol AnalyticsConfig { | |
static var analyticsKey: String { get } | |
static var appVersion: String { get } | |
} |
OlderNewer