Skip to content

Instantly share code, notes, and snippets.

@swillits
swillits / gist:5184433
Last active December 15, 2015 01:59
Coalesced Blocks
@interface GCDCoalescent : NSObject
- (void)dispatchOn:(dispatch_queue_t)queue after:(double)seconds block:(dispatch_block_t)block;
@end
@implementation GCDCoalescent
{
uint64_t count;
}
@interface GCDCoalescent : NSObject
- (void)dispatchOn:(dispatch_queue_t)queue after:(double)seconds block:(dispatch_block_t)block;
@end
@implementation GCDCoalescent
{
uint64_t count;
}
@swillits
swillits / Private Launch Services Flags
Created August 29, 2012 16:56
Private Launch Services Flags
0 2 4 06105 (SMW)
0 2 4 04285 (FFV)
1 0 7 0488e (ML TE)
1 4 3 0488e (L TE)
0 4 1 0408e (SF)
1 0 1 0408e (BT64)
0 4 1 0408e (BT32)
0 0 5 0408e (MQD iOS)
1 4 1 0488e (App Store)
void __AllowOnceEvery(double seconds, void (^block)(void), NSTimeInterval * lastTime)
{
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
if (now - *lastTime > seconds) {
*lastTime = now;
block();
}
}
int main(int argc, const char * argv[])
{
@autoreleasepool {
// Create a pretend Desktop and Documents folder
NSString * desktopFolderPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"Desktop"];
NSString * documentsFolderPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"Documents"];
[[NSFileManager defaultManager] createDirectoryAtPath:desktopFolderPath withIntermediateDirectories:NO attributes:nil error:nil];
[[NSFileManager defaultManager] createDirectoryAtPath:documentsFolderPath withIntermediateDirectories:NO attributes:nil error:nil];
int main(int argc, const char * argv[])
{
@autoreleasepool {
// Create a pretend Desktop and Documents folder
NSString * desktopFolderPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"Desktop"];
NSString * documentsFolderPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"Documents"];
[[NSFileManager defaultManager] createDirectoryAtPath:desktopFolderPath withIntermediateDirectories:NO attributes:nil error:nil];
[[NSFileManager defaultManager] createDirectoryAtPath:documentsFolderPath withIntermediateDirectories:NO attributes:nil error:nil];
@interface NSString (A)
- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target options:(NSStringCompareOptions)options range:(NSRange)searchRange withHandler:(NSString * (^)(NSString * occurrence, NSRange rangeOfString))replaceBlock;
@end
@implementation NSString (A)
- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target options:(NSStringCompareOptions)options range:(NSRange)searchRange withHandler:(NSString * (^)(NSString * occurrence, NSRange rangeOfString))replaceBlock;
{
NSMutableString * ms = [[self mutableCopy] autorelease];
$ script/plugin install [email protected]:contrast/uploadify-s3.git
Initialized empty Git repository in ../vendor/plugins/uploadify-s3/.git/
Permission denied (publickey).
fatal: The remote end hung up unexpectedly