Skip to content

Instantly share code, notes, and snippets.

View tgaul's full-sized avatar

Troy Gaul tgaul

View GitHub Profile
From 94e6ad1869622652b9752e410f3dc24a02bca0f0 Mon Sep 17 00:00:00 2001
From: Troy Gaul <[email protected]>
Date: Wed, 26 Oct 2016 16:37:43 -0500
Subject: [PATCH] Changes to get compiling with Xcode 8.1.
---
Photo Editor/CanvasViewController.swift | 2 +-
Photo Editor/PhotoController.swift | 2 +-
Photo Editor/PhotoDocumentWindowController.swift | 4 ++--
Photo Editor/SidebarViewController.swift | 8 ++++----
// Source for the Accidental Tech Podcast (ATP) T-Shirt:
// http://www.marco.org/2014/04/29/atp-shirts
//
// By Troy Gaul, June 2, 2014.
//
// Based on Obj-C veresion by Marco Arment, April 28, 2014. MIT license.
// https://gist.github.com/marcoarment/2542cd28cb5df0aa97d8
import UIKit
@tgaul
tgaul / gist:9156499
Last active August 29, 2015 13:56 — forked from kyleve/gist:8213806
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.
NSFetchRequest* fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Widget"];
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"type == %@", someType];
fetchRequest.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"createddate" ascending:YES]];
fetchRequest.fetchLimit = 5;
NSError* error;
NSArray* widgets = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
@tgaul
tgaul / InfDebugLog.h
Created June 14, 2011 19:07
InfDebugLog
#ifndef NDEBUG
#define InfDebugLog( ... ) NSLog( __VA_ARGS__ )
#else
#define InfDebugLog( ... )
#endif
@tgaul
tgaul / gist:792829
Created January 24, 2011 04:27
Generating a 1-bit GIF with ImageIO
- (void) generate1BitGIF
{
UIImage* image = [ UIImage imageNamed: @"TestImage.png" ];
NSFileManager* fm = [ NSFileManager defaultManager ];
NSURL* destDir = [ fm URLForDirectory: NSDocumentDirectory
inDomain: NSUserDomainMask
appropriateForURL: nil
create: YES
error: nil ];