Skip to content

Instantly share code, notes, and snippets.

View AmauryVela's full-sized avatar
🏠
Working from home

Amaury Vela AmauryVela

🏠
Working from home
View GitHub Profile
@NachoSoto
NachoSoto / UIAccessibilityTraits+Extensions.swift
Last active March 19, 2019 23:10
Extensions to simplify usage of accessibilityTraits in Swift 4.2:
// Extensions to simplify usage of accessibilityTraits in Swift 4.2:
public func |= (traits: inout UIAccessibilityTraits, other: [UIAccessibilityTraits]) {
for o in other {
traits |= o
}
}
public func |= (traits: inout UIAccessibilityTraits, other: UIAccessibilityTraits) {
// From: https://swift.org/migration-guide-swift4.2/#known-migration-issues
@nathanfjohnson
nathanfjohnson / String+HTML.swift
Last active November 23, 2021 15:09 — forked from mwaterfall/StringExtensionHTML.swift
Decoding HTML Entities in Swift 4
// Swift 4
// Check out the history for contributions and acknowledgements.
extension String {
/// Returns a new string made by replacing all HTML character entity references with the corresponding character.
///
/// - Returns: decoded string
func decodingHTMLEntities() -> String {
var result = String()
var position = startIndex
@AnthonyBY
AnthonyBY / Kosaraju.swift
Last active April 7, 2020 17:35
Kosaraju's strongly connected components (SCC) Algorithm, Swift 4
import Foundation
class Graph {
var nodes = [Node]()
var identifiersToNodes = [Int: Node]()
func addNode(node: Node) {
identifiersToNodes[node.identifier] = node
nodes += [node]
}
@kakajika
kakajika / CancellableDelayedTask.swift
Created October 26, 2015 08:52
Cancellable delayed task in Swift.
class CancellableDelayedTask {
var cancelled = false
func run(delay: Double, task: () -> Void ) {
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(time, dispatch_get_main_queue()) { [unowned self] () -> Void in
if !self.cancelled {
task()
}
}
}
@alanzeino
alanzeino / lldb-debugging.md
Last active March 5, 2026 20:59
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.