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 | |
import UIKit | |
struct AppUtils { | |
private static let byteCountFormatter: ByteCountFormatter = { | |
let formatter = ByteCountFormatter() | |
formatter.allowedUnits = [.useMB, .useKB] | |
formatter.countStyle = .memory | |
return formatter | |
}() |
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
extension Collection { | |
subscript (safe index: Index) -> Element? { | |
return indices.contains(index) ? self[index] : 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
ACTION = build | |
AD_HOC_CODE_SIGNING_ALLOWED = NO | |
ALTERNATE_GROUP = staff | |
ALTERNATE_MODE = u+w,go-w,a+rX | |
ALTERNATE_OWNER = grantdavis | |
ALWAYS_SEARCH_USER_PATHS = NO | |
ALWAYS_USE_SEPARATE_HEADERMAPS = YES | |
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer | |
APPLE_INTERNAL_DIR = /AppleInternal | |
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation |
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
brew list -1 | while read line; do brew unlink $line; brew link $line; done |
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 <objc/runtime.h> | |
#import <objc/message.h> | |
#import <QuartzCore/QuartzCore.h> | |
#define PROPERTY(propName) NSStringFromSelector(@selector(propName)) | |
// A better assert. NSAssert is too runtime dependant, and assert() doesn't log. | |
// http://www.mikeash.com/pyblog/friday-qa-2013-05-03-proper-use-of-asserts.html | |
// Accepts both: | |
// - PSPDFAssert(x > 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
// Takes string of Note + Octave | |
// Example: | |
// var frequency = getFrequency('C3'); | |
var getFrequency = function (note) { | |
var notes = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'], | |
octave, | |
keyNumber; | |
if (note.length === 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
// | |
// See full source code : | |
// https://github.com/FLCLjp/VerifyFingerPrint | |
// | |
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge | |
{ | |
if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodServerTrust) { | |
SecTrustRef trustRef = [[challenge protectionSpace] serverTrust]; |
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
asdasd#in older versions of Xcode4 you may need to set PRODUCT_NAME manually | |
DIST_LIST=<TestFlight Distribution List name here> | |
API_TOKEN=<TestFlight API token here> | |
TEAM_TOKEN=<TestFlight team token here> | |
SIGNING_IDENTITY="iPhone Distribution: Development Seed" | |
PROVISIONING_PROFILE="${HOME}/Library/MobileDevice/Provisioning Profiles/MapBox Ad Hoc.mobileprovision" | |
LOG="/tmp/testflight.log" | |
DATE=$( /bin/date +"%Y-%m-%d" ) |
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
NSArray *ClassGetSubclasses(Class parentClass) | |
{ | |
int numClasses = objc_getClassList(NULL, 0); | |
Class *classes = NULL; | |
classes = (__unsafe_unretained Class *)malloc(sizeof(Class) * numClasses); | |
numClasses = objc_getClassList(classes, numClasses); | |
NSMutableArray *result = [NSMutableArray array]; | |
for (NSInteger i = 0; i < numClasses; i++) { |
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 ObjectKeyPath(OBJECT, KEYPATH) \ | |
((void)(NO && ((void)OBJECT.KEYPATH, NO)), @ # KEYPATH ) | |
NSString *str = @"foobar"; | |
NSLog(@"%@", [str valueForKey:ObjectKeyPath(str, length)]); |