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
// usage | |
let pop = PopoverViewController<SomeViewController>() | |
self.showViewController(pop) // adds pop.view as a subview (stepping over this line reveals that pop.view becomes non-nil) | |
// -viewDidLoad is not called... |
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
typealias Boool = Bool? // Can be true, false, or nil |
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 UIGestureRecognizer (ForDummies) | |
+ (instancetype)newWithView:(UIView *)view target:(id)target action:(SEL)action delegate:(id<UIGestureRecognizerDelegate>)delegate | |
{ | |
UIGestureRecognizer *gesture = [[[self class] alloc] initWithTarget:target action:action]; | |
gesture.delegate = delegate; | |
[view addGestureRecognizer:gesture]; | |
view.userInteractionEnabled = YES; | |
return gesture; |
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
// This is bad and I feel bad. Suggestions for improvements on finding Emoji? | |
// This current solution is acceptable for us right now, but obviously the less I have to exclude the better. | |
@interface NSString (Emoji) | |
/** | |
Returns if the receiver may contain Emoji characters. | |
@note This method may have false-positives since it sees if the string has non-ASCII characters. If the receiver has a non-Emoji, non-ASCII character (like é) then it will still return YES. | |
*/ |
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
<?php /* With apologies to Dr. Drang and John Siracusa. | |
feed-subscribers.php | |
By Marco Arment. | |
Released into the public domain with no warranties and no restrictions. | |
Usage: Pipe an Apache access log into stdin, e.g.: | |
php -f feed-subscribers.php < /var/log/httpd/access_log |
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
// Loads the full-sized image ... might be big. | |
- (void)originalImageWithCompletionHandler:(DownloadedImageCompletionHandler)completionHandler { | |
// First check to see if this image is cached in memory, if execute the handler passing in the image. | |
if (nil != _originalImage) { | |
if (completionHandler) { | |
completionHandler(self, _photo, _photo.urlOriginal, _originalImage); | |
} | |
NewerOlder