Skip to content

Instantly share code, notes, and snippets.

View adamkaplan's full-sized avatar

Adam adamkaplan

View GitHub Profile
@adamkaplan
adamkaplan / NSData+JFRBinaryInspection.h
Last active March 13, 2017 08:40
Print NSData As Binary
//
// NSData+JFRBinaryInspection.h
// SimpleTest
//
// Created by Adam Kaplan on 4/15/15.
//
#import <Foundation/Foundation.h>
@interface NSData (JFRBinaryInspection)
@adamkaplan
adamkaplan / Timer.m
Last active August 29, 2015 14:16
Xcode Timer Snippet.
{
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);
}
@adamkaplan
adamkaplan / DeDupeExample
Last active August 29, 2015 14:14
Complete Example Code
- (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"
@adamkaplan
adamkaplan / gist:20a697fe171d0eeca9dd
Created December 23, 2014 04:16
Disable warnings on a single call
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (config->queuePointer && config->queuePointer == dispatch_get_current_queue()) {
#pragma clang diagnostic pop
@adamkaplan
adamkaplan / HockeyPublish.sh
Last active January 4, 2016 04:29
See installation instructions in the comment below
# 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,