Skip to content

Instantly share code, notes, and snippets.

View klaas's full-sized avatar
🤠
Howdy!

Klaas klaas

🤠
Howdy!
View GitHub Profile
public extension MPMediaItem {
var isLocal: Bool {
return value(forProperty: "isLocal") as! Bool
}
var isTemporaryCloudDownload: Bool {
return value(forProperty: "isTemporaryCloudDownload") as! Bool
}
var isPendingSync: Bool {

Keybase proof

I hereby claim:

  • I am klaas on github.
  • I am qlaas (https://keybase.io/qlaas) on keybase.
  • I have a public key ASB-YcbrV0Nf8tlERvizDu6PhQHli_z7jt9-EwDKRK0zOwo

To claim this, I am signing this object:

@klaas
klaas / UIView+Orientation.swift
Last active January 31, 2016 21:29
View orientation
// Swift version of: https://gist.github.com/smileyborg/a5d1355773ad2ba6bb1e
public enum ViewOrientation {
case Portrait
case Landscape
}
extension UIView {
public class func viewOrientationForSize(size:CGSize) -> ViewOrientation {
return (size.width > size.height) ? .Landscape : .Portrait

Generated within the iPhone Simulator (iOS Version 8.4 (12H141))

XS S M L XL XXL XXXL Accessibility M AccessibilityL AccessibilityXL AccessibilityXXL AccessibilityXXXL
UIFontTextStyleHeadline 14.0 15.0 16.0 17.0 19.0 21.0 23.0 23.0 23.0 23.0 23.0 23.0
UIFontTextStyleSubheadline 12.0 13.0 14.0 15.0 17.0 19.0 21.0 21.0 21.0 21.0 21.0 21.0
UIFontTextStyleBody 14.0 15.0 16.0 17.0 19.0 21.0 23.0 28.0 33.0 40.0 47.0 53.0
UIFontTextStyleFootnote 12.0 12.0 12.0 13.0 15.0 17.0 19.0 19.0 19.0 19.0 19.0 19.0
UIFontTextStyleCaption1 11.0 11.0 11.0 12.0 14.0 16.0 18.0 18.0 18.0 18.0 18.0 18.0
UIFontTextStyleCaption2 11.0 11.0 11.0 11.0 13.0 15.0 17.0 17.0 17.0 17.0 17.0 17.0
@klaas
klaas / StreamReader.swift
Last active May 21, 2017 14:51
Xcode 6.1 version of source for this SO answer http://stackoverflow.com/a/24648951/292145
import Foundation
class StreamReader {
let encoding : UInt
let chunkSize : Int
var atEof : Bool = false
var fileHandle : NSFileHandle!
let buffer : NSMutableData!
@klaas
klaas / gist:3170952
Created July 24, 2012 16:14
Open a location in Little Locations and let it be displayed in the create tab
// Create location url object
NSURL *url = [NSURL URLWithString:@"littlelocations://create?lat=18.99&lon=72.95&name=Mumbai%20Inner%20Circus"];
// Test if Little Locations is installed
if([[UIApplication sharedApplication] canOpenURL:url] ) {
// Open Location in Little Locations
[[UIApplication sharedApplication] openURL:url];