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
CGRect PSPDFRectSafeInset(CGRect rect, CGFloat dx, CGFloat dy) { | |
CGRect insetRect = CGRectInset(rect, dx, dy); | |
if (CGRectIsNull(insetRect)) { | |
insetRect = CGRectMake(CGRectGetMidX(rect), CGRectGetMidY(rect), 0.f, 0.f); | |
} | |
return insetRect; | |
} |
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
enum MyEnum { | |
case StateA | |
case StateB | |
} | |
let enumValueA = MyEnum.StateA | |
let enumValueB = MyEnum.StateB | |
if enumValueA == enumValueB { |
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
fetchRequest.entity = [RNPFeedListEntry entityInManagedObjectContext:self.managedObjectContext]; | |
// this is the main predicate to get the feed entries that belong to the us | |
NSPredicate *ownerPredicate = [NSPredicate predicateWithFormat:@"%K == %@ AND %K.%K == %@", | |
RNPFeedListEntryRelationships.owner, self, RNPFeedListEntryRelationships.feed, | |
RNPFeedAttributes.action, @(FeedAction_LIKE), self]; | |
// this is the predicate to check that we have the required item | |
NSPredicate *itemPopulatedPredicate = [NSPredicate predicateWithFormat:@"(%K.%K == nil) OR (%K.%K != nil)", | |
RNPFeedListEntryRelationships.feed, RNPFeedAttributes.itemId, | |
RNPFeedListEntryRelationships.feed, RNPFeedRelationships.item]; | |
fetchRequest.predicate = [NSCompoundPredicate andPredicateWithSubpredicates:@[ownerPredicate, itemPopulatedPredicate]]; |
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
@implementation ShakeAnimation { | |
CGRect originalRect; | |
NSInteger counter; | |
} | |
+ (void)shakeView:(UIView *)view { | |
[[[[self class] alloc] initWithView:view] shake]; | |
} | |
- (id)initWithView:(UIView *)view { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>--project-company</key> | |
<string>Elegant Chaos</string> | |
<key>--company-id</key> | |
<string>com.elegantchaos</string> | |
<key>--keep-undocumented-objects</key> | |
<false/> |
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
#ifndef _DCT_WEAK_H | |
#define _DCT_WEAK_H | |
// Macros for portable support of notionally weak properties with ARC | |
// Contributors: Daniel Tull, Abizer Nasir, Rowan James | |
// Current version: https://gist.github.com/1652385 | |
// Defines: | |
// dct_weak to be used as a replacement for the 'weak' keyword: | |
// @property (dct_weak) NSObject* propertyName; | |
// __dct_weak to be used as a replacement for the '__weak' variable attribute: |
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
#ifndef _DCT_WEAK_H | |
#define _DCT_WEAK_H | |
// Macros for portable support of notionally weak properties with ARC | |
// Forked from https://gist.github.com/1354106 | |
// Updated by Rowan James | |
// Available at https://gist.github.com/1530868 | |
// Defines: | |
// dct_weak to be used as a replacement for the 'weak' keyword: | |
// @property (dct_weak) NSObject* propertyName; |