This file contains hidden or 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
//NSOperationQueue+GlobalBackgroundQueue.h | |
@interface NSOperationQueue (GlobalBackgroundQueue) | |
+ (instancetype)backgroundQueue; | |
@end | |
//NSOperationQueue+GlobalBackgroundQueue.m |
This file contains hidden or 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
//HEADER | |
typedef NSArray *(^M3TestFetchRequestBlock)(NSFetchRequest *, NSError **); | |
@interface M3TestManagedObjectContext : NSManagedObjectContext | |
@property (copy) M3TestFetchRequestBlock fetchRequestBlock; | |
@end |
This file contains hidden or 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
//Pass in arrays of views and access with number keys or add attributes for all | |
NSArray *views = @[ topView, middleView, lastView ]; | |
[containerView setSubviews:views]; | |
[containerView m3_addConstraints:@[ | |
@"$1.top = 0", | |
@"$2.top = $1.bottom", | |
@"$3.top = $2.bottom", | |
@"$3.bottom = 0", | |
@"$all.(left, right) = (0, 10)", //Assign multiple attributes in one statement | |
@"$all.height >= 30" |
This file contains hidden or 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
Basically I can turn this: | |
[[[[loginResult | |
where:^(id x) { | |
return [x hasError]; | |
}] | |
select:^(id x) { | |
return [x error]; | |
}] | |
injectObjectWeakly:self] |
This file contains hidden or 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
def fac(n, limit) | |
if n == 1 | |
return 1 | |
end | |
if n == limit | |
return limit | |
end | |
return n * fac(n - 1, limit) | |
end |
This file contains hidden or 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)submitDetails { | |
//If the user said not to send, don't | |
if (![[NSUserDefaults standardUserDefaults] boolForKey:TWSSendSystemProfile]) | |
return; | |
//Generate our last sent check and see if it is different to the stored one | |
NSString *lastSent = [[NSDate date] descriptionWithCalendarFormat:@"%Y%m" timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0] locale:nil]; | |
if ([lastSent isEqualToString:[[NSUserDefaults standardUserDefaults] objectForKey:TWSLastSent]]) | |
return; | |
This file contains hidden or 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)sendDetails { | |
if ([self _shouldShowPrompt]) { | |
[permissionPromptController showWindow:self]; | |
} else { | |
[submitter submitDetails]; | |
} | |
} | |
- (BOOL)_shouldShowPrompt { |
This file contains hidden or 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)performLayout | |
{ | |
[super performLayout]; | |
myScrubView.frame = self.bounds; | |
BOOL reload = NO; | |
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; | |
if (orientation == UIInterfaceOrientationPortrait) | |
{ |
This file contains hidden or 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)method1:(id)somethingElse { | |
NSString *identifier = [NSString stringWithFormat:@"%@.%@", [SomeClass someMethod], somethingElse]; | |
MyObject *obj = [[MyObject alloc] initWithIdentifier:identifier]; | |
… | |
} | |
- (void)method2:(id)somethingElse { | |
NSString *identifier = [NSString stringWithFormat:@"%@.%@", [SomeOtherClass someOtherMethod], somethingElse]; | |
MyObject *obj = [[MyObject alloc] initWithIdentifier:identifier]; |
This file contains hidden or 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/env ruby | |
#This script currently only works if you have your derived data in the default location | |
#First look for a project path as our workspace | |
xcodeWorkspacePath = ENV['XcodeProjectPath'] | |
if xcodeWorkspacePath | |
workspaceName = /([\w\s]+).xcodeproj/.match(xcodeWorkspacePath)[1] | |
#If we don't have a project we have a workspace, check for that and exit with code 1 if that doesn't exist | |
else |