I hereby claim:
- I am ts95 on github.
- I am tonisucic (https://keybase.io/tonisucic) on keybase.
- I have a public key ASCGFglVtkxTyx1EAXY733WiiJFdpaZ9yOOloqybTnHorAo
To claim this, I am signing this object:
import SwiftUI | |
import MapKit | |
extension Map { | |
init<Items>( | |
coordinateRegion: Binding<MKCoordinateRegion>, | |
interactionModes: MapInteractionModes = .all, | |
showsUserLocation: Bool = false, | |
userTrackingMode: Binding<MapUserTrackingMode>? = nil, |
#!/bin/bash | |
# Parameters | |
source="$(pwd)/" # Track folder source where diffs are checked | |
project_root=${0%/*} # Track project root folder | |
swiftlint_path='swiftlint' # Track SwiftLint path | |
changed_files () { | |
sort -u \ | |
<(git diff --name-only --diff-filter=d --cached) \ |
import Foundation | |
import CoreLocation | |
// based on https://gis.stackexchange.com/a/18740 | |
extension CLLocationCoordinate2D { | |
var cartesian: CartesianCoordinate3D { .init(from: self) } | |
// Returns the coordinates of the midpoint between point a and b. | |
// Limitation: point a and b may not be diametrically opposite. |
I hereby claim:
To claim this, I am signing this object:
import Foundation | |
protocol AppendOnlyDatabaseProtocol { | |
var count: Int { get } | |
mutating func append(_ other: Data) | |
subscript(index: Data.Index) -> UInt8 { get } | |
subscript(bounds: Range<Data.Index>) -> Data { get } | |
} |
import Foundation | |
@propertyWrapper | |
struct Injected<T> { | |
private let keyPath: WritableKeyPath<InjectedValues, T> | |
var wrappedValue: T { | |
get { InjectedValues[keyPath] } | |
set { InjectedValues[keyPath] = newValue } | |
} |
import Foundation | |
class AutoId { | |
private init() {} | |
static func newId() -> String { | |
// Alphanumeric characters | |
let chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" | |
// The largest byte value that is a multiple of `char.length`. | |
let maxMultiple = Int(256 / chars.count) * chars.count |
import Foundation | |
extension Result: Codable where Success: Codable, Failure: Codable { | |
public init(from decoder: Decoder) throws { | |
let container = try decoder.container(keyedBy: CodingKeys.self) | |
switch try container.decode(ResultType.self, forKey: .type) { | |
case .success: | |
self = .success(try container.decode(Success.self, forKey: .value)) | |
case .failure: |
import OrderedCollections | |
protocol HasCacheCost { | |
var cacheCost: Int { get } | |
} | |
extension HasCacheCost { | |
var cacheCost: Int { | |
type(of: self) == AnyObject.self ? 0 : MemoryLayout.size(ofValue: self) | |
} |
This document outlines the Bluetooth Low Energy (BLE) protocol for communicating with Wilfa Svart Uni Scale devices, specifically the Gen 1 and Gen 2 models, the former being the model powered by AA batteries, and the latter being rechargeable with a USB-C cable. The implementation is reverse-engineered from official firmware behavior and the Android application.
The Wilfa Svart scale exposes BLE services and characteristics for: