Skip to content

Instantly share code, notes, and snippets.

View tonyarnold's full-sized avatar

Tony Arnold tonyarnold

View GitHub Profile
#form-search input
{
-webkit-appearance:none;
border:1px solid #cfcfcf;
border-right:0;
height:23px;
width:200px;
font:inherit;
float:left;
padding:0 3px;
@atomicbird
atomicbird / NSObject+setValuesForKeysWithJSONDictionary.h
Created January 11, 2012 02:35
NSObject category for handling JSON dictionaries. Described in detail at http://www.cimgf.com/2012/01/11/handling-incoming-json-redux/
//
// NSObject+setValuesForKeysWithJSONDictionary.h
// SafeSetDemo
//
// Created by Tom Harrington on 12/29/11.
// Copyright (c) 2011 Atomic Bird, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@steipete
steipete / gist:2963457
Created June 21, 2012 02:16
Allow subscripting on iOS4/5 with Xcode 4.4 (not needed when using 4.5/iOS 6 SDK)
// Add support for subscripting to the iOS 5 SDK.
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 60000
@interface NSObject (PSSubscriptingSupport)
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx;
- (void)setObject:(id)obj forKeyedSubscript:(id <NSCopying>)key;
- (id)objectForKeyedSubscript:(id)key;
@end
@indragiek
indragiek / SNRRestorationManager.h
Created August 19, 2012 20:16
Simple Cocoa state restoration
//
// SNRRestorationManager.h
// Sonora
//
// Created by Indragie Karunaratne on 2012-08-19.
//
#import <Foundation/Foundation.h>
@protocol SNRRestorableState <NSObject>
static NSInteger NSJSONReadingFuckNSNulls = (1UL << 3);
@implementation NSJSONSerialization (FuckNulls)
+ (void)load {
Method originalMethod = class_getClassMethod(self, @selector(JSONObjectWithData:options:error:));
IMP swizzledImplementation = imp_implementationWithBlock([^id (id _self, NSData *_data, NSJSONReadingOptions _opt, NSError **_error){
NSInputStream *stream = [NSInputStream inputStreamWithData:_data];
[stream open];
@joshaber
joshaber / gist:4394046
Created December 28, 2012 02:49
NSEvent+RACSignals
@implementation NSEvent (RACSignals)
+ (id<RACSignal>)rac_signalForEventsMatchingMask:(NSEventMask)eventMask {
return [RACSignal createSignal:^(id<RACSubscriber> subscriber) {
id monitor = [NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^(NSEvent *event) {
[subscriber sendNext:event];
return event;
}];
return [RACDisposable disposableWithBlock:^{
anonymous
anonymous / gist:4468522
Created January 6, 2013 16:53
+ (void)pulseView:(UIView *)view completion:(void (^)(void))block {
// No need for fancy keyframe animation, we can fake this good enough...
[UIView animateWithDuration:0.05 delay:0 options:UIViewAnimationCurveEaseInOut animations:^(void) {
view.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(0.7, 0.7));
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.12 delay:0 options:UIViewAnimationCurveEaseInOut animations:^(void) {
view.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(1.1, 1.1));
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationCurveEaseInOut animations:^(void) {
@0xced
0xced / README.md
Last active November 1, 2018 14:56
How to class-dump an iOS static framework

Using HockeySDK as an example

  1. Download HockeySDK 3.0.0
  2. Run these commands:
ARCH=armv7
FRAMEWORK_DIRECTORY="${HOME}/Downloads/HockeySDK-iOS-3/HockeySDK.embeddedframework"
FRAMEWORK_NAME=$(basename `echo "${FRAMEWORK_DIRECTORY}"/*.framework` .framework)
@mpospese
mpospese / CGRectIntegralScaled.m
Created February 28, 2013 03:34
Pixel aligns rectangles, taking the device's screen scale into account.
CGRect CGRectIntegralScaledEx(CGRect rect, CGFloat scale)
{
return CGRectMake(floorf(rect.origin.x * scale) / scale, floorf(rect.origin.y * scale) / scale, ceilf(rect.size.width * scale) / scale, ceilf(rect.size.height * scale) / scale);
}
CGRect CGRectIntegralScaled(CGRect rect)
{
return CGRectIntegralScaledEx(rect, [[UIScreen mainScreen] scale]);
}
require 'json'
require 'net/http'
# JSON parser tag, creating map for use in jekyll markdown
# Alex.Heneveld @ Cloudsoft Corp (remove spaces and add the .com)
# Released under APL 2.0
# usage: {% jsonball varname from TYPE PARAM %}
#
# where TYPE is one of {data,var,file,page}, described below