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 locales = Locale.availableIdentifiers.map(Locale.init(identifier:)) | |
let dateFormatter = DateFormatter() | |
var amSymbols = Set<String>() | |
for locale in locales { | |
dateFormatter.locale = locale | |
guard let amSymbol = dateFormatter.amSymbol else { | |
continue |
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 | |
public protocol PriceFormatting { | |
var locale: Locale { get } | |
func format(price: Decimal) -> String? | |
} | |
public extension PriceFormatting { | |
func format(price: Decimal) -> String? { |
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 | |
public extension Never { | |
static func gonnaGiveYouUp() -> String { | |
return "gonna give you up" | |
} | |
static func gonnaLetYouDown() -> String { | |
return "gonna let you down" | |
} |
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/bash | |
#modified script from: http://stackoverflow.com/a/5396755/2128900 | |
# Git lets you use very readable time formats! | |
cutoff_time="1 week ago" | |
# other examples: | |
# cutoff_time="July 23, 2010" | |
# cutoff_time="yesterday" |
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
- (NSUInteger)responseLenght | |
{ | |
NSData *lenghtData = [self.responseData subdataWithRange:NSMakeRange(0, 4)]; | |
int lenght; | |
[lenghtData getBytes:&lenght length:sizeof(lenght)]; | |
return lenght; | |
} |
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
[[RACSignal combineLatest:@[connectUsersSignal, facebookUsersSignal, applicationUsersSignal] reduce:^id(NSArray *first, NSArray *second, NSArray *third) { | |
return [[first arrayByAddingObjectsFromArray:second] arrayByAddingObjectsFromArray:third]; | |
}] | |
subscribeNext:^(NSArray *allUsers) { | |
//Do something | |
}]; |
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
// in a UITableView subclass | |
@interface TestTableViewCell () | |
@property (strong, nonatomic) UIView *mainView; | |
@end | |
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { | |
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; |
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
find . -not -path '*/Pods/*' -a \( -name '*.m' \) | xargs wc -l | sort -r | more |
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 | |
# put this in file 'pre-commit' in .git/hooks | |
# file has to be marked as executable (+x) | |
#don't commit if FIXME was found in diff | |
exec 1>&2 | |
DONT_COMMIT_MARKER="FIXME" | |
if [ $(git diff --cached -G "$DONT_COMMIT_MARKER"|wc -l) != 0 ]; then | |
git --no-pager diff --cached -G "$DONT_COMMIT_MARKER" |