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
#!/usr/bin/ruby | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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
#!/usr/bin/ruby | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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
@protocol APRemoteAddressBook <NSObject> | |
- (void) allPeople: (void (^)(NSArray *, NSError *)) reply; | |
- (void) mailingAddressesForPersonWithIdentifier: (NSString *) identifier | |
reply: (void (^)(NSArray *, NSError *)) reply; | |
- (void) emailAddressesForPersonWithIdentifier: (NSString *) identifier | |
reply: (void (^)(NSArray *, NSError *)) reply; | |
- (void) phoneNumbersForPersonWithIdentifier: (NSString *) identifier | |
reply: (void (^)(NSArray *, NSError *)) reply; | |
@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
-- Thirty minute timeout | |
with timeout of 108000 seconds | |
repeat while true | |
delay 5 | |
set baseurl to "https://developer.apple.com/devcenter/ios/index.action" | |
set curlshellcode to "curl " & baseurl | |
set theshellresult to do shell script curlshellcode | |
if theshellresult does not contain "maintenance" then | |
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
State of my main queue while running a block (at the start of main() before it all goes pear-shaped) | |
(lldb) expr (void) dispatch_debug((void *)dispatch_get_current_queue(), "main q") | |
=== log file opened for Kobo[7195] at 1337357109.056275 === | |
com.apple.main-thread[0xad009600] = { xrefcnt = 0xffffffff, refcnt = 0xffffffff, suspend_cnt = 0x0, locked = 1, target = com.apple.root.default-overcommit-priority[0xad009b00], width = 0x0, running = 0x0, barrier = 1 }: main q |
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 AQNonZeroBasedArray : NSArray | |
@end | |
@implementation AQNonZeroBasedArray | |
{ | |
NSArray * _realArray; | |
NSUInteger _base; | |
} | |
// initialize it using AQNonZeroBasedArray * array = @[obj1, obj2, obj3]; |
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
Thread 18 name: Dispatch queue: com.apple.root.high-priority | |
Thread 18 Crashed: | |
0 libdispatch.dylib 0x31bb9bb2 dispatch_resume$VARIANT$mp + 46 | |
1 AVFoundation 0x31aa64ae __61-[AVPlayerOccasionalCaller _resetTimerForPlayerNewRate:time:]_block_invoke_0 + 478 | |
2 libdispatch.dylib 0x31bb5c52 _dispatch_call_block_and_release + 6 | |
3 libdispatch.dylib 0x31bb8810 _dispatch_worker_thread2 + 252 | |
4 libsystem_c.dylib 0x37ecddf4 _pthread_wqthread + 288 | |
5 libsystem_c.dylib 0x37ecdcc8 start_wqthread + 0 |
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
// This works: | |
NSURL * base = [NSURL URLWithString: @"http://[::1]:49981/"]; | |
NSURL * full = [base URLByAppendingPathComponent: @"test.html"]; | |
NSLog(@"full = %@", full); // prints "full = http://[::1]:49981/" | |
// This does not: | |
NSURL * base = [NSURL URLWithString: @"" relativeToURL: [NSURL URLWithString: @"http://[::1]:49981/"]; | |
NSURL * full = [base URLByAppendingPathComponent: @"test.html"]; | |
NSLog(@"full = %@", full); // prints "full = (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
#if __has_feature(objc_bool) | |
# define $YES @YES | |
# define $NO @NO | |
# define $i(x) @##x | |
# define $ui(x) @##x | |
# define $l(x) @##x | |
# define $ul(x) @##x | |
# define $ll(x) @##x | |
# define $ull(x) @##x | |
# define $f(x) @##x |
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) initialize | |
{ | |
if ( self != [KHLineBreaker class] ) | |
return; | |
typedef BOOL (^charsetClassMatchingRule)(NSCharacterSet * charset, NSAttributedString * attrStr, NSUInteger index); | |
charsetClassMatchingRule inCharset = ^(NSCharacterSet * charset, NSAttributedString * attrStr, NSUInteger index) { | |
return ( [charset characterIsMember: [[attrStr string] characterAtIndex: index]] ); | |
}; | |
BOOL (^isOrnamentedCharacterComplex)(NSAttributedString*, NSUInteger) = ^BOOL(NSAttributedString * attrStr, NSUInteger index) { |
NewerOlder