Skip to content

Instantly share code, notes, and snippets.

View juliengrimault's full-sized avatar

Julien Grimault juliengrimault

View GitHub Profile
@juliengrimault
juliengrimault / JGLogging.h
Created January 19, 2012 12:52
Logging macros
//
// Logging.h
//
// Created by Julien Grimault (@jgrimaul) on 19/01/2012.
// Copyright (C) 2011-2020 by Steinlogic
#import <Foundation/Foundation.h>
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
@juliengrimault
juliengrimault / DataManager.h
Created March 15, 2012 04:14 — forked from AlexAstroCat/DataManager.h
Core Data singleton manager class capable of being run from a static library
// DataManager.h
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
extern NSString * const DataManagerDidSaveNotification;
extern NSString * const DataManagerDidSaveFailedNotification;
@interface DataManager : NSObject {
}
@juliengrimault
juliengrimault / FileFunctionLevelFormatter.h
Created March 17, 2012 03:33
Cocoa Lumberjack formatter showing file, function and level of the log
//
// FileFunctionLevelFormatter.h
//
// Created by Julien Grimault on 23/1/12.
// Copyright (c) 2012 Julien Grimault. All rights reserved.
//
#import "DDLog.h"
@interface FileFunctionLevelFormatter : NSObject <DDLogFormatter>
//
// NSObject+setValuesForKeysWithJSONDictionary.h
// SafeSetDemo
//
// Created by Tom Harrington on 12/29/11.
// Copyright (c) 2011 Atomic Bird, LLC. All rights reserved.
//
// Modified by Julien Grimault
//
@juliengrimault
juliengrimault / gist:2300032
Created April 4, 2012 09:45
App version number and build
NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString* versionNumber = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
NSString* buildNumber = [infoDictionary objectForKey:(NSString*)kCFBundleVersionKey];
NSString* title = [NSString stringWithFormat:@"v%@(%@)",versionNumber,buildNumber];
@juliengrimault
juliengrimault / gist:2485230
Created April 25, 2012 01:25
Dynamic Pager Lion
#deactivate dynamic pager
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
#activate dynamic pager
sudo launchctl load -wF /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
@juliengrimault
juliengrimault / gist:2692793
Created May 14, 2012 08:48
Retain cycle in MKNetworkOperation completion handler
@interface Engine
+ (id)sharedEngine;
- (MKNetworkOperation*)someOperation:(CompletionBlock)block onError:(ErrorBlock)errorBlock;
@end
@interface MyViewController : UITableViewController
@property (nonatomic, strong) MKNetworkOperation* operation;
@end
#!/bin/bash
_base_dir="${1:-.}"
echo "Building assets bundle in $_base_dir"
_dirContentBundle="$_base_dir/*.bundle"
for f in $_dirContentBundle;
do
echo "removing old bundle $f"
rm -rf "$f"
@juliengrimault
juliengrimault / gist:4953436
Created February 14, 2013 15:11
I am trying to build a subclass of an AFHttpClient that uses ReactiveCocoa to access a paginated/cursored API endpoint. I want to create a signal that will fetch each page in turn and feed the received ids to its subscribers. this is my current implementation, I was wondering if this is the right way to do such thing or is there a more 'Reactive…
- (RACSignal*)friendsId
{
RACReplaySubject* subject = [RACReplaySubject subject];
[self enqueueWithSubject:subject cursor:-1];
return subject;
}
- (void)enqueueWithSubject:(RACSubject*)subject cursor:(NSInteger)cursor
{
RACSignal* json = [self friendsIdAtCursor:cursor];
@juliengrimault
juliengrimault / CrashlyticsLogger.h
Created March 30, 2013 10:39
CocoaLumberjack logger that works with crashlytics
//
// CrashlyticsLogger.h
//
// Created by Julien Grimault on 4/1/13.
//
//
#import "DDLog.h"
@interface CrashlyticsLogger : DDAbstractLogger