Skip to content

Instantly share code, notes, and snippets.

View jnutting's full-sized avatar

Jack Nutting jnutting

View GitHub Profile
@jnutting
jnutting / Sequence+CompactMapFirst.swift
Last active January 31, 2019 14:45
A short-circuiting compactMap for Swift's Sequence, that returns up to a maximum number of non-nil items
/*
* Sequence's compactMap lets you transform one
* sequence of values into another, and strip
* out any nil results. Sometimes, all you want
* is the first non-nil result, and don't want
* to futher evaluate the transform for the
* remaining values in the original sequence.
* This lets you do that.
*/
extension Sequence {
@jnutting
jnutting / Given+Expectation.swift
Created May 5, 2022 21:57
A very small TDD DSL in Swift
class Given<T> {
var sut: T
init(_ sut: T) {
self.sut = sut
}
func the<U>(_ keyPath: WritableKeyPath<T, U>, is u: U) -> Given {
sut[keyPath: keyPath] = u
return self
//
// GivenExpectation.swift
//
// Created by JN on 2022-5-8.
//
import Foundation
import XCTest
class Given<T> {
@jnutting
jnutting / quicktalkaboutquicktalks.md
Created June 27, 2022 22:23
A Quick Talk About Quick Talks

Thank you all for coming, and welcome to today's presentation, "a quick talk about quick talks." I got the idea for this talk when I started getting feedback from some Shortcutters who told me that they're interested in doing a lighting talk at the Shortcut summit, but don't know where to begin, or what sort of topic to choose that will be interesting for listeners. Some people simply have little or no public speaking experience and want to change that. Hopefully, today's talk will help fill in some gaps for some of you Today’s talk will be recorded, and at the end of this presentation I will give you a link to the full text of this presentation for future reference.

Let me start off by saying that I'm not some sort of absolute expert when it comes to giving presentations. I'd say that I've given a few dozen different talks, at employers and clients, at local user groups and at conferences. But over the years I've watched hundreds of them. In doing so, I've noticed patterns and taken notes, and today I've