Skip to content

Instantly share code, notes, and snippets.

ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@cmkilger
cmkilger / Clusterer.swift
Created October 18, 2017 23:01
OPTICS algorithm in Swift
import Foundation
public protocol Distanceable {
associatedtype Distance: Comparable
func distance(_ other: Self) -> Distance
}
public class Clusterer {
private class Point<ValueType: Distanceable> {
let value: ValueType
@xsleonard
xsleonard / UUID+Extensions.swift
Created August 26, 2020 06:51
Swift: Convert UUID to and from Data and Int64
extension UUID {
// UUID is 128-bit, we need two 64-bit values to represent it
var integers: (Int64, Int64) {
var a: UInt64 = 0
a |= UInt64(self.uuid.0)
a |= UInt64(self.uuid.1) << 8
a |= UInt64(self.uuid.2) << (8 * 2)
a |= UInt64(self.uuid.3) << (8 * 3)
a |= UInt64(self.uuid.4) << (8 * 4)
a |= UInt64(self.uuid.5) << (8 * 5)