Skip to content

Instantly share code, notes, and snippets.

#define DDFOREACH(_ARRAY_, _BLOCK_) { \
[_ARRAY_ enumerateObjectsUsingBlock:^(id object, NSUInteger idx, BOOL *stop) { \
_BLOCK_(object); \
}]; \
}
#define ddbreak *stop = YES; return;
void doForeach(void)
Summary:
The managed object context does not receive NSEditorRegistration notifications when binding the underlying array controller's content set.
Steps to Reproduce:
Using the attached MyTunes project:
1. Add an album
2. Add a song
3. Edit the song's name
4. Click the "Commit MOC" button
@ddribin
ddribin / fizzBuzz.hs
Created June 5, 2009 07:01
My first Haskell app
#!/usr/bin/env runghc
-- | Returns a Fizz Buzz string for a single number
toFizzBuzz :: Int -> String
toFizzBuzz n
| fizz && buzz = "FizzBuzz"
| fizz = "Fizz"
| buzz = "Buzz"
| otherwise = show n
where fizz = n `mod` 3 == 0
% redcloth
*(foo) one
* two
* three
* four
<ul class="foo">
<li>one</li>
<li>two</li>
<li>three</li>
// gcc -o undefined-key undefined-key.m -framework Foundation
#import <Foundation/Foundation.h>
@interface Foo : NSObject { }
@end
@implementation Foo
#if 1
objc[13184]: OBJC_HELP: describe Objective-C runtime environment variables
objc[13184]: OBJC_PRINT_OPTIONS: list which options are set
objc[13184]: OBJC_PRINT_IMAGES: log image and library names as they are loaded
objc[13184]: OBJC_PRINT_LOAD_METHODS: log calls to class and category +load methods
objc[13184]: OBJC_PRINT_INITIALIZE_METHODS: log calls to class +initialize methods
objc[13184]: OBJC_PRINT_RESOLVED_METHODS: log methods created by +resolveClassMethod: and +resolveInstanceMethod:
objc[13184]: OBJC_PRINT_CLASS_SETUP: log progress of class and category setup
objc[13184]: OBJC_PRINT_PROTOCOL_SETUP: log progresso of protocol setup
objc[13184]: OBJC_PRINT_IVAR_SETUP: log processing of non-fragile ivars
objc[13184]: OBJC_PRINT_FUTURE_CLASSES: log use of future classes for toll-free bridging
static NSString * sVar1 = nil;
+ (NSString *)var1
{
// This used to be @synchronized(sVar1)
@synchronized(self)
{
if (sVar1 == nil)
sVar1 = [[self getValue] retain];
}
/* NOTE: The recommended location for flat-file helper binaries is in .../Contents/MacOS. We cannot put the helper there because there is a bug in LaunchServices which can result in the wrong main executable being recorded in the LS database. Subsequent attempts to open the bundled application with LS result in the wrong binary being executed. This happens when
- the helper is in .../Contents/MacOS/
- the helper is executed before the application bundle has been registered with LS
- the helper opens the main application bundle using LS
rdar://problem/5562575
*/
Watchpoint 3 Triggered in Thread 1
Expression: “*(int *) 375667156”
New Value: -1073741821
Old Value: -1825099910
(gdb) bt
#0 0x93b60b83 in tiny_free_list_add_ptr ()
#1 0x93b5dbda in szone_free ()
#2 0x93b5d2cd in free ()
#3 0x93373a6a in xmlCleanupCharEncodingHandlers ()
#4 0x93377438 in xmlCleanupParser ()
/*
* To recreate:
% gcc -o applescript-crash applescript-crash.m -framework Foundation
% DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib gdb ./applescript-crash
(gdb) run
*/
#import <Foundation/Foundation.h>