Skip to content

Instantly share code, notes, and snippets.

View dwaite's full-sized avatar
💭
Wondering what status is for

David Waite dwaite

💭
Wondering what status is for
View GitHub Profile
; WebAuthn create()
PublicKeyCredentialCreationRequest = {
publicKey: {
rp: PublicKeyCredentialRpEntity,
user: PublicKeyCredentialUserEntity,
challenge: bstr,
pubKeyCredParams: [* PublicKeyCredentialParameters],
? timeout: int,
? excludeCredentials: [* PublicKeyCredentialDescriptor] .default [],
@dwaite
dwaite / se-nnnn-fulfill-protocol-requirements.md
Last active April 7, 2017 08:15
[SE-NNNN] Fullfill protocol requirements explicitly with extensions and types

Fullfil protocol requirements explicitly with extensions and types

Introduction

Types implementing protocols with optional features (either through default implementations on extensions, or optional methods on objective-C protocols) do not have a way to detect typos or upstream changes to the protocol will result in behavioral changes. This proposal attempts to rectify that in a manner similar to override on subclassed types.

@dwaite
dwaite / gen.swift
Last active November 17, 2017 14:03 — forked from blainerothrock/gen.swift
A Very Simple Genetic Algorithm Written in Swift 3
#!/usr/bin/env xcrun swift -O
/*
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3
-------------------- https://gist.github.com/cfdrake/973505 ---------------------
gen.swift implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many
enum Booly {
case truth
case falsehood
static let yes:Booly = truth
static let no:Booly = falsehood
static func defaulted() -> Booly {
return truth
}
import Foundation
public class Foo : NSObject {}
public class Bar : NSObject {}
public func ==(lhs:Bar, rhs:Bar) -> Bool {return true}
Foo() == Foo() // NSObject variant - false
Bar() == Bar() // our variant - true
skinparam backgroundColor transparent
skinparam sequence {
ArrowColor black
LifeLine {
BorderColor lightgrey
BackgroundColor transparent
BorderThickness 2
}
Participant {
BorderColor black

Keybase proof

I hereby claim:

  • I am dwaite on github.
  • I am dwaite (https://keybase.io/dwaite) on keybase.
  • I have a public key whose fingerprint is B6E6 30B2 71A7 1FF9 393E 4E6C 5E52 A11A 5979 897C

To claim this, I am signing this object:

____ ____
| |
|__ \ / __|
| / \ |
|____ ____|
#!/usr/bin/ruby
# Set two thread locals
Thread.current["foo"] = "fooval"
Thread.current["bar"] = "barval"
puts [Thread.current["foo"], Thread.current["bar"]]
# prints:
# fooval
# barval
We couldn’t find that file to show.