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
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
id result = [self doSomethingSlow]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self doSomethingToTableviewWithResult:result] | |
}); | |
}); |
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
+(MySingleton*)sharedSingleton { | |
static MySingleton *sharedSingleton=nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedSingleton = [[self alloc] init]; | |
}); | |
return sharedSingleton; | |
} |
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
// In a UIView subclass: | |
@interface MySlider | |
@property CGFloat min, max; | |
@end | |
@implementation MySlider | |
-(void)setMin:(CGFloat)value { | |
_min = value; | |
[self setNeedsDisplay]; | |
} | |
-(void)setMax:(CGFloat)value { |
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
NSArray* inputURLs = @[[NSURL fileURLWithPath:@"/Users/jon/Desktop/welcome.caf"], [NSURL fileURLWithPath:@"/Users/jon/Desktop/welcome.caf"]]; | |
NSError* error=nil; | |
AVMutableComposition* composition = [AVMutableComposition composition]; | |
for(NSURL* url in inputURLs) { | |
AVMutableCompositionTrack* track = [composition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; | |
AVURLAsset* asset = [AVURLAsset assetWithURL:url]; | |
NSArray* assetTracks = [asset tracksWithMediaType:AVMediaTypeAudio]; | |
AVAssetTrack* assetTrack = assetTracks[0]; | |
[track insertTimeRange:assetTrack.timeRange ofTrack:assetTrack atTime:composition.duration error:&error]; | |
} |
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
id UIFieldEditor = NSClassFromString(@"UIFieldEditor"); | |
if ([UIFieldEditor respondsToSelector:@selector(sharedFieldEditor)]) { | |
[UIFieldEditor performSelector:@selector(sharedFieldEditor)]; | |
} |
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
diff --git a/app/assets/javascripts/extras/embed_editor.js.erb b/app/assets/javascripts/extras/embed_editor.js.erb | |
index 4f6b4e9..79aecf4 100644 | |
--- a/app/assets/javascripts/extras/embed_editor.js.erb | |
+++ b/app/assets/javascripts/extras/embed_editor.js.erb | |
@@ -321,6 +338,7 @@ | |
return this.theme == 'light' ? this.lightLinkColor : this.darkLinkColor; | |
} | |
this.setLinkColor = function( colorName ) { | |
+ this.setUseCustomColor(false); | |
var f = this.theme == 'light' ? this.setLightLinkColor : this.setDarkLinkColor; |
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
# Redis configuration file example | |
#slaveof 10.12.86.71 6379 | |
daemonize yes | |
pidfile /ec/var/redis/redis_6379.pid | |
timeout 300 | |
loglevel notice | |
logfile /home/audioboo/logs/redis_6379.log |
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
Master: | |
[69165] 05 Mar 15:19:02.664 * DB saved on disk | |
[38026] 05 Mar 15:19:06.211 * Background saving terminated with success | |
[38026] 05 Mar 15:19:06.483 * Slave ask for synchronization | |
[38026] 05 Mar 15:19:06.483 * Starting BGSAVE for SYNC | |
[38026] 05 Mar 15:19:07.178 * Background saving started by pid 71219 | |
[71219] 05 Mar 15:19:47.809 * DB saved on disk | |
[38026] 05 Mar 15:19:51.126 * Background saving terminated with success | |
[38026] 05 Mar 15:19:51.497 * Slave ask for synchronization | |
[38026] 05 Mar 15:19:51.497 * Starting BGSAVE for SYNC |
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
__block NSManagedObjectID objectID = nil; | |
[moc performBlockAndWait: ^{ | |
NSManagedObject* object = findOrCreateSomethingSpecial(moc); | |
objectID = object.objectID; | |
}]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
doSomethingWith(objectID); | |
}); |
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 Person : NSObject | |
@property NSString* firstName, *lastName; | |
-(NSString*)fullName; | |
@end | |
@implementation Person | |
+ (NSSet *)keyPathsForValuesAffectingFullName { | |
return [NSSet setWithObjects:@"lastName", @"firstName", nil]; | |
} |
OlderNewer