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 Cocoa | |
fileprivate let modifierMap = [ | |
"cmd": "⌘", | |
"command": "⌘", | |
"shift": "⇧", | |
"control": "^", | |
"ctrl": "^", | |
"opt": "⌥", | |
"option": "⌥", |
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 Cocoa | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
struct ChatMessage { | |
let id: String | |
let senderId: String | |
let message: String | |
let timestamp: Double |
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
// | |
// Obfuscator.swift | |
// | |
// Created by Dejan Atanasov on 2017-05-31. | |
// | |
import Foundation | |
class Obfuscator: AnyObject { | |
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 Cocoa | |
// what is a 'type'? | |
// it has a domain, a name | |
// it can have 'properties' | |
protocol TypeBuilder : class { | |
func setType(type: String) | |
func setTypeName(name: String) | |
func addProperty(type: String, label: 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
import Foundation | |
public struct Memcache { | |
enum Expiration { | |
case never | |
case at(Double) | |
var expired: Bool { | |
switch self { | |
case .never: return false |
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 | |
public protocol CIFilterChainable { | |
var cifilter: CIFilter? { get } | |
} | |
extension String : CIFilterChainable { | |
public var cifilter: CIFilter? { |
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
// | |
// DynamicTree.swift | |
// Mojumbo | |
// | |
// Created by Benzi on 10/12/16. | |
// | |
// Swift port of the Box2D implemention of a dynamic balancing AABB tree | |
// https://github.com/erincatto/Box2D/blob/master/Box2D/Box2D/Collision/b2DynamicTree.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
import Cocoa | |
// more of a POC | |
// not production ready | |
protocol PropertyReflectable { } | |
extension PropertyReflectable { | |
subscript(property key: String) -> Any? { | |
let mirror = Mirror(reflecting: self) |
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 | |
let xml = "<coord2 count=\"3\">" | |
+ "<markers>" | |
+ "<marker>" | |
+ "<item>marker1</item>" | |
+ "</marker>" |
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 | |
//: Copy this to one! | |
import UIKit | |
// With helpful insights from | |
// https://forums.developer.apple.com/message/15725#15725 via http://oleb.net/blog/2015/06/c-callbacks-in-swift/ | |
// This is essential the standalone basic definition of a pattern | |
// that CGCreatePattern requires |
NewerOlder