Skip to content

Instantly share code, notes, and snippets.

View MarcoSantarossa's full-sized avatar

Marco Santarossa MarcoSantarossa

View GitHub Profile
import UIKit
typealias EmptyClosure = () -> Void
final class MyEW {
let onDo: EmptyClosure
init(onDo: @escaping EmptyClosure) {
self.onDo = onDo
}
final class CacheLRU<Key: Hashable, Value> {
private struct CachePayload {
let key: Key
let value: Value
}
private let capacity: Int
private let list = DoublyLinkedList<CachePayload>()
private var nodesDict = [Key: DoublyLinkedListNode<CachePayload>]()
@MarcoSantarossa
MarcoSantarossa / AsyncOperation.swift
Last active August 2, 2023 13:23
How to write and use an asynchronous operation
import Foundation
class AsyncOperation: Operation {
enum State: String {
case isReady, isExecuting, isFinished
}
override var isAsynchronous: Bool {
return true
}
@lattner
lattner / TaskConcurrencyManifesto.md
Last active November 18, 2024 17:28
Swift Concurrency Manifesto
@shsteimer
shsteimer / gist:7257245
Created October 31, 2013 21:10
Tip to delete tags by pattern
#delete all the remote tags with the pattern your looking for, ie. DEV-
git tag | grep <pattern> | xargs -n 1 -i% git push origin :refs/tags/%
#delete all your local tags
git tag | xargs -n 1 -i% git tag -d %
#fetch the remote tags which still remain
git fetch