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
# Copyright 2014 Gilt Groupe, Inc | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wdeprecated-declarations" | |
if (config->queuePointer && config->queuePointer == dispatch_get_current_queue()) { | |
#pragma clang diagnostic pop |
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
- (AFHTTPRequestOperation *)GET:(NSString *)urlString | |
parameters:(NSDictionary *)parameters | |
success:(void (^)(AFHTTPRequestOperation*,id))success | |
failure:(void (^)(AFHTTPRequestOperation*,NSError*))failure | |
{ | |
NSCAssert([NSThread isMainThread], @"must execute on the main thread"); | |
NSURL *url = [[NSURL URLWithString:urlString relativeToURL:self.baseURL] absoluteString]; | |
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"GET" |
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
{ | |
uint64_t t_start = mach_absolute_time(); | |
<#code#> | |
uint64_t t_end = mach_absolute_time(); | |
struct mach_timebase_info t_info; | |
mach_timebase_info(&t_info); | |
double_t elapsed = (t_end - t_start) * t_info.numer / (t_info.denom * (double_t)1e6); | |
NSLog(@"Elapsed: %fms", elapsed); | |
} |
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
// | |
// NSData+JFRBinaryInspection.h | |
// SimpleTest | |
// | |
// Created by Adam Kaplan on 4/15/15. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSData (JFRBinaryInspection) |
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
// Missing 'result unused' warning demo | |
// Correct: expect.beNil(); | |
// Wrong: expect.beNil; | |
#import <Foundation/NSObject.h> | |
#define expect [EXPExpect new] | |
@interface EXPExpect : NSObject | |
- (void(^)(void)) beNil; |
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
// | |
// YFObjCUtils.c | |
// | |
// Created by Adam Kaplan on 7/31/15. | |
// Licensed under the MIT license. | |
// | |
@implementation UsageExample | |
- (void)usageMethod { |
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
# SSL request to hostname that is not in DNS | |
> curl -o /dev/null -w @curlformat https://beta.finance.yahoo.com | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 255k 0 255k 0 0 233k 0 --:--:-- 0:00:01 --:--:-- 233k | |
Size: 261255 | |
DNS: 0.522 | |
Connect: 0.536 |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>IDECodeSnippetCompletionScopes</key> | |
<array> | |
<string>All</string> | |
</array> | |
<key>IDECodeSnippetContents</key> | |
<string>#pragma clang diagnostic push |
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
- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, | |
NSURLCredential *credential))completionHandler | |
{ | |
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) | |
{ | |
[TSKPinningValidator handleChallenge:challenge completionHandler:completionHandler]; | |
} | |
else | |
{ | |
// This challenge was not for server trust. Fall back to default behavior. |
OlderNewer