Skip to content

Instantly share code, notes, and snippets.

Wondering what status is for

David Waite dwaite

Wondering what status is for
View GitHub Profile
dwaite /
Last active Apr 7, 2017
[SE-NNNN] Fullfill protocol requirements explicitly with extensions and types

Fullfil protocol requirements explicitly with extensions and types


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 / gen.swift
Last active Nov 17, 2017 — forked from blainerothrock/gen.swift
A Very Simple Genetic Algorithm Written in Swift 3
View gen.swift
#!/usr/bin/env xcrun swift -O
gen.swift is a direct port of cfdrake's from Python 2.7 to Swift 3
-------------------- ---------------------
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
The parameters of the simulation can be changed by modifying one of the many
View case-inconsistencies.swift
enum Booly {
case truth
case falsehood
static let yes:Booly = truth
static let no:Booly = falsehood
static func defaulted() -> Booly {
return truth
View smart_compiler.swift
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
View modern.iuml
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 ( 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:

View e3x_logo.txt
____ ____
| |
|__ \ / __|
| / \ |
|____ ____|
View gist:1726352
# 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.
View gist:989540
#include <stdio.h>
/* prints 78.882004 */
int main(int argc, char** argv) {
float f = 78.882;
printf("%f\n", f);
return 0;