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
@try | |
{ | |
id textView = [mailComposeViewController valueForKeyPath:@"internal.mailComposeView.textView"]; | |
if ([textView respondsToSelector:@selector(becomeFirstResponder)]) | |
[textView becomeFirstResponder]; | |
} | |
@catch (NSException *e) {} |
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
- (void)logDetailedError:(NSError *)error from:(id)caller selector:(SEL)selector | |
{ | |
#if DEBUG | |
LogMessage(@"coredata", 0, @"*** CORE DATA ERROR: a data store operation failed"); | |
LogMessage(@"coredata", 0, @"*** Caller was: %@ %p %@", [caller class], caller, NSStringFromSelector(selector)); | |
LogMessage(@"coredata", 0, @"*** Error: %@", [error localizedDescription]); | |
NSArray* detailedErrors = [[error userInfo] objectForKey:NSDetailedErrorsKey]; | |
if ([detailedErrors count] > 0) | |
{ | |
for(NSError* detailedError in detailedErrors) |
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
From PrivateFrameworks/Bom.framework: | |
U _BOMCopierCopyWithOptions | |
U _BOMCopierCountFilesInArchive | |
U _BOMCopierFree | |
U _BOMCopierNew | |
U _BOMCopierSetCopyFileFinishedHandler | |
U _BOMCopierSetCopyFileStartedHandler | |
U _BOMCopierSetCopyFileUpdateHandler | |
U _BOMCopierSetFatalErrorHandler | |
U _BOMCopierSetFatalFileErrorHandler |
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 IRWebViewController (irFullscreenMediaPlaybackAutorotationLayoutFix) | |
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { | |
// There is a bug, where launching a media player from the web view, fullscreening it, then rotating the device, and tapping on the media to see the timelime, causes the layout to go all berserk. This is a hack to combat that. | |
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; | |
if ((!self.view.superview) || (self.parentViewController.modalViewController != self) || (self.modalPresentationStyle != UIModalPresentationFullScreen)) { |
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
// Protect against parseInt being used | |
// without radix, by defaulting to 10. | |
// Conditionally check value, in case | |
// future implementations of parseInt | |
// provide native base-10 by default. | |
(function(window) { | |
var _parseInt = window.parseInt; |
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 <Cocoa/Cocoa.h> | |
#include <stdarg.h> | |
// by @MSch <martin@schuerrer.org> | |
// From http://stackoverflow.com/questions/2632300/looping-through-macro-varargs-values | |
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) | |
/* C99-style: anonymous argument referenced by __VA_ARGS__, empty arg not OK */ |
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
coverImage = [[KBImageCacheManager sharedManager] cachedImageForImageObject: imageObject type: imageType]; | |
if ( coverImage == nil ) | |
{ | |
MAKE_WEAK_SELF(); | |
_imageObserver = [[imageObject registerImageUpdateObserverUsingBlock: ^(UIImage *image, NSString *imageID, NSString *type) { | |
USE_WEAK_SELF(); | |
self->_coverImageView.image = image; | |
[[KBImageCacheManager sharedManager] removeObserver: _imageObserver]; | |
[_imageObserver release]; _imageObserver = nil; | |
}] retain]; |
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
// Assuming ARC is enabled. | |
// |button| is of type UIButton (works with NSButton as well). | |
[button addTarget:[^{ NSLog(@"Block invoked."); } copy] | |
action:@selector(invoke) | |
forControlEvents:UIControlEventTouchUpInside]; |
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*)image:(UIImage*)image scaleAndRotateImageToMaxResolution:(int)resolution | |
{ | |
int kMaxResolution = resolution; // Or whatever | |
CGImageRef imgRef = image.CGImage; | |
CGFloat width = CGImageGetWidth(imgRef); | |
CGFloat height = CGImageGetHeight(imgRef); | |
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
#ifndef _DCT_WEAK_H | |
#define _DCT_WEAK_H | |
// Macros for portable support of notionally weak properties with ARC | |
// Forked from https://gist.github.com/1354106 | |
// Updated by Rowan James | |
// Available at https://gist.github.com/1530868 | |
// Defines: | |
// dct_weak to be used as a replacement for the 'weak' keyword: | |
// @property (dct_weak) NSObject* propertyName; |