This file contains hidden or 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 notify | |
| import Darwin | |
| import Dispatch | |
| import Synchronization | |
| public actor DarwinNotifications<State> where State: RawRepresentable & Sendable, State.RawValue == UInt64 { | |
| private let name: String | |
| private var token: Token? | |
| public nonisolated let unownedExecutor: UnownedSerialExecutor | |
| private let queue: DispatchSerialQueue |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
| // swift-interface-format-version: 1.0 | |
| // swift-compiler-version: Apple Swift version 6.0 effective-5.10 (swiftlang-6.0.0.7.43 clang-1600.0.25.3) | |
| // swift-module-flags: -target arm64e-apple-ios18.1 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -library-level api -enable-experimental-feature Macros -enable-experimental-feature ExtensionMacros -enable-experimental-feature IsolatedAny2 -enable-upcoming-feature InferSendableFromCaptures -enable-bare-slash-regex -user-module-version 6.1.19.2.102 -module-name SwiftUI -package-name SwiftUI | |
| import Combine | |
| import CoreData | |
| import CoreFoundation | |
| @_exported import CoreGraphics | |
| @_exported import CoreTransferable | |
| @_exported import DeveloperToolsSupport | |
| import Foundation |
This file contains hidden or 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
| func queen(atFile file: Int, rank: Int) -> UInt64 { | |
| 0b00000001_00000001_00000001_00000001_00000001_00000001_00000001_00000001 << (file) | | |
| 0b00000000_00000000_00000000_00000000_00000000_00000000_00000000_11111111 << (rank * 8) | | |
| 0b10000000_01000000_00100000_00010000_00001000_00000100_00000010_00000001 >> ((file - rank) * 8) | | |
| 0b00000001_00000010_00000100_00001000_00010000_00100000_01000000_10000000 >> ((7 - file - rank) * 8) | |
| } | |
| func occupiedIndices(in board: UInt64) -> some Sequence<(file: Int, rank: Int)> { | |
| sequence(state: (board, 0)) { state in | |
| let offset = state.0.trailingZeroBitCount |
This file contains hidden or 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
| public enum JSONValue: Codable & Hashable & Sendable & LosslessStringConvertible { | |
| private struct ParseError: Error {} | |
| static let decoder: JSONDecoder = { | |
| let decoder = JSONDecoder() | |
| decoder.allowsJSON5 = true | |
| return decoder | |
| }() | |
| static let encoder: JSONEncoder = { |
This file contains hidden or 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 String { | |
| private static let excapesRegex: Regex = /\\(?<a>[bfnrtv0])|\\(?<x>x\H{2})|(?<u>(?:\\u\H{4})+)/ | |
| struct InvalidEscapeSequenceError: Error { | |
| let value: Substring | |
| } | |
| func unescaped() throws -> String { | |
| try self.replacing(Self.excapesRegex) { match in | |
| if let a = match.a { |
This file contains hidden or 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
| // | |
| // RDSwipeView.h | |
| // RDSwipeView | |
| // | |
| // Created by Gleb Lukianets on 31/03/16. | |
| // Copyright © 2016 Gleb Lukianets. All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> |
This file contains hidden or 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
| infix operator .=: AssignmentPrecedence | |
| func .=<T, U>(_ kp: WritableKeyPath<T, U>, _ value: U) -> (inout T) -> () { | |
| { $0[keyPath: kp] = value } | |
| } | |
| protocol Cloneable { } | |
| extension Cloneable { | |
| func clone(with modifiers: (inout Self) -> ()...) -> Self { |
This file contains hidden or 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
| #include <iostream> | |
| #include <type_traits> | |
| #include <tuple> | |
| #include <limits> | |
| #include <functional> | |
| //////////////////////////////////////////////////////////////////////////////////////////////////// | |
| //////////////////////////////////////////////////////////////////////////////////////////////////// | |
| //////////////////////////////////////////////////////////////////////////////////////////////////// |
This file contains hidden or 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
| namespace impl { | |
| template<typename T> | |
| struct FlatTypeTraits; | |
| template<typename T, size_t L> | |
| struct FlatTypeTraits<std::array<T, L>> { | |
| template<typename AccT, typename CallableT> | |
| static constexpr void acc(const std::array<T, L> &array, AccT &acc, CallableT &&callable) { | |
| for (const T &element : array) |
This file contains hidden or 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
| let numerals: [Character:Int] = ["I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000] | |
| func parse(romanNumeral numeral: String) -> Int { | |
| return numeral.compactMap { numerals[$0] }.reversed().reduce((0, 0)) { $0.1 <= $1 ? ($0.0 + $1, $1) : ($0.0 - $1, 0) }.0 | |
| } | |
| assert(parse(romanNumeral: "MMXIX") == 2019) |
NewerOlder