Skip to content

Instantly share code, notes, and snippets.

View rydermackay's full-sized avatar

Ryder Mackay rydermackay

View GitHub Profile
//
// WPRRoundedLabel.h
// Payroll
//
// Created by Ryder Mackay on 2012-08-28.
// Copyright (c) 2012 Endloop Mobile. All rights reserved.
//
#import <UIKit/UIKit.h>
@rydermackay
rydermackay / gist:4353890
Created December 21, 2012 16:37
UIImagePickerController movie crop dump
(lldb) po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]
(id) $0 = 0x1f052ee0 <UIWindow: 0x1ddbbfd0; frame = (0 0; 320 568); layer = <UIWindowLayer: 0x1ddbc0f0>>
| <UILayoutContainerView: 0x1f0dfbf0; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x1f0dfcb0>>
| | <UINavigationTransitionView: 0x1f0dff00; frame = (0 0; 320 568); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x1f0dffd0>>
| | | <UIViewControllerWrapperView: 0x1f061cf0; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x1f0d9180>>
| | | | <UIView: 0x1f0669c0; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x1f066990>>
| | | | | <PLTileContainerView: 0x1dd1b300; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x1dd1b2a0>>
| | | | | | <<PLVideoView: 0x1dd1b360; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x1dddd010>> path:/var/mobile/Media/DCIM/100APPLE/IMG_0538.MOV>
| | | | |
@rydermackay
rydermackay / RGMAppDelegate.m
Last active December 18, 2015 02:29
How to customize UILabel’s font using UIAppearance.
//
// RGMAppDelegate.m
// UILabel+Appearance
//
// Created by Ryder Mackay on 2013-06-04.
// Copyright (c) 2013 Ryder Mackay. All rights reserved.
//
#import "RGMAppDelegate.h"
#import "UILabel+Appearance.h"
@rydermackay
rydermackay / RGMKeyValueObservance.h
Created December 10, 2013 21:39
KVO in a nut. Use it, or don’t?
//
// RGMKeyValueObservance.h
// RGMKeyValueObservance
//
// Created by Ryder Mackay on 12/9/2013.
// Copyright (c) 2013 Ryder Mackay. All rights reserved.
//
#import <Foundation/Foundation.h>
@rydermackay
rydermackay / TempusFugit.playground
Last active August 29, 2015 14:06
CoreMedia could use some Swift love…
// Tempus fugit
import CoreMedia
let defaultTimeScale = Int32(kCMTimeMaxTimescale)
extension CMTime {
static var invalid: CMTime { return kCMTimeInvalid }
static var indefinite: CMTime { return kCMTimeIndefinite }
static var positiveInifinity: CMTime { return kCMTimePositiveInfinity }
@rydermackay
rydermackay / gist:7ddb1078b0d484da8bc4
Last active August 29, 2015 14:07
Wrapping the NSError ** dance
final class Box<T> {
let value: T
init(_ v: T) {
value = v
}
}
enum Result<T> {
case Success(Box<T>)
case Error(NSError)
@rydermackay
rydermackay / MinimumViableButton.m
Created February 25, 2015 23:32
UIButton that lies about its bounds
@interface MinimumViableButton : UIButton
@end
@implementation MinimumViableButton
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
BOOL result = [super pointInside:point withEvent:event];
if (!result) {
const CGFloat length = 44;
import Cocoa
private let _rfc3339Formatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"
formatter.timeZone = TimeZone(secondsFromGMT: 0)
formatter.locale = Locale(identifier: "en_US_POSIX")
return formatter
}()
// Xcode 8.3b1 (8W109m)
import Foundation
struct Box<T> {
let value: T
init(value: T) {
self.value = value
}
int -[UIViewController setValue:forKey:](int arg0, int arg1, int arg2, int arg3) {
r14 = arg1;
rbx = [arg2 retain];
r12 = [arg3 retain];
*var_38 = arg0;
*(var_38 + 0x8) = _OBJC_CLASS_$_UIViewController;
[[var_38 super] setValue:rbx forKey:r12];
[rbx release];
if (*(int32_t *)__UIApplicationLinkedOnVersion != 0x0) {
if (*(int32_t *)__UIApplicationLinkedOnVersion >= 0x90000) {