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
const lookupHTTPError = (code: number): string => { | |
// https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html | |
const HTTPErrorCodes: { [key: number]: string } = { | |
400: 'Bad Request', | |
401: 'Unauthorized', | |
402: 'Payment Required', | |
403: 'Forbidden', | |
404: 'Not Found', | |
405: 'Method Not Allowed', | |
406: 'Not Acceptable', |
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 "MDXEllipseView.h" | |
@interface MDXEllipseView () | |
@property (nonatomic, strong) UIColor* mdx_backgroundColor; | |
@end | |
IB_DESIGNABLE | |
@implementation MDXEllipseView | |
- (void)setBackgroundColor:(UIColor *)backgroundColor |
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> | |
int main(int argc, char *argv[]) | |
{ | |
@autoreleasepool { | |
// Arg 2 is nanoseconds. | |
// | |
// https://developer.apple.com/documentation/dispatch/1420519-dispatch_time | |
dispatch_time_t now = dispatch_time(DISPATCH_TIME_NOW, 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
# Block Facebook IPv4 | |
127.0.0.1 www.facebook.com | |
127.0.0.1 facebook.com | |
127.0.0.1 login.facebook.com | |
127.0.0.1 www.login.facebook.com | |
127.0.0.1 fbcdn.net | |
127.0.0.1 www.fbcdn.net | |
127.0.0.1 fbcdn.com | |
127.0.0.1 www.fbcdn.com | |
127.0.0.1 static.ak.fbcdn.net |
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
# Uncomment the next line to define a global platform for your project | |
platform :ios, '10.2' | |
target 'MapboxPodClient' do | |
# Comment the next line if you don't want to use dynamic frameworks | |
#use_frameworks! | |
# Pods for MapboxPodClient | |
pod 'Mapbox-iOS-SDK', :path => '../mapbox-ios-sdk-legacy', :share_schemes_for_development_pods => true |
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> | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
NSString* s = @"antidisestablishmentarianism"; | |
unichar* buffer = (unichar *)malloc(sizeof(unichar) * [s length]); | |
[s getCharacters:buffer range:NSMakeRange(0, [s length])]; | |
NSMutableArray* temp = [NSMutableArray arrayWithCapacity:[s length]]; |
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 NSDate (ISO8601) | |
- (NSString *)mdx_canonicalTimestamp; | |
@end | |
@implementation NSDate (ISO8601) | |
- (NSString *)mdx_canonicalTimestamp | |
{ |
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
// iPhone settings: "Denmark" for region and "Buddhist" for calendar. | |
NSDate* now = [NSDate date]; | |
NSDateFormatter* df = [[NSDateFormatter alloc] init]; | |
df.timeZone = [NSTimeZone timeZoneWithName:@"UTC"]; | |
df.timeStyle = NSDateFormatterMediumStyle; | |
df.dateStyle = NSDateFormatterShortStyle; | |
// Date: 30/10/2563 BE, 14.32.18 | |
NSLog(@"Date: %@", [df stringFromDate:now]); |
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> | |
#import <objc/runtime.h> | |
#import <objc/message.h> | |
@interface MyParent : NSObject | |
- (NSInteger)fetchNumber; | |
@end | |
@implementation MyParent | |
- (NSInteger)fetchNumber |
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
- (UIImage *)imageFromWand:(MagickWand *)wand | |
{ | |
const char* map = "ARGB"; | |
NSInteger w = MagickGetImageWidth(wand); | |
NSInteger h = MagickGetImageHeight(wand); | |
NSInteger size = strlen(map) * w * h * sizeof(char); | |
void* buffer = (void *)malloc(size); | |
NewerOlder