Skip to content

Instantly share code, notes, and snippets.

View toddhopkinson's full-sized avatar

Todd Hopkinson toddhopkinson

View GitHub Profile
@toddhopkinson
toddhopkinson / lldb-commands
Created October 23, 2016 04:44
LLDB Commands That Make Your Life Easier
// get an objects type
lldb: po type(of: yourObject)
// info dump on an object
lldb: po dump(youObject)
@toddhopkinson
toddhopkinson / daysPassed.swift
Last active September 16, 2016 23:17
Days past since date
let birthday = Todd.birthday // gets my birthday
let now = NSDate()
let secondsDifference = now.timeIntervalSinceDate(birthday)
let secondsPerDay = 60*60*24 // 60 seconds * 60 minutes * 24 hours
let daysSinceBirthday = secondsDifference / secondsPerDay
// UIImage+Downsample.swift
// Created by Todd Hopkinson
import UIKit
extension UIImage {
func downsample(reductionAmount: Float) -> UIImage? {
let image = UIKit.CIImage(image: self)
@toddhopkinson
toddhopkinson / CameraButton.swift
Last active August 25, 2016 22:41
Custom UIButton Drawing UIBezierPaths to CAShapeLayers and morph-animating them via CABasicAnimation
// CameraButton.swift
// Created by Todd Hopkinson Aug 2016
// UIButton approximating Apple's camera button appearance and appearance behavior
import UIKit
enum CameraButtonMode {
case VideoReady
case VideoRecording
case PhotoReady