Skip to content

Instantly share code, notes, and snippets.

View tbartelmess's full-sized avatar
🐶
EventLoopFuture<Void>

Thomas Bartelmess tbartelmess

🐶
EventLoopFuture<Void>
View GitHub Profile
@tbartelmess
tbartelmess / Collection-to-Dict.swift
Last active April 9, 2017 18:51
An extension to the Collection Type to create a dictionary using a transform closure.
extension Collection {
// Create a Dictionary from a collection using a transformer.
// The transformer function takes an element from the collection and returns a tuple
// with the key/value pair.
func dictionary<K, V>(transform:(_ element: Iterator.Element) -> (K, V)) -> [K : V] {
var dictionary = [K : V]()
self.forEach { element in
let (key, value) = transform(element)
dictionary[key] = value
}
### Keybase proof
I hereby claim:
* I am tbartelmess on github.
* I am tbartelmess (https://keybase.io/tbartelmess) on keybase.
* I have a public key ASAWYT6XzOADXiBDZvMQL5OIqd_-k96oLrtrXMyp5NmBMAo
To claim this, I am signing this object:
@tbartelmess
tbartelmess / Attach to Xcode.scpt
Last active January 2, 2021 21:56
Apple Script to Attach Xcode to a Process
--- Usage: osascript [PATH TO SCRIPT] pid
on run argv
tell application "System Events"
tell process "Xcode"
set frontmost to true
click menu item "Attach to Process by PID or Name…" of menu "Debug" of menu bar 1
click first text field of sheet 1 of window 1
keystroke item 1 of argv
click button "Attach" of sheet 1 of window 1
end tell