Skip to content

Instantly share code, notes, and snippets.

# *.home.mydomain.name is configured as a catchall CNAME in my DNS provider to point to the Caddy box.
# That way, everything needed to add a new subdomain/service is adding it in this file and reloading Caddy.
...
project-1.home.mydomain.name {
respond "This will be provided as a static HTTP response"
}
project-2.home.mydomain.name {
# HTTP basic authentication. Static hosted content served directly by Caddy.
@levibostian
levibostian / AppCoreDataManager.swift
Last active October 6, 2023 18:02
iOS CoreData ultimate document. Stack, tutorial, errors could encounter. All my CoreData experience for what works in 1 document.
import CoreData
import Foundation
protocol CoreDataManager {
var uiContext: NSManagedObjectContext { get }
func newBackgroundContext() -> NSManagedObjectContext
func performBackgroundTaskOnUI(_ block: @escaping (NSManagedObjectContext) -> Void)
func performBackgroundTask(_ block: @escaping (NSManagedObjectContext) -> Void)
func loadStore(completionHandler: ((Error?) -> Void)?)
}
@shaps80
shaps80 / Font.swift
Last active May 21, 2024 09:52
A set of UIFont/NSFont helpers that matches the equivalent SwiftUI Font API. (Supports iOS 13+ and macOS 10.15+)
import SwiftUI
#if os(macOS)
public typealias Font = NSFont
public typealias FontDescriptor = NSFontDescriptor
#else
public typealias Font = UIFont
public typealias FontDescriptor = UIFontDescriptor
#endif