Skip to content

Instantly share code, notes, and snippets.

View ahayman's full-sized avatar

Aaron Hayman ahayman

View GitHub Profile
//
// Predicate.swift
//
// Created by Aaron Hayman on 6/29/15.
import Foundation
/**
##Predicate
@ahayman
ahayman / CGPathBevel.h
Last active October 5, 2015 15:48
Core Graphics Beveling Routine
//
// CGPathBevel.h
//
// Created by Aaron Hayman on 6/21/12.
// Copyright (c) 2012 FlexileSoft, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
void bevelPath(CGPathRef path, CGContextRef context, CGFloat bevelDepth, CGColorRef highlight, CGColorRef shadow, CGFloat lightSourceAngle, BOOL evenOddShadows, BOOL eofFill);
@ahayman
ahayman / NSMutableArray_Ext.m
Created April 20, 2012 12:29
Extensions for NSMutableArray
- (void) moveObjectAtIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex{
if (fromIndex == toIndex) return;
if (fromIndex >= self.count) return;
if (toIndex >= self.count) toIndex = self.count - 1; //toIndex too large, assume a move to end
id movingObject = [self objectAtIndex:fromIndex];
if (fromIndex < toIndex){
for (int i = fromIndex; i <= toIndex; i++){
[self replaceObjectAtIndex:i withObject:(i == toIndex) ? movingObject : [self objectAtIndex:i + 1]];
}