This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSEvent+MouseClamped.h | |
// xScope | |
// | |
// Created by Craig Hockenberry on 7/25/12. | |
// Copyright (c) 2012 The Iconfactory. All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts an RGB color value to HSL. Conversion formula | |
* adapted from http://en.wikipedia.org/wiki/HSL_color_space. | |
* Assumes r, g, and b are contained in the set [0, 255] and | |
* returns h, s, and l in the set [0, 1]. | |
* | |
* @param Number r The red color value | |
* @param Number g The green color value | |
* @param Number b The blue color value | |
* @return Array The HSL representation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSBundle { | |
class var versionNumber: String { | |
if let version = NSBundle.mainBundle().infoDictionary?["CFBundleShortVersionString"] as? String { | |
return version | |
} | |
return "N.D." | |
} | |
class var buildNumber: String { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift4 | |
let image = UIImage(named: "sample") | |
let data = image?.pngData() | |
let data = image?.jpegData(compressionQuality: 0.9) | |
let uiImage: UIImage = UIImage(data: imageData) | |
// deprecated | |
// var imageData: Data = UIImagePNGRepresentation(image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
class Mento: UIView { | |
// The thickness ratio of our mento, 1.0 being a perfect sphere. | |
let mentoThicknessScale: CGFloat = 0.60 | |
let shape: UIView = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
private protocol LockImplementation { | |
mutating func lock() | |
mutating func `try`() -> Bool | |
mutating func unlock() | |
} | |
private struct UnfairLock: LockImplementation { | |
private var unfairLock = os_unfair_lock_s() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import PlaygroundSupport | |
struct Desktop: View { | |
var body: some View { | |
ZStack { | |
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG")) | |
Color(UIColor.systemBlue) | |
macOS() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Yet Another Motion Automation | |
description: > | |
# YAMA V10 | |
Turn on lights or scenes when motion is detected. | |
Four different scenes can be defined depending on time of day. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FormDemoApp.swift | |
// FormDemo | |
// | |
// Created by Marc Prud'hommeaux | |
// | |
import SwiftUI | |
@main |
OlderNewer