View products.json
{
"products": [
{
"name": "macbook-12-inch",
"brand": "MacBook",
"model": "MacBook 12-inch",
"video-screensaver": {
"src": "\/videos\/mac-fall2016\/16x10\/screensaver.mov",
"width": "1152",
"height": "720"
View iOS 7 dynamic font mappings
+ (void)describePreferredFonts
{
static NSArray *textStyles;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
textStyles = @[UIFontTextStyleHeadline,
UIFontTextStyleSubheadline,
UIFontTextStyleBody,
UIFontTextStyleFootnote,
UIFontTextStyleCaption1,
View Trees.swift
//: Playground - noun: a place where people can play
//: Prop 'til you Drop
indirect enum Formula : CustomStringConvertible {
case Var(String)
case Or(Formula, Formula)
case And(Formula, Formula)
case Imply(Formula, Formula)
case BiImply(Formula, Formula)
case Negate(Formula)
View MHNatGeoViewControllerTransition
Pod::Spec.new do |s|
s.name = 'MHNatGeoViewControllerTransition'
s.version = '0.0.1'
s.summary = 'A new ViewController transition inspired by NatGeo City Guides by National Geographic.'
s.homepage = 'https://github.com/michaelhenry/MHNatGeoViewControllerTransition'
s.author = 'Michael Henry'
s.source = { :git => 'https://github.com/michaelhenry/MHNatGeoViewControllerTransition.git' }
s.source_files = 'MHNatGeoViewControllerTransition/*'
end
View gist:3444720
- (void)refreshArticles
{
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeGradient];
__weak SMArticlesViewController *me = self;
[[self articlesDataSource] loadArticlesWithOnLoad:^(NSArray *newObjects) {
if (me != nil) {
[me.tableView reloadData];
[SVProgressHUD dismissWithSuccess:nil afterDelay:1];
View gist:3444690
#import <RestKit/RestKit.h>
@class SMArticle
@interface SMArticleDataController : NSObject
- (void)loadArticlesWithOnLoad:(RKObjectLoaderDidLoadObjectsBlock)loadBlock onError:(RKRequestDidFailLoadWithErrorBlock)failBlock;
- (int)articleCount;
- (SMArticle*)articleAtIndex:(int)index;
View gist:3444638
#import "SMArticle.h"
#import <RestKit/RestKit.h>
@implementation SMArticle
@synthesize articleID,name;
+ (RKObjectMapping *)mapping {
View gist:3444636
NSURL* baseURL = [NSURL URLWithString:@"https://api.example.com/"];
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:baseURL];
objectManager.acceptMIMEType = RKMIMETypeJSON;
objectManager.serializationMIMEType = RKMIMETypeJSON;
[objectManager.mappingProvider setMapping:[SMArticle mapping] forKeyPath:@"article"];
[objectManager.mappingProvider
View How not to do GCD
- (void)loadA
{
}
- (void)loadA
{
[[self aDataSource] loadAWithOnLoad:^(NSArray *newObjects) {
NSLog(@"WAIT 1");
} onError:^(NSError *error) {
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];