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
// | |
// FGOManagedObjectContextStack.h | |
// | |
// Created by Indragie Karunaratne on 2012-12-23. | |
// Copyright (c) 2012 Indragie Karunaratne. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface FGOManagedObjectContextStack : NSObject |
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
// Super simple key logger that uses a CGEventTap to log | |
// the unicode strings for each key down event | |
// Doesn't handle special keys (enter, backspace, etc.) | |
#include <stdio.h> | |
#import <Carbon/Carbon.h> | |
#import <ApplicationServices/ApplicationServices.h> | |
CGEventRef loggerCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void* context) | |
{ |
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
// | |
// SNRDiscogsEngine.h | |
// Sonora | |
// | |
// Created by Indragie Karunaratne on 11-11-18. | |
// | |
#import <Foundation/Foundation.h> | |
@interface SNRDiscogsEngine : NSObject |
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
// | |
// SNRRestorationManager.h | |
// Sonora | |
// | |
// Created by Indragie Karunaratne on 2012-08-19. | |
// | |
#import <Foundation/Foundation.h> | |
@protocol SNRRestorableState <NSObject> |
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
@interface NSImage (PrefPaneExtensions) | |
+ (NSImage*)prefPaneImageNamed:(NSString*)name; | |
@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
- (NSURL *)applicationSupportDirectory { | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); | |
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : NSTemporaryDirectory(); | |
NSString *path = [basePath stringByAppendingPathComponent:@"YourAppName"]; | |
NSFileManager *fm = [NSFileManager defaultManager]; | |
if (![fm fileExistsAtPath:path isDirectory:NULL]) { | |
[fm createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil]; | |
} | |
return [NSURL fileURLWithPath:path]; |
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
@interface NSWindow (Fade) | |
- (IBAction)fadeIn:(id)sender; | |
- (IBAction)fadeOut:(id)sender; | |
@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
@interface NSWindow (Fullscreen) | |
- (BOOL)isFullscreen; | |
@end | |
@implementation NSWindow (Fullscreen) | |
- (BOOL)isFullscreen | |
{ | |
return ([self styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask; | |
} | |
@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
@interface UIView (Autoscroll) | |
- (void)autoscroll:(UITouch*)touch; | |
@end | |
@implementation UIView (Autoscroll) | |
- (void)autoscroll:(UITouch*)touch | |
{ | |
// Pass the autoscroll messages onto the superview until it reaches a view that handles the message | |
// If you want to pass the messages through the responder chain then this category would need to be | |
// implemented on UIResponder instead of UIView and you would call [self.nextResponder autoscroll:touch] |
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
@interface AppDelegate : NSObject | |
@property (nonatomic, assign) NSInteger badgeCount; | |
@end | |
@implementation AppDelegate | |
@synthesize badgeCount; | |
// Override the badgeCount setter to update the dock tile whenever the count is set | |
- (void)setBadgeCount:(NSInteger)count | |
{ |