- No adverts
- Entries should be age approprate (5-16)
- Be kind
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
{ | |
"macOS Dynamic System Colors": { | |
"Alternate selected control text color": { | |
"Use for": "The text on a selected surface in a list or table.", | |
"AppKit API": "alternateSelectedControlTextColor" | |
}, | |
"Alternating content background colors": { | |
"Use for": "The backgrounds of alternating rows or columns in a list, table, or collection view.", | |
"AppKit API": "alternatingContentBackgroundColors" | |
}, |
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
// | |
// SemanticVersioning.swift | |
// | |
// | |
// Created by Richard Stelling on 28/05/2020. | |
// | |
// The MIT License (MIT) | |
// | |
// Copyright (c) 2016-17 Richard Stelling (http://twitter.com/rjstelling) |
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 | |
// Typesafe UTI, system APIs are all stringly typed 🙄 | |
public struct UTI: CustomDebugStringConvertible, CustomStringConvertible { | |
public enum Error: Swift.Error { | |
case invalidCharachters | |
} | |
private let rawUTI: 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 | |
@propertyWrapper | |
public struct RegularExpressionValidation { | |
private var _verifiedString: String? | |
private let _regexPattern: String | |
private lazy var _regex: NSRegularExpression? = try? NSRegularExpression(pattern: _regexPattern, options: [.caseInsensitive]) | |
public init(_ regexString: 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
func print<T: FixedWidthInteger>(asBinary val: T) { | |
let bitCount = MemoryLayout<T>.size * 8 | |
let binaryStr = String(val, radix: 2) | |
let zeroPadding = String(repeating: "0", count: bitCount - binaryStr.count) | |
print("0b\(zeroPadding)\(binaryStr)") | |
} |
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 enum StringSearchError: Swift.Error { | |
case didNotFind(Character) | |
} | |
extension String { | |
static let ReducedDigits = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789" | |
static let DefaultBase36 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" |
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 | |
extension Data { | |
public var fnv32Hash: UInt32 { | |
return UInt32( self.reduce(0x811c9dc5) { 0x00000000FFFFFFFF & ($0 * 16777619) ^ UInt64($1) } ) | |
} | |
public func fnv32HashString() -> String { | |
return String(format: "%08x", self.fnv32Hash) |
NewerOlder