Skip to content

Instantly share code, notes, and snippets.

Avatar

Keith Bauer OneSadCookie

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am onesadcookie on github.
  • I am onesadcookie (https://keybase.io/onesadcookie) on keybase.
  • I have a public key ASBQklqH9TTCtV8ht0YGzxtp_m4vsT9p0A01sR6FqpBbRAo

To claim this, I am signing this object:

View SerializableToUserDefaults.swift
import Foundation
protocol SerializableToUserDefaults {
static func read(from defaults: UserDefaults, key: String) -> Self
func write(to defaults: UserDefaults, key: String)
}
extension String: SerializableToUserDefaults {
static func read(from defaults: UserDefaults, key: String) -> String {
return defaults.string(forKey: key)!
View associated type.swift
import CoreMedia
protocol PixelContainer { }
protocol Source {
typealias PixelContainerType: PixelContainer
func frameAtTime(time: CMTime) -> PixelContainerType?
View addingisSameAstotheprotocol.swift
protocol Output {
func isSameAs(o: Output) -> Bool
}
extension Output where Self: Equatable {
func isSameAs(o: Output) -> Bool {
guard let o = o as? Self else { return false }
View remove_element.swift
extension Array where Element: Equatable {
mutating func remove(e: Element) {
for (i, f) in self.enumerate() {
if e == f {
self.removeAtIndex(i)
}
}
}
View errorWrap.swift
enum TheirError: ErrorType {
case Something
}
enum MyError: ErrorType {
case CouldNot(TheirError)
View merge extension
let odds = [ "a": 1, "c": 3, "e": 5 ]
let evens = [ "b": 2, "d": 4, "f": 6 ]
extension Dictionary {
func mergeWith(other: [Key: Value]) -> [Key: Value] {
var result = self
for (k, v) in other {
result[k] = v
}
View zorg.swift
func computeValue() -> Int {
return 3
}
let x: Int = {
switch computeValue() {
case 0:
return 1
case let value:
return value
View errors.txt
Deck.swift:27:16: error: cannot invoke initializer for type 'Card' with an argument list of type '(suit: Suit, rank: Rank, back: Back, facing: Facing)'
return Card(
^
Deck.swift:27:20: note: expected an argument list of type '(suit: Suit, rank: Rank, back: Back, facing: Facing)'
return Card(
^
View runIOThread.s
__ZN13CVDisplayLink11runIOThreadEv:
00002450 pushl %ebp
00002451 movl %esp, %ebp
00002453 pushl %ebx
00002454 pushl %edi
00002455 pushl %esi
00002456 subl $0x21c, %esp ## imm = 0x21C
0000245c calll 0x2461
00002461 popl %edi
00002462 movl 0x2dbbf(%edi), %eax