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
tell application "Safari" | |
activate | |
tell window 1 | |
open location "data:text/html;base64,PGI+aGVsbG8hPC9iPg==" | |
end tell | |
end tell |
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)testLoopOneMillionTimes | |
{ | |
__block int count = 0; | |
[self measureBlock:^{ | |
for (int i = 0; i < 1000000; ++i) { | |
count++; | |
} | |
}]; | |
} |
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
func testLoopOneMillionTimesA() { | |
var count = 0 | |
self.measureBlock() { | |
count = 0 | |
for _ in 0..1000000 { | |
++count | |
} | |
} | |
} |
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
func testAppendInt() { | |
var array : Int[] = [] | |
self.measureBlock() { | |
for (var i = 0; i < 1_000_000; ++i) { | |
array.append(i) | |
} | |
} | |
} |
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)testAppendInt | |
{ | |
NSMutableArray *array = [[NSMutableArray alloc] init]; | |
[self measureBlock:^{ | |
for (int i = 0; i < 1000000; ++i) { | |
[array addObject:@(i)]; | |
} | |
}]; | |
} |
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
if (myDelegate != nil) { | |
if ([myDelegate respondsToSelector:@selector(scrollViewDidScroll:)]) { | |
[myDelegate scrollViewDidScroll:myScrollView]; | |
} | |
} |
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
{ | |
"stat": "ok", | |
"blogs": { | |
"blog": [ | |
{ | |
"id" : 73, | |
"name" : "Bloxus test", | |
"needspassword" : false, | |
"url" : "http://remote.bloxus.com/" | |
}, |
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
if ([json isKindOfClass:[NSDictionary class]]) { | |
NSDictionary *dict = json[@"blogs"]; | |
if ([dict isKindOfClass:[NSDictionary class]]) { | |
NSArray *blogs = dict[@"blogs"][@"blog"]; | |
if ([blogs isKindOfClass:[NSArray class]]) { | |
for (NSDictionary *blog in blogs) { | |
if ([blog isKindOfClass:[NSDictionary class]]) { | |
NSLog(@"Blog ID: %@", blog[@"id"]); | |
NSLog(@"Blog Name: %@", blog[@"name"]); | |
NSLog(@"Blog Needs Password: %@", blog[@"needspassword"]); |
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
if let dict = json as? NSDictionary { | |
if let blogs = dict["blogs"] as? Dictionary<String, AnyObject> { | |
if let blogItems : AnyObject = blogs["blog"] { | |
if let collection = blogItems as? Array<AnyObject> { | |
for blog : AnyObject in collection { | |
if let blogInfo = blog as? Dictionary<String, AnyObject> { | |
let id : AnyObject? = blogInfo["id"] | |
let name : AnyObject? = blogInfo["name"] | |
let needspassword : AnyObject? = blogInfo["needspassword"] | |
let url : AnyObject? = blogInfo["url"] |
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
var json = [ | |
"stat": "ok", | |
"blogs": [ | |
"blog": [ | |
[ | |
"id" : 73, | |
"name" : "Bloxus test", | |
"needspassword" : true, | |
"url" : "http://remote.bloxus.com/" | |
], |
OlderNewer