Skip to content

Instantly share code, notes, and snippets.

View Lavmint's full-sized avatar
💭
Casually looking for a job :)

Alěkśéj Avěrkin Lavmint

💭
Casually looking for a job :)
  • Samara, Russia
View GitHub Profile
@Lavmint
Lavmint / Marque.swift
Created March 31, 2021 12:32
Marque horizontal view
import Foundation
import SwiftUI
extension View {
func marque() -> some View {
modifier(HorizontalMarqueModifier())
}
}
@Lavmint
Lavmint / CountryEmojiResolver.swift
Last active February 3, 2024 06:24
Country emoji resolver for ISO-639-1 languages (AI generated)
import Foundation
protocol CountryEmojiResolver {
func emoji(for country: String) -> String
}
class StandartCoutryEmojiResolver: CountryEmojiResolver {
func emoji(for country: String) -> String {
let languageToFlag: [String: String] = [
@Lavmint
Lavmint / ObjectMerger.swift
Created March 1, 2024 05:37
Merge NSObjects
protocol ObjectMerger {
func merge<T>(_ source: T, into dest: T, overwrites: Bool)
}
struct StandartObjectMerger: ObjectMerger {
func merge<T>(_ source: T, into dest: T, overwrites: Bool) {
guard let src = source as? NSObject else {
return
protocol LempelZivMarkovUnarchiver {
func unarchive(url: URL) throws -> URL
}
class StandartLZMUnarchiver: LempelZivMarkovUnarchiver {
func unarchive(url: URL) throws -> URL {
let algorithm: Algorithm = .lzma
let fileManager = FileManager.default