Skip to content

Instantly share code, notes, and snippets.

View Alexander-Ignition's full-sized avatar
🤖

Alexander Ignition Alexander-Ignition

🤖
View GitHub Profile
@Alexander-Ignition
Alexander-Ignition / OSAllocatedUnfairLock.swift
Last active April 27, 2024 13:29
implementation OSAllocatedUnfairLock
import Foundation
import os.lock
public struct OSAllocatedUnfairLock<State>: @unchecked Sendable {
private let buffer: ManagedBuffer<State, os_unfair_lock_s>
public init(uncheckedState initialState: State) {
self.buffer = ManagedBuffer.create(minimumCapacity: 1, makingHeaderWith: { _ in
initialState
})
@Alexander-Ignition
Alexander-Ignition / ThreadExecutor.swift
Created April 9, 2024 08:17
Swift concurrency thread executor
import Foundation
public final class ThreadExecutor: SerialExecutor, @unchecked Sendable {
private static let threadLocalName = "ThreadExecutor"
public static var current: ThreadExecutor? {
Thread.current.threadDictionary[threadLocalName] as? ThreadExecutor
}
public static func detached(
alias huist='tuist'
@Alexander-Ignition
Alexander-Ignition / lldb-cheet-sheet.md
Last active April 20, 2023 11:47
lldb cheat sheet for iOS

lldb cheat sheet

expression

po = expression -O --

expression -lang objc -O -- = e -l objc -O --

image

@Alexander-Ignition
Alexander-Ignition / folders.sh
Created February 9, 2023 13:29
macOS folders
mkdir Developer
mkdir Sites
@Alexander-Ignition
Alexander-Ignition / UICollectionView.md
Last active February 6, 2023 11:33
What’s New in UICollectionView?
@Alexander-Ignition
Alexander-Ignition / string_length.md
Created September 30, 2022 15:06
String length

String length

https://hsivonen.fi/string-length/

language code
JavaScript "🤦🏼‍♂️".length == 7
Kotln "🤦🏼‍♂️".length == 7
Ruby "🤦🏼‍♂️".length == 5
Python len("🤦🏼‍♂️") == 5
@Alexander-Ignition
Alexander-Ignition / gcd_pefomance_anti-pattern.md
Created September 13, 2022 13:18
GCD Performance Anti-Pattern

Grand Central Dispatch Performance Anti-Pattern

WWDC18 What's New in LLVM at 16:48

Performance implications: slowdown and hangs

__block NSString *taskName = nil;
dispatch_semaphore_t sema = dispatch_semaphore_create(0); 
@Alexander-Ignition
Alexander-Ignition / TaskQueue.swift
Last active September 9, 2022 15:31
Swift Concurrent TaskQueue
public final actor TaskQueue {
private final class Condition {
private var _continuation: CheckedContinuation<Void, Never>?
func wait() async {
await withCheckedContinuation { continuation in
_continuation = continuation
}
}