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
// | |
// Version 2 of pagesFromData from Flattenin' Your Mappenin' | |
// http://robnapier.net/flatmap | |
// | |
import Foundation | |
infix operator >>== {} | |
func >>== <T,U>(x: T, f:T -> Result<U>) -> Result<U> { | |
return x.flatMap(f) |
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
@implementation NSArray (BadThirdPartyImplementation) | |
- (id)firstObject | |
{ | |
return self[0]; | |
} | |
@end |
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
Execute in Terminal. This Downloads every Movie in HD | |
curl -s https://developer.apple.com/videos/wwdc/2015/ | grep "?id=" | sed "s/.*id\=/curl\ \-s https:\/\/developer\.apple\.com\/videos\/wwdc\/2015\/\\\?id\=/"\ | sed "s/\".*/\| grep HD \| sed \"s\/.*\<a href\\\\=\\\\\"\/\/\"\| sed \"s\/\\\\\".\*\/\/\" /" | sh | sed "s/http/curl \-C \- \-O \"http/" | sed "s/\?dl\=1/\"/" | grep http | sh | |
Not working any more | |
@alexsporn made the script better | |
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
static id _commonInit(MyView *self) | |
{ | |
// common init stuff like so... | |
self.opaque = YES; | |
self->_scale = 1.0; | |
return self; | |
} | |
- initWithFrame:(CGRect)frame; |
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
// | |
// UIImage+Retina4.h | |
// StunOMatic | |
// | |
// Created by Benjamin Stahlhood on 9/12/12. | |
// Copyright (c) 2012 DS Media Labs. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
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
// (c) 2015 Nate Cook, licensed under the MIT license | |
// | |
// Initializers for Dictionary like NSDictionary +dictionaryWithObjects:forKeys: | |
public extension Dictionary { | |
/// Creates a new Dictionary from the given `keys` and `values` collections. | |
/// | |
/// More efficient than the sequence version because it can reserve the correct | |
/// capacity before filling the dictionary. Returns `nil` if the lengths of the | |
/// two collections differ. |
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
[[NSNotificationCenter defaultCenter] addObserverForName:nil object:nil queue:nil usingBlock:^(NSNotification *note) { | |
NSLog(@"%@: %@", note.name, note.userInfo); | |
}]; |
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
/* | |
Core Data is great but automatic migrations can be tricky. Migrations can take a long time, which could | |
result in [your app being terminated](http://stackoverflow.com/questions/13333289/core-data-timeout-adding-persistent-store-on-application-launch) | |
if it is happening on the main thread during application launch. Performing migrations on a background | |
thread is also a [bad idea](http://stackoverflow.com/a/2866725/503916), meaning your application really | |
needs to be able to fully launch *without a Core Data stack whatsoever* in order to safely migrate. | |
This can be a huge change to make to an existing app. | |
If you're really only using Core Data as a cache, you don't actually *need* to perform a migration. | |
Simply check if the existing store is compatible with your managed object model and if so, delete |
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
#import <Foundation/Foundation.h> | |
@interface Node : NSObject | |
@property (nonatomic) NSInteger identifier; | |
@property (nonatomic, copy) NSString *value; | |
+ (Node *)nodeWithIdentifier:(NSInteger)identifier value:(NSString *)value; | |
@end | |
@implementation Node | |
+ (Node *)nodeWithIdentifier:(NSInteger)identifier value:(NSString *)value { |
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
import os | |
import re | |
import sys | |
projectRoot = sys.argv[1] | |
imageNamedRegex = re.compile('Named:@"([^"]+)"') | |
resourceRegEx = re.compile('<string key="NSResourceName">([^<]+)</string>') | |
def rootImageName(imageName): | |
imageName = re.sub('.png$', '', imageName) |
OlderNewer