Skip to content

Instantly share code, notes, and snippets.

View mikeabdullah's full-sized avatar

Mike Abdullah mikeabdullah

View GitHub Profile
@nevyn
nevyn / README.md
Created January 4, 2011 08:37
SPMediaKeyTap is a global event tap for the play/pause, prev and next keys on the keyboard. http://overooped.com/post/2593597587/mediakeys
@prendio2
prendio2 / SUPTableViewController.m
Created March 26, 2014 15:05
Custom viewWillApear to restore selected row when transition is cancelled
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow];
if (selectedRowIndexPath) {
[self.tableView deselectRowAtIndexPath:selectedRowIndexPath animated:YES];
[[self transitionCoordinator] notifyWhenInteractionEndsUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if ([context isCancelled]) {
[self.tableView selectRowAtIndexPath:selectedRowIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
@richardbuckle
richardbuckle / shut down core data.m
Created September 23, 2011 22:29
Shut down a Core Data store prior to deleting the underlying file
- (void)closeDown {
NSArray *stores = [self.persistentStoreCoordinator persistentStores];
for (NSPersistentStore *store in stores) {
DebugLogging(@"Closing Core Data store at %@", [store URL]);
NSError *error = nil;
if (![self.persistentStoreCoordinator removePersistentStore:store error:&error]) {
DebugLogging(@"Unable to close Core Data store: error %@", [error localizedDescription]);
}
}
}
@boredzo
boredzo / PRHArrayByMap.h
Last active January 4, 2016 07:19
Function to create an NSArray with the results of calling a block on every object from an existing NSArray.
extern NSArray *PRHArrayByMap(NSArray *inArray, id (^block)(id));
@beccadax
beccadax / NSWindow+BetterSheets.h
Created July 14, 2013 03:46
Better sheet APIs for 10.8. Any resemblance to Mavericks is purely coincidental.
//
// NSWindow+BetterSheets.h
// Gistapo
//
// Created by Brent Royal-Gordon on 7/12/13.
// Copyright (c) 2013 Architechies. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@mikeabdullah
mikeabdullah / KSPowerAssertion.h
Created August 4, 2012 15:13
KSPowerAssertion
//
// KSPowerAssertion.h
// Sandvox
//
// Created by Mike on 04/08/2012.
// Copyright (c) 2012 Karelia Software. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <IOKit/pwr_mgt/IOPMLib.h>