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
// | |
// AutoLocalize.h | |
// AutoLocalize | |
// | |
// Created by Stefan Matthias Aust on 05.08.11. | |
// Copyright 2011 I.C.N.H. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
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
po [[UIWindow keyWindow] _autolayoutTrace] // prints layouts ambiguity | |
po [UIViewController _printHierarchy] // prints view controllers hierarchy | |
po [view constraintsAffectingLayoutForAxis:0] // horizontal | |
po [view constraintsAffectingLayoutForAxis:1] // vertical | |
[view hasAmbiguousLayout] // BOOL | |
[view exerciseAmbiguityInLayout] // visualizing ambiguity | |
UIViewAlertForUnsatisfiableConstraints // symbolic breakpoint | |
UIConstraintBasedLayoutDebugging // symbolic breakpoint |
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/Foundation.h> | |
extern NSString* const PSFormValidationErrorDomain; | |
typedef NS_ENUM(NSInteger, PSFormValidationError) { | |
PSFormValidationErrorUndefined = 0, | |
PSFormValidationErrorEmailEmpty, | |
PSFormValidationErrorUsernameEmpty, | |
PSFormValidationErrorPasswordEmpty, | |
PSFormValidationErrorPasswordTooShort, |
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
// Inspired by Mattt | |
@interface NOLoggingAssertionHandler : NSAssertionHandler | |
@end |
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
// make image from color | |
#import <UIKit/UIKit.h> | |
@interface UIImage (NKOGraphics) | |
+ (UIImage*)nko_imageWithColor:(UIColor*)color; | |
+ (UIImage*)nko_imageWithColor:(UIColor*)color size:(CGSize)size; | |
+ (UIImage*)nko_imageWithColor:(UIColor*)color size:(CGSize)size cornerRadius:(CGFloat)radius; | |
+ (UIImage*)nko_gradientImageWithTopColor:(UIColor*)topColor bottomColor:(UIColor*)bottomColor size:(CGSize)size radius:(CGFloat)radius; |
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/Foundation.h> | |
@interface UIDevice(NKOSVersionCheck) | |
+ (BOOL)nko_isRunningOnIOS7OrLater; | |
@end |
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
// | |
// Mattt's example from NSHipster updated for 8.1 API. (NSHipster article http://nshipster.com/swift-literal-convertible/ ) | |
// Additions for pattern matching for use in switch statements taken from http://lesstroud.com/swift-using-regex-in-switch-statements/ | |
// | |
// ------- | |
// xNekOIx | |
// | |
import Foundation |
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
sudo ls | sed 's/\(.*\)\(\..*\)/mv "\1\2" "\1@2x\2"/p' | sh |
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
protocol SomeProtocol: class { | |
func pew() -> String | |
} | |
class SomeClass { | |
func someFunc() -> SomeProtocol { | |
let someClosure = { () -> SomeProtocol in | |
class PewPew: SomeProtocol { | |
func pew() -> 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
RACSignal* activitySignal = [[RACObserve(self, viewModel.inProgress) map:^id(NSNumber* value) { | |
if (value.boolValue == NO) return [RACSignal return:@""]; | |
return [[RACSignal interval:0.5 onScheduler:[RACScheduler mainThreadScheduler]] | |
scanWithStart:@"." | |
reduce:^id(NSString* previous, id current) { | |
if (previous.length > 2) return @"."; | |
return [previous stringByAppendingString:@"."]; | |
}]; | |
}] switchToLatest]; |
OlderNewer