Skip to content

Instantly share code, notes, and snippets.

View elmodos's full-sized avatar
🇺🇦

Modo Ltunzher elmodos

🇺🇦
View GitHub Profile
@elmodos
elmodos / SimplePromise.swift
Last active October 19, 2021 19:00
Quick promise implemention
import Foundation
public class Promise<T> {
public private(set) lazy var future: Future<T> = Future()
public init() { /**/ }
public func fulfill(_ value: T) {
future.result = .success(value)
@elmodos
elmodos / .gitconfig
Created December 17, 2021 22:05
GitHub with multiple repos and usernames on single machine
~/.gitconfig
[user]
name = Personal Name
email = personal@email.com
[includeif "gitdir:~/Projects/Company/"]
path = Projects/Company/gitconfig-company
@elmodos
elmodos / Locale+FlagEmoji.swift
Created November 6, 2022 18:06
Locale to country flag emoji
extension Locale {
var flagEmoji: String? {
let base: UInt32 = 127397
return countryCode?
.unicodeScalars
.compactMap { Unicode.Scalar(base + $0.value) }
.reduce("", { $0.appending(String($1)) } )
}
}