Skip to content

Instantly share code, notes, and snippets.

static NSString * sVar1 = nil;
+ (NSString *)var1
{
// This used to be @synchronized(sVar1)
@synchronized(self)
{
if (sVar1 == nil)
sVar1 = [[self getValue] retain];
}
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
// gcc -o undefined-key undefined-key.m -framework Foundation
#import <Foundation/Foundation.h>
@interface Foo : NSObject { }
@end
@implementation Foo
#if 1
% redcloth
*(foo) one
* two
* three
* four
<ul class="foo">
<li>one</li>
<li>two</li>
<li>three</li>
@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
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
#define DDFOREACH(_ARRAY_, _BLOCK_) { \
[_ARRAY_ enumerateObjectsUsingBlock:^(id object, NSUInteger idx, BOOL *stop) { \
_BLOCK_(object); \
}]; \
}
#define ddbreak *stop = YES; return;
void doForeach(void)
/**
* Allow hiding of disclosure triangles.
* Taken from:
*
* http://blog.petecallaway.net/?p=11
*/
- (NSRect)frameOfOutlineCellAtRow:(NSInteger)row;
{
BOOL showTriangle = YES;
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>
<string>i386</string>
<string>ppc</string>
</array>
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
@ddribin
ddribin / gist:185897
Created September 12, 2009 16:57
main.m
//
// main.m
// Testing
//
// Created by Dave Dribin on 9/12/09.
// Copyright 2009 Bit Maki, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>