Skip to content

Instantly share code, notes, and snippets.

View zwaldowski's full-sized avatar

Zachary Waldowski zwaldowski

View GitHub Profile
let view = ...
for case let label as UILabel in view.subviews {
...
}
gem install nokogiri -- --use-system-libraries --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2

Security Enhancements

Improvements in security make both network and local activities safer.

System Integrity Protection

A new security policy that applies to every running process, including privileged code and code that runs out of the sandbox. The policy extends additional protections to components on disk and at run-time, only allowing system binaries to be modified by the system installer and software updates. Code injection and runtime attachments are no longer permitted.

import Foundation
public func <(lhs: NSDate, rhs: NSDate) -> Bool {
return lhs.compare(rhs) == .OrderedAscending
}
public func ==(lhs: NSDate, rhs: NSDate) -> Bool {
return lhs === rhs || lhs.compare(rhs) == .OrderedSame
}
import Foundation
extension NSCopying {
func copied() -> Self {
let copied = copyWithZone(nil)
assert(copied is Self, "Invalid downcast while copying instance of \(Self.self), did you mean to use 'as?'")
return unsafeDowncast(copied)
}
//
// DynamicTypeLabel.swift
// ToyApp
//
// Created by Zachary Waldowski on 11/27/14.
// Copyright (c) 2014 Zachary Waldowski. All rights reserved.
//
import UIKit
import QuartzCore
private func demunge(@noescape fn: CGPath.Element -> Void)(ptr: UnsafePointer<CGPathElement>) {
let points = ptr.memory.points
switch ptr.memory.type {
case kCGPathElementMoveToPoint:
fn(.Move(to: points[0]))
case kCGPathElementAddLineToPoint:
fn(.Line(to: points[0]))
case kCGPathElementAddQuadCurveToPoint:
import CoreGraphics
public protocol Tweenable {
typealias ScalarMultiplierType: FloatingPointType
func +(lhs: Self, rhs: Self) -> Self
func *(lhs: Self, rhs: ScalarMultiplierType) -> Self
func *(lhs: Self, rhs: ScalarMultiplierType.Stride) -> Self
@zwaldowski
zwaldowski / HighlightedView.swift
Created April 19, 2015 23:25
HighlightedView.swift
//
// HighlightedView.swift
// <#REDACATED#>
//
// Created by Zachary Waldowski on 4/17/15.
// Copyright (c) 2015 Big Nerd Ranch. All rights reserved.
//
import UIKit
import Attendant
//
// UIStoryboardPopoverSegue+DZUtilities.h
// PopoverMagic
//
// Created by Zachary Waldowski on 12/27/11.
// Copyright (c) 2011 Dizzy Technology. All rights reserved.
//
#import <UIKit/UIKit.h>