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
// copy-paste at the begining of application:didFinishLaunchingWithOptions: | |
for (NSString* family in [UIFont familyNames]) | |
{ | |
NSLog(@"%@", family); | |
for (NSString* name in [UIFont fontNamesForFamilyName: family]) | |
{ | |
NSLog(@" %@", name); | |
} |
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/Foundation.h> | |
@interface MyStringUtils : NSObject | |
+ (BOOL)confuzion_stringContainsVotedKeywords:(NSString*)input; | |
+ (BOOL)stringContainsVotedKeywords:(NSString*)input; | |
@end |
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 "MYAppDelegate.h" | |
@interface MYAppDelegate () <UISplitViewControllerDelegate> | |
/... | |
@property (nonatomic, strong) UISplitViewController* splitViewController; | |
@end | |
@implementation MYAppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
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
private func isAlertExist() -> Bool { | |
for window in UIApplication.sharedApplication().windows { | |
if let w = window as? UIWindow where w.subviews.count > 0 { | |
for subview in w.subviews { | |
if let s = subview as? UIAlertView { | |
return true | |
} | |
} | |
} | |
} |
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
var input: String | |
// CASE 1 | |
func validateWithError(error: NSErrorPointer) -> Bool { | |
var regexpError: NSError? | |
let regexp: NSRegularExpression? | |
do { | |
regexp = try NSRegularExpression(pattern: "[a-zA-Z0-9_]{4,}", options:[]) | |
} catch let error as NSError { | |
regexpError = error |
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
#!/bin/sh | |
releaseConfig="Release" | |
debugConfiguration="Debug" | |
adhocConfiguration="AdHoc" | |
if [ "$adhocConfiguration" = "${CONFIGURATION}" ] || [ "$releaseConfig" = "${CONFIGURATION}" ]; then | |
echo "Running Crashlytics" | |
"${PODS_ROOT}/Fabric/Fabric.framework/run" <your_api_key> <your_build_secret> | |
else |
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
// | |
// Login via FBSDK | |
// | |
- (void)connectFacebookAccountWithCompletionHandler:(void (^)(NSError *))completionHandler | |
{ | |
NSArray *readPermissions = @[@"public_profile", @"user_friends", @"email", @"user_likes"]; | |
if (![FBSDKAccessToken currentAccessToken]) { | |
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; | |
[login logInWithReadPermissions:readPermissions |
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/Foundation.h> | |
@interface NSTimeZone (SBTExtensions) | |
/*! | |
@brief Convert seconds, represented as a string to the timezone. Returns nil when conversion failed. | |
The method covers both, integers and floating point numbers. | |
*/ | |
+ (nullable instancetype)timeZoneForSecondsFromGMTString:(nonnull NSString *)secondsString; | |
@end |
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
// Swift 3 | |
extension CharacterSet { | |
/// Test for membership of a particular `UnicodeScalar?` in the `CharacterSet`. | |
/// - important: This `contains(_:)` oveload works with `Optional<UnicodeScalar>` | |
/// | |
/// Consider the following example: | |
/// ```` | |
/// let flowermoji = "💐" | |
/// let ucscalar = UnicodeScalar(flowermoji.utf16.last!) |
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 | |
private let justAOneTimeThing: () = { | |
print("\(GlobalOnceClass.self): Do This once") | |
}() | |
public final class GlobalOnceClass { | |
public init() { | |
} |