Skip to content

Instantly share code, notes, and snippets.

{
"title": "Web-app idea: Good Day Bad Day",
"timestamp": "2013-07-24T21:45:31.000Z",
"visbility": "public"
}
@jazzychad
jazzychad / gist:6117689
Created July 30, 2013 22:34
runOnMainQueue
void runOnMainQueue(dispatch_block_t block)
{
if ([NSThread isMainThread])
{
block();
}
else
{
dispatch_sync(dispatch_get_main_queue(), block);
}
@jazzychad
jazzychad / mainqueue.m
Last active December 20, 2015 10:39
runOnMainQueue
void runOnMainQueue(dispatch_block_t block)
{
if ([NSThread isMainThread]) {
block();
} else {
dispatch_sync(dispatch_get_main_queue(), block);
}
}
@jazzychad
jazzychad / private_header
Created October 8, 2013 20:18
Extracts private methods from a .m class file and creates a Class+Private.h class extension - somehow turning this into an Xcode plugin would also be cool.
#!/bin/bash
# change PREFIX to match whatever you use to denote private
# methods internally in .m files
# e.g.
# - (void)_privateMethod
PREFIX="_"
if [ $# -eq 0 ]
then
{
"title": "An annoying iOS 7 behavior",
"timestamp": "2013-10-26T22:18:10.000Z",
"visbility": "public"
}
@jazzychad
jazzychad / A_README.md
Last active December 28, 2015 02:19
RFC on MTLModel+MTLNSUbiquitousKeyValueStore

MTLModel+MTLNSUbiquitousKeyValueStore

Motivation

To create a method to persist and re-instantiate Mantle MTLModel objects to NSUbiquitousKeyValueStore (iCloud key-value store).

Background

NSUbiquitousKeyValueStore can only store values of class NSNumber, NSString, NSDate, NSData, NSArray, and NSDictionary ("plist types"). The MTLNSUbiquitousKeyValueStore category on MTLModel has been designed to create an NSDictionary representation of a model object in a deeply recursive way, making it suitable for storage in an NSUbiquitousKeyValueStore.

{
"title": "Facebook App Ad Experiment Results",
"timestamp": "2013-11-25T00:16:34.000Z",
"visbility": "public"
}
@jazzychad
jazzychad / SPVMainViewController.m
Created December 8, 2013 22:04
example of transferring velocity of UIPanGestureRecoginizer to a UIView spring animation.
#import "SPVMainViewController.h"
@implementation SPVMainViewController
{
UIView *_weightView;
UIPanGestureRecognizer *_recog;
}
- (void)viewDidLoad
{
{
"title": "Road to Recovery",
"timestamp": "2014-04-24T06:56:47.000Z",
"visbility": "public"
}
@jazzychad
jazzychad / gist:0d730446502902ad3597
Created April 29, 2014 22:51
PS1 w/ git branch
[\h \[\033[0;36m\]\W\[\033[0m\]$(__git_ps1 " \[\033[1;32m\](%s)\[\033[0m\]")]\$