I hereby claim:
- I am rhysm94 on github.
- I am rhysmorgan (https://keybase.io/rhysmorgan) on keybase.
- I have a public key ASAbl_ZFt2JzwcL9EoEBXltUczCrwMm0NZuTlDzqDDr59Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| //: HashMap data structure | |
| public struct HashMap<Key: Hashable, Value> { | |
| typealias Element = (key: Key, value: Value) | |
| var arraySize: Int | |
| var numberInserted = 0 | |
| var array: [Element?] | |
| var loadFactor: Double { | |
| return Double(numberInserted) / Double(arraySize) | |
| } |
| func daysInMonth(year: Int, month: Int) -> Int { | |
| switch (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0), month) { | |
| case (true, 2): | |
| return 29 | |
| case (false, 2): | |
| return 28 | |
| case (_, 1), (_, 3), (_, 5), (_, 7), (_, 8), (_, 10), (_, 12): | |
| return 31 | |
| default: | |
| return 30 |
| import CreateMLUI | |
| let builder = MLImageClassifierBuilder() | |
| builder.showInLiveView() |
| import requests | |
| import functools | |
| url = 'https://petition.parliament.uk/petitions/241584.json' | |
| json = requests.get(url).json() | |
| signatures = json['data']['attributes']['signatures_by_country'] | |
| get_signature_count = lambda country: country['signature_count'] | |
| get_uk = lambda x: x['name'] == 'United Kingdom' |
| import PlaygroundSupport | |
| import SwiftUI | |
| struct Pokemon { | |
| let dexNum: Int | |
| let species: String | |
| } | |
| extension Pokemon: Identifiable { | |
| var id: Int { return dexNum } |
| @dynamicMemberLookup | |
| class Observable<T> { } | |
| extension Observable { | |
| func map<Result>(_ transform: @escaping (T) -> Result) -> Observable<Result> { | |
| // Apply transform function here | |
| fatalError() | |
| } | |
| subscript<Property>(dynamicMember keyPath: KeyPath<T, Property>) -> Observable<Property> { |
| import PlaygroundSupport | |
| import SwiftUI | |
| import UIKit | |
| final class LabelledImage: UIView { | |
| let label = UILabel() | |
| let image = UIImageView() | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) |
| import Foundation | |
| class CounterSortaActor { | |
| let queue = DispatchQueue(label: "CounterQueue") | |
| private var _count = 0 | |
| var count: Int { | |
| get { | |
| queue.sync { _count } | |
| } |
| protocol Overrideable {} | |
| extension Overrideable { | |
| mutating func `override`<Input: Equatable, Output>( | |
| method: WritableKeyPath<Self, @Sendable (Input) async throws -> Output>, | |
| expectedInput: Input, | |
| returning value: Output, | |
| name: String | |
| ) { | |
| let expectation = expectation(description: name) |