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
@interface SomeClass | |
{ | |
... | |
} | |
// Use 'assign' because a meta class is not subject to the normal retain/release lifecycle. | |
// It will exist until the application is terminated (Class Initialization -> Application Termination) | |
// regardless of the number of objects in the runtime that reference it. | |
@property (nonatomic, assign) id<ExternalUtility> externalUtility | |
@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
slow_connection () { | |
if [ -z $1 ]; then | |
echo "Bandwidth must be provided" | |
return | |
fi | |
default_port="80" | |
sudo ipfw pipe 1 config bw $1KByte/s | |
sudo ipfw add 1 pipe 1 src-port ${2:-$default_port} |
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
@implementation MyController | |
@synthesize applicationModel = _applicationModel; | |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
{ | |
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
if (self) { | |
self.applicationModel = [[Objection globalInjector] getObject:[WCMyControllerApplicationModel class]]; | |
self.applicationModel.controller = self; | |
self.title = NSLocalizedString(@"My Title", @""); |
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
@interface ObjectionProvider : NSObject { | |
} | |
- (id)getObject:(Class)theClass; | |
@end | |
@implementation ObjectionProvider | |
objection_register_singleton(ObjectionProvider) |
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
// Example Discussion APN Payload | |
{ | |
"device_tokens": ["<Tokens of Users in Group>"], | |
"aps": {"alert": "<Person> posted a message on <Group>"}, | |
"type": 0 // 0 = Discussion, 1 = Comment | |
"DiscussionAlert": { | |
"groupID": 122, | |
"groupName": "The Name" | |
} | |
} |
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
require 'real_growl' | |
=> true | |
>> rg("Check out", ["Real", "Growl"], :icon => "/path/to/a/picture.jpg") | |
>> rg("Google", ["Real", "Growl"], :icon => "http://www.google.com/logos/stpatricks_d4gwinner_eo09.gif") | |
=> nil | |
>> Kernel.rg_sticky = false | |
=> false | |
>> Kernel.rg_priority = 3 | |
=> 3 |
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
>> require 'real_growl' | |
>> my_own_application = RealGrowl::Application.new("AppName") | |
=> #<RealGrowl::Application:0x1018eb6b8> | |
>> my_own_application.notify(:title => "Title", :description => "Desc", :priority => 0, :sticky => true, :icon => "/path/to/image.png") |
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
require 'real_growl_api' | |
require 'pp' | |
module RG | |
module ClassMethods | |
attr_accessor :rg_sticky, :rg_priority, :rg_icon | |
end | |
module InstanceMethods |
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 void *kBindingContext = &kBindingContext; | |
@implementation MySlider | |
@synthesize requestModel; | |
@synthesize percent; | |
- (id)init { | |
if((self = [super init])) { | |
[requestModel addObserver:self forKeyPath:@"percentUploaded" options:0 context:kBindingContext]; |
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
@implementation MySlider | |
@synthesize requestModel; | |
@synthesize percent; | |
- (id)init { | |
if((self = [super init])) { | |
[requestModel bindProperty:@"percent" onTarget:self toKeyPath:@"percentUploaded"]; | |
} | |
return self; | |
} |