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
| // | |
| // MyURLProtocol.m | |
| // | |
| // Created by kitagawa on 2014/08/21. | |
| // Copyright (c) 2014年 kitagawa. All rights reserved. | |
| // | |
| #import "MyURLProtocol.h" | |
| static NSString *kCustomHeaderKey = @"API-Key"; |
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
| #define RELEASE_SAFELY(__POINTER) { [__POINTER release]; __POINTER = nil; } |
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
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
| // wait... | |
| [NSThread sleepForTimeInterval:1.0]; | |
| dispatch_async(dispatch_get_main_queue(), ^{ | |
| // something you do ... | |
| }); | |
| }); |
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
| // override | |
| - (instancetype)initWithBaseURL:(NSURL *)url | |
| { | |
| self = [super initWithBaseURL:url]; | |
| if (self) { | |
| self.requestSerializer = [AFJSONRequestSerializer serializer]; | |
| } | |
| return self; | |
| } |
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
| #if DEBUG | |
| // http://www.zero4racer.com/blog/480 | |
| static void uncaughtExceptionHandler(NSException *exception) { | |
| NSLog(@"CRASH: %@", exception); | |
| NSLog(@"Stack Trace: %@", [exception callStackSymbols]); | |
| // Internal error reporting | |
| } | |
| #endif | |
| @implementation AppDelegate |
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
| require 'net/https' | |
| def restore_shorten_uri(uri) | |
| http = Net::HTTP.new(uri.host, uri.port) | |
| http.use_ssl = uri.scheme == 'https' | |
| http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
| http.start do |h| | |
| res = h.head(uri.path) | |
| loc = res['Location'] | |
| URI.regexp =~ loc ? URI.parse(loc) : uri |
NewerOlder