Skip to content

Instantly share code, notes, and snippets.

View gonzalezreal's full-sized avatar
💭
I may be slow to respond.

Guille Gonzalez gonzalezreal

💭
I may be slow to respond.
View GitHub Profile
@gonzalezreal
gonzalezreal / UIView+QuickLook.m
Created March 12, 2014 16:54
Quick look UIViews in Xcode
@import UIKit;
@interface UIView (QuickLook)
@end
@implementation UIView (QuickLook)
- (id)debugQuickLookObject {
return self;
@gonzalezreal
gonzalezreal / TGRAsyncTestHelper.m
Last active August 29, 2015 13:58
TGRAsyncTestHelper
#import <Foundation/Foundation.h>
#define TGR_RUNLOOP_INTERVAL 0.05
#define TGR_TIMEOUT_INTERVAL 1.0
#define TGR_RUNLOOP_COUNT TGR_TIMEOUT_INTERVAL / TGR_RUNLOOP_INTERVAL
#define TGR_CAT(x, y) x ## y
#define TGR_TOKCAT(x, y) TGR_CAT(x, y)
#define __runLoopCount TGR_TOKCAT(__runLoopCount,__LINE__)
#import <Foundation/Foundation.h>
#import <Accounts/Accounts.h>
#import <CoreData/CoreData.h>
@interface TGRTimeline : NSObject
@property (strong, nonatomic, readonly) NSManagedObjectContext *managedObjectContext;
@property (nonatomic, readonly, getter = isLoading) BOOL loading;
- (id)initWithAccount:(ACAccount *)account;
- (void)importValuesFromDictionary:(NSDictionary *)dictionary
{
self.identifier = dictionary[@"id"];
self.name = dictionary[@"name"];
self.screenName = dictionary[@"screen_name"];
self.imageLink = dictionary[@"profile_image_url"];
}
@implementation TGRTimeline
- (id)initWithAccount:(ACAccount *)account
{
self = [super init];
if (self) {
_account = account;
}
return self;
}
- (BOOL)loadNewTweetsWithCompletionHandler:(void (^)(NSError *error))completionHandler
{
if (self.loading) {
return NO;
}
SLRequest *request = [self requestForNewTweets];
[self loadTweetsWithRequest:request completionHandler:completionHandler];
return YES;
- (SLRequest *)requestForNewTweets
{
return nil;
}
- (SLRequest *)requestForOldTweets
{
return nil;
}
+ (NSFetchRequest *)fetchRequestForTwitterUserWithIdentifier:(NSNumber *)identifier;
+ (id)twitterUserWithIdentifier:(NSNumber *)identifier
inManagedObjectContext:(NSManagedObjectContext *)context;
+ (NSFetchRequest *)fetchRequestForTwitterUserWithIdentifier:(NSNumber *)identifier
{
static dispatch_once_t onceToken;
static NSPredicate *predicateTemplate;
dispatch_once(&onceToken, ^{
predicateTemplate = [NSPredicate predicateWithFormat:@"identifier == $IDENTIFIER"];
});
NSPredicate *predicate = [predicateTemplate predicateWithSubstitutionVariables:
#import "TGRManagedObject.h"
@class TGRTwitterUser;
@interface TGRTweet : TGRManagedObject
...