This file contains hidden or 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
| // | |
| // NSObject+setValuesForKeysWithJSONDictionary.h | |
| // SafeSetDemo | |
| // | |
| // Created by Tom Harrington on 12/29/11. | |
| // Copyright (c) 2011 Atomic Bird, LLC. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
This file contains hidden or 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> | |
| // Xcode_3_2_6/usr/bin/gcc -arch ppc -std=c99 -isysroot /Xcode_3_2_6/SDKs/MacOSX10.5.sdk -g -Wall -framework Foundation -o endian-ppc ~/Downloads/endian.m (thanks to Jeremy W. Sherman for the assist) | |
| // clang -arch x86_64 -g -Weverything -framework Foundation -o endian endian.m | |
| int main (void) { | |
| unsigned int values[] = { 1, 387, 8533937 }; |
This file contains hidden or 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 BlahView : UIView | |
| @end | |
| @implementation BlahView | |
| - (void) drawRect: (CGRect) rect { | |
| CGRect bounds = self.bounds; | |
| UIColor *color = [UIColor colorWithRed: (((int)self) & 0xFF) / 255.0 |
This file contains hidden or 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> | |
| // clang -g -fobjc-arc -Wall -framework Foundation -o unsafe unsafe.m | |
| @interface NSThing : NSObject | |
| @end | |
| @implementation NSThing | |
| - (void) dealloc { |
This file contains hidden or 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> | |
| // clang -g -Wall -framework Foundation -o atomic atomic.m | |
| // gcc -g -Wall -framework Foundation -o atomic atomic.m | |
| @interface Blah : NSObject | |
| @property (assign, NS_NONATOMIC_IOSONLY) NSInteger frobnozzle; | |
| @property (assign, ) NSInteger commaAtEnd; | |
| // @property (, assign) NSInteger commaAtBeginning; // Syntax error | |
| @property (atomic, assign) NSInteger blah; // complains in gcc |
This file contains hidden or 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> | |
| // clang -g -fobjc-arc -Weverything -framework Foundation -o fast-enum-1 fast-enum-1.m | |
| #pragma clang diagnostic ignored "-Wobjc-missing-property-synthesis" | |
| // -------------------------------------------------- | |
| // Pass-through | |
| @interface Musician : NSObject | |
| + (id) musicianWithName: (NSString *) name instrument: (NSString *) instrument; |
This file contains hidden or 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> | |
| // clang -g -fobjc-arc -Weverything -framework Foundation -o fast-enum fast-enum.m | |
| #pragma clang diagnostic ignored "-Wobjc-missing-property-synthesis" | |
| // -------------------------------------------------- | |
| // Code to iterate a non-array based collection and use fast | |
| // enumeration's stack buffer | |
| // This is a linked list that holds strings. Pretty uninspired. |
This file contains hidden or 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> | |
| // clang -g -Weverything -framework Foundation -o count count.m | |
| @interface CountTest : NSObject | |
| - (NSUInteger) count; // notice not a @property | |
| @end |
This file contains hidden or 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> | |
| // clang -g -fobjc-arc -framework Foundation -o array array.m | |
| void observeObject (id objectToWatch) { | |
| // Just a stub to give DTrace something to hook in to. | |
| } | |
| int main (void) { | |
| @autoreleasepool { |
This file contains hidden or 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 <mach/mach_time.h> // for mach_absolute_time() and friends | |
| // clang -g -fobjc-arc -Weverything -Wno-unused-parameter -framework Foundation -o iteration iteration.m | |
| // Run this by passing arguments on the command line. Run without any | |
| // arguments to see the supported flags. Each time a flag is used causes | |
| // that test to be run and timed, with the time (in seconds) output when | |
| // it finishes. Be careful not to do anything else on your machine (such | |
| // as surfing Redding while getting bored looking at the terminal) otherwise |