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
#!/usr/bin/ruby | |
# == Usage | |
# | |
# Modifies an existing (and fully-set-up) PackageMaker document to point a package component | |
# at a new Xcode Archive root directory. | |
# | |
# This script is designed to work only with components based on Xcode 4 archives (folders ending | |
# in .xcarchive) containing a 'Products' subfolder which is used as the component's root folder. | |
# |
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
// | |
// KBNetworkActivityIndicator.h | |
// Kobov3 | |
// | |
// Created by Jim Dovey on 10-03-21. | |
// Copyright 2010 Kobo Inc. All rights reserved. | |
// | |
#import <Foundation/Foundation.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
@interface NSManagedObjectContext (AQFixedCountForFetchRequestOnIOS32) | |
@end | |
@implementation NSManagedObjectContext (AQFixedCountForFetchRequestOnIOS32) | |
+ (void) load | |
{ | |
// +load gets called per-category, unlike +initialize | |
if ( [[[UIDevice currentDevice] systemVersion] compare: @"4.0" options: NSNumericSearch] == NSOrderedAscending ) | |
{ |
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
#if __has_feature(arr) | |
# if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_5_0 | |
# define block_unretained(obj) id _block_##obj __weak = (obj) | |
# else | |
# define block_unretained(obj) id _block_##obj __unsafe_unretained = (obj) | |
#else | |
# define block_unretained(obj) id _block_##obj __block = (obj) | |
#endif |
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
+ (void) load | |
{ | |
if ( dispatch_barrier_async == 0 ) | |
return; | |
// switch in the dispatch_barrier_async() versions since they're available | |
Method m1 = class_getInstanceMethod(self, @selector(handleEventsForObserver:usingBlock:)); | |
Method m2 = class_getInstanceMethod(self, @selector(_barrier_handleEventsForObserver:usingBlock:)); | |
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> | |
#import <dispatch/dispatch.h> | |
#import "MAZeroingWeakRef.h" | |
@interface KBMultiDispatchSource : NSObject | |
{ | |
dispatch_source_t _dispatch; | |
dispatch_queue_t _queue; | |
dispatch_source_type_t _type; | |
CFMutableDictionaryRef _eventObservers; |
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
[managedObjectContext setMergePolicy: NSMergeByPropertyObjectTrumpMergePolicy]; | |
[managedObjectContext setPersistentStoreCoordinator: coordinator]; | |
- StoreManagedObjectContextForCurrentThread( managedObjectContext ); // store in thread dictionary | |
+ | |
+ if ( [NSThread isMainThread] ) | |
+ StoreManagedObjectContextForCurrentThread(managedObjectContext); // store in thread dictionary | |
+ else | |
+ dispatch_sync(dispatch_get_main_queue(), ^{ StoreManagedObjectContextForCurrentThread(managedObjectContext); }); | |
// set some flags in the store metadata |
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
// | |
// main.m | |
// BlocksRuntime | |
// | |
// Created by Jim Dovey on 11-07-22. | |
// Copyright 2011 Jim Dovey. All rights reserved. | |
// | |
#import <Foundation/Foundation.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
+ (NSFetchRequest *) findPageNoteWithRangeRequestWithVariables: (NSDictionary *) variables context: (NSManagedObjectContext *) context | |
{ | |
// template does something like the following: | |
/* | |
$pageLen = ($pageEnd - $pageStart); | |
$halfPageLen = $pageLen / 2; | |
$boundStart = $PAGE_START - $halfPageLen; | |
$boundEnd = $PAGE_END + $halfPageLen; | |
return "(contentItem.contentID == $CONTENT_ID) AND (chapterFileName == $CHAPTER_FILE_NAME) AND (pageStart BETWEEN {$boundStart, $PAGE_END}) AND (pageEnd BETWEEN {$PAGE_START, $boundEnd})"; | |
*/ |