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 | |
/// Allows to map enum to another using raw "case name". | |
/// | |
/// Let's say there are 2 enums such as `GenericEnum` (each case of that may have arguments) | |
/// and `PlainEnum` (each case of that are representable by a string): | |
/// | |
/// enum GenericEnum<T>: CaseNameable { | |
/// case generic(value: T) // caseName == "generic" | |
/// case exact(Int) // caseName == "exact" |
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
IB_DESIGNABLE | |
@interface FadingView () | |
@property (assign, nonatomic) IBInspectable BOOL verticalFade; | |
@property (assign, nonatomic) IBInspectable BOOL horizontalFade; | |
@end | |
@implementation FadingView |
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
openssl pkcs12 -in NAME.p12 -out NAME.pem -nodes -clcerts |
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
enum { | |
ObjectiveC = 'ObjC', | |
Java = 'Java', | |
Ruby = 'Ruby' | |
} Language; | |
- (NSString *)stringFromEnumValue:(NSUInteger)enumValue { | |
char *str = calloc(sizeof(enumValue) + 1, sizeof(char)); | |
int integer = NSSwapInt((unsigned int) enumValue); | |
memcpy(str, (const void *) &integer, sizeof(integer)); |
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
- (NSUInteger)linesForTextView:(UITextView *)textView { | |
NSLayoutManager *layoutManager = [textView layoutManager]; | |
NSUInteger numberOfLines, index, numberOfGlyphs = [layoutManager numberOfGlyphs]; | |
NSRange lineRange; | |
for (numberOfLines = 0, index = 0; index < numberOfGlyphs; numberOfLines++) { | |
[layoutManager lineFragmentRectForGlyphAtIndex:index effectiveRange:&lineRange]; | |
index = NSMaxRange(lineRange); | |
} | |
return numberOfLines; |