Skip to content

Instantly share code, notes, and snippets.

View 0xLeif's full-sized avatar
🇺🇦
Updating projects to Swift 6

Zach 0xLeif

🇺🇦
Updating projects to Swift 6
View GitHub Profile
{
"steels": [
{
"name": "1.2442",
"description": "1.2442 is a high-speed tool steel with good wear resistance and decent toughness. It is favored by knife makers who require a balance between edge retention and durability for fine cutting tasks.",
"toughness": 4.5,
"edgeRetention": 2.5,
"corrosionResistance": 0,
"hardness": "",
"composition": []
import c // https://github.com/0xOpenBytes/c
import o // https://github.com/0xOpenBytes/o
import Plugin // https://github.com/0xLeif/Plugin
import Foundation
class ChatService: Pluginable {
enum Constants {
enum Model {
static let davinci = "text-davinci-003"
}
// MARK: Power of Extensions
// [Swift Book](https://docs.swift.org/swift-book/LanguageGuide/Extensions.html)
// MARK: - [Extension Syntax](https://docs.swift.org/swift-book/LanguageGuide/Extensions.html#ID470)
extension Bool {
}
@0xLeif
0xLeif / Core-TCA-Example.swift
Last active December 15, 2021 02:30
An example of the basic core functionality behind Reducer and Store. (Not including pullback or higher order reducers)
// MARK: - Reducable
protocol Reducable {
associatedtype State
associatedtype Action
associatedtype Environment
associatedtype Effect
func reduce(
state: inout State,
@0xLeif
0xLeif / caselet.swift
Created September 23, 2021 00:30
case let vs case .(let)
enum Something {
case a(value: String)
case b(value: String, times: Int)
case c(value: String, times: Int, isOn: Bool)
}
let a: Something = .a(value: "A Value")
let b: Something = .b(value: "B Value", times: 27)
let c: Something = .c(value: "C Value", times: 27, isOn: false)
@0xLeif
0xLeif / Direction.swift
Created June 22, 2021 15:02
Swift Enum Directions
indirect enum Direction {
case north(Float), east(Float), south(Float), west(Float)
case go(Direction, Direction?)
}
extension Direction {
var steps: String {
switch self {
case .north(let miles):
@0xLeif
0xLeif / DogTrips.md
Created April 23, 2021 13:59
Information on traveling with a dog

Dog Trips

CHECK CAMPGROUND REGULATIONS AND GUIDELINES

Leash requirements

Most pet-friendly campgrounds still have leash requirements for the safety of all campers and their pets. Leash requirements vary from location to location, but the general rule is that the leash is no longer than six feet long for easy control. Some places may have additional restrictions, such as no retractable leashes.

WHAT TO PACK

  • Dog food and a bowl
@0xLeif
0xLeif / Protocols.swift
Last active April 1, 2021 15:15
Swift Property Requirements
/**
[Swift Protocols](https://docs.swift.org/swift-book/LanguageGuide/Protocols.html#ID269)
# Property Requirements
A protocol can require any conforming type to provide an instance property or
type property with a particular name and type. The protocol doesn’t specify
whether the property should be a stored property or a computed property it
only specifies the required property name and type. The protocol also specifies
whether each property must be gettable or gettable and settable.

Keybase proof

I hereby claim:

  • I am 0xleif on github.
  • I am l_eif (https://keybase.io/l_eif) on keybase.
  • I have a public key ASBPz7gp2Yy-j813oExnP-krPngDpUl0kRe1PTeycbsbwgo

To claim this, I am signing this object:

import SwiftUIKit
let sideLength: Float = 64
UIView(backgroundColor: .white).center {
UIView {
Image("profile_image")
.layer(masksToBounds: true)
.layer(cornerRadius: sideLength / 2)
}