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
/* | |
* NSException+Backtrace.h | |
* Utilities | |
* | |
* Created by Jim Dovey on 8/7/2010. | |
* | |
* Copyright (c) 2010 Kobo, Inc. | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without |
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 NSString * const AQPerThreadManagedObjectContext = @"AQPerThreadManagedObjectContext"; | |
void StoreManagedObjectContextForCurrentThread( NSManagedObjectContext * context ) | |
{ | |
[[[NSThread currentThread] threadDictionary] setObject: context forKey: AQPerThreadManagedObjectContext]; | |
} | |
NSManagedObjectContext * PerThreadManagedObjectContext( void ) | |
{ | |
NSManagedObjectContext * result = [[[NSThread currentThread] threadDictionary] objectForKey: AQPerThreadManagedObjectContext]; |
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
Index: JavaScriptCore/profiler/ProfilerServer.mm | |
=================================================================== | |
--- JavaScriptCore/profiler/ProfilerServer.mm (revision 60307) | |
+++ JavaScriptCore/profiler/ProfilerServer.mm (working copy) | |
@@ -30,7 +30,7 @@ | |
#import "JSRetainPtr.h" | |
#import <Foundation/Foundation.h> | |
-#if PLATFORM(IPHONE_SIMULATOR) | |
+#if !PLATFORM(IPHONE) |
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
/* | |
* smart_status.c | |
* SMARTStatus | |
* | |
* Created by Jim Dovey on 6/12/2009. | |
* | |
* Copyright (c) 2009 Jim Dovey | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without |
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
/* | |
* proplist.go | |
* PropertyLists | |
* | |
* Created by Jim Dovey on 17/11/2009. | |
* | |
* Copyright (c) 2009 Jim Dovey | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without |
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
/* | |
* $TM_FILENAME | |
* ${1:`echo "$TM_FILEPATH" | awk -F"/" '{x=NF-1}{print $x}'`} | |
* | |
* Created by `id -P | awk -F ":" '{ print $8 }'` on `date "+%d/%m/%Y"`. | |
* | |
* Copyright (c) `date +%Y` ${2:$TM_ORGANIZATION_NAME} | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without |
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) functionWhichAnnoyinglyBlocksExecution: (NSFileHandle *) annoyingFileHandle | |
{ | |
dispatch_async(dispatch_get_global_queue(0,0), ^{ | |
id result = [annoyingFileHandle someBlockingOp]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[myController displayResult: result]; | |
}); | |
}); | |
} |
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
// Before: | |
- (IBAction) optimizeDataObject: (MyDataObject *) obj | |
{ | |
// going to start work, so show the user that something's happening | |
[self.progressIndicator startAnimating]; | |
// these two are *usually* quick -- unless the user opens a 1GB file. | |
// because this is happening in an event handler, it'll stall the event loop, which | |
// causes the good ol' spinning beachball of death | |
[self pruneDuplicatesInDataObject: obj]; |
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 <libkern/OSAtomic.h> | |
@implementation SomeClass | |
+ (id) someStaticValueComputedOnFirstAccess | |
{ | |
static volatile id __staticVar = nil; | |
if ( __staticVar == nil ) | |
{ | |
id var = [[Something alloc] init]; |
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
/* | |
* Memory.c | |
* Outpost | |
* | |
* Created by Jim Dovey on 23/04/09. | |
* Copyright 2009 Morfunk, LLC. All rights reserved. | |
* | |
* Copyright (c) 2009, Jim Dovey | |
* All rights reserved. | |
* |