Skip to content

Instantly share code, notes, and snippets.

View gillygize's full-sized avatar

Matthew Gillingham gillygize

View GitHub Profile
@gillygize
gillygize / gist:1db440bbb4102b23115e14ca293fc4e5
Created November 20, 2017 06:33
manual-layout-revisited-playground
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
lazy var view1: UIView = {
let view = UIView()
view.backgroundColor = .red
return view
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
/* Transactions - Why?
- Influenced by databases (all of the operations succeed or fail together)
- Implement undo functionality
- Multithreaded
@gillygize
gillygize / gist:9cd4812d3a1cfee4be12
Created January 18, 2015 06:09
A CIFilter Subclass that overwrites each pixel with red
#import <CoreImage/CoreImage.h>
@interface RedFilter : CIFilter
@property (strong, nonatomic) CIImage *inputImage;
@end
@implementation RedFilter
- (CIColorKernel *)myKernel {
static CIColorKernel *kernel = nil;
static dispatch_once_t once;
@gillygize
gillygize / gist:9403671
Created March 7, 2014 02:04
Transform a UIView to scroll up and down with the keyboard when it is shown and hidden.
# Requires having a property on the view controller called "activeField" which
# will be centered inside remaining space.
- (void)keyboardWasShown:(NSNotification*)aNotification {
NSDictionary* info = [aNotification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGFloat kbDuration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
UIViewAnimationOptions kbAnimationCurve = [[info objectForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue];
CGRect aRect = self.view.frame;