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
// Construct and run the javascript. SBJsonParser only works with objects or | |
// arrays, so we wrap the result in an array in case the result is not either | |
// an object or an array. | |
NSString* wrappedJavascript = | |
[NSString stringWithFormat:@"JSON.stringify([%@])", javascript]; | |
NSString* resultJSON = [componentPlugin writeJavascript:wrappedJavascript]; | |
// Parse and return the result, making sure to unwrap the result first. | |
SBJsonParser* jsonParser = [[[SBJsonParser alloc] init] autorelease]; | |
NSArray* wrappedResult = [jsonParser objectWithString:resultJSON]; |
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 char clickTargetScaleKey; | |
static char clickTargetWidthKey; | |
static char clickTargetHeightKey; | |
BOOL pointInsideWithEvent( | |
UIView* self, SEL _cmd, CGPoint point, UIEvent* event) { | |
NSNumber* clickTargetScaleNumber = | |
objc_getAssociatedObject(self, &clickTargetScaleKey); | |
assert(clickTargetScaleNumber); | |
float clickTargetScale = [clickTargetScaleNumber floatValue]; |
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
+ (UIColor*)colorFromString:(NSString*)colorString | |
{ | |
UIColor* color; | |
if ([colorString characterAtIndex:0] == '#') { | |
unsigned int hexValue; | |
[[NSScanner scannerWithString:[colorString substringFromIndex:1]] | |
scanHexInt:&hexValue]; | |
NSInteger red, green, blue; | |
switch([colorString length]) { |
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
** Invoke test:full (first_time) | |
** Invoke test (first_time) | |
** Execute test | |
/home/matt/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -w -I"lib:lib:test" -rubygems -I"/home/matt/.rvm/gems/ruby-1.9.2-p180@rabl/gems/rake-0.9.2/lib" "/home/matt/.rvm/gems/ruby-1.9.2-p180@rabl/gems/rake-0.9.2/lib/rake/rake_test_loader.rb" "test/*_test.rb" | |
/home/matt/.rvm/gems/ruby-1.9.2-p180@rabl/gems/bundler-1.0.15/lib/bundler/rubygems_ext.rb:43: warning: method redefined; discarding old gem_dir | |
/home/matt/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1262: warning: previous definition of gem_dir was here | |
/home/matt/.rvm/gems/ruby-1.9.2-p180@rabl/gems/bundler-1.0.15/lib/bundler/rubygems_ext.rb:154: warning: method redefined; discarding old hash | |
/home/matt/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/platform.rb:125: warning: previous definition of hash was here | |
/home/matt/.rvm/gems/ruby-1.9.2-p180@rabl/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:183: warning: method redefined; |
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
// Every class using this inherits from the class defining these methods, | |
// and provides a +uiKitSubclass method which returns the class object of | |
// the class which should be swizzled. | |
+ (void)subclassMethod:(SEL)selector | |
withImplementation:(IMP)subclassedImplementation | |
{ | |
Method uiKitMethod = class_getInstanceMethod([self uiKitSubclass], selector); | |
assert(uiKitMethod); |
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
Class superclass = class_getSuperclass([self class]); | |
Method superDealloc = class_getInstanceMethod(superclass, _cmd); | |
IMP superDeallocImp = method_getImplementation(superDealloc); | |
superDeallocImp(self, _cmd); |
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 <UIKit/UIKit.h> | |
@interface DebugUIWebView : UIWebView { | |
@private | |
NSMutableDictionary* sourceIDMap_; | |
} | |
@property (nonatomic, retain) NSMutableDictionary* sourceIDMap; | |
@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
// Start building the command object. | |
var command = { | |
className: service, | |
methodName: action, | |
arguments: [] | |
}; | |
// Register the callbacks and add the callbackId to the positional | |
// arguments if given. | |
var callbackId = null; |
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
[DEBUG] 2011-08-16 19:13:51.691 foo-app[65967:207] Exception - sourceID: 98712768 | |
Source: | |
shouldRotateToOrientation(0); | |
Offending line: | |
1: shouldRotateToOrientation(0); | |
Call stack: | |
(null) | |
(null) |
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
// imageView is a UIImageView | |
NSURL* imageNSURL = [NSURL URLWithString:value]; | |
dispatch_async( | |
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), | |
^{ | |
NSData* imageData = [[NSData alloc] initWithContentsOfURL:imageNSURL]; | |
dispatch_async( | |
dispatch_get_main_queue(), | |
^{ |