WWDC 2006 2007 2008 2009 2010 2011 2012 2013 2014
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
icon.iconset |
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
# Manual opt parsing example | |
# | |
# Features: | |
# - supports short and long flags (ie: -v|--verbose) | |
# - supports short and long key/value options (ie: -f <file> | --filename <file>) | |
# - supports short and long key/value options with equals assignment (ie: -f=<file> | --filename=<file>) | |
# - does NOT support short option chaining (ie: -vh) | |
# - everything after -- is positional even if it looks like an option (ie: -f) | |
# - once we hit an arg that isn't an option flag, everything after that is considered positional | |
function optparsing_demo() { |
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
NSView *contentView = [self.window contentView]; | |
self.button = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 50.0f)]; | |
[self.button setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
[self.button setTitle:@"This is a test button"]; | |
[self.button setBordered:YES]; | |
[contentView addSubview:self.button]; | |
NSButton *button = self.button; |
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)loadDefaultSettings | |
{ | |
NSMutableDictionary *defaults = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default-Settings" ofType:@"plist"]]; | |
// other setup... | |
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithDictionary:defaults]]; | |
} | |
- (void)resetDefaultSettings |
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> | |
@interface NSObject (NSObject_KVCExtensions) | |
- (BOOL)canSetValueForKey:(NSString *)key; | |
- (BOOL)canSetValueForKeyPath:(NSString *)keyPath; | |
@end |
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
#define BLOCK(...) ({ __block __typeof__(self) bself = self; __VA_ARGS__(); )} |
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
// | |
// NSObject+BlockObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// [email protected] | |
// Public domain because I love you. Let me know how you use it. | |
// | |
#import <Cocoa/Cocoa.h> |