Skip to content

Instantly share code, notes, and snippets.

View dcilia's full-sized avatar

Dave Cilia dcilia

View GitHub Profile
@dcilia
dcilia / generic constraints
Created June 18, 2018 14:24
Generic Constraints Swift 4.2
import Cocoa
protocol OperationType {}
protocol ObserverType {
func did<T>(start operation : T) -> Void
}
extension ObserverType {

Keybase proof

I hereby claim:

  • I am dcilia on github.
  • I am silverfox (https://keybase.io/silverfox) on keybase.
  • I have a public key whose fingerprint is D45C 24BA 9037 A13A 593E 15B1 BF94 C77C 6713 6353

To claim this, I am signing this object:

@dcilia
dcilia / pushTokenToHex.swift
Last active November 3, 2017 19:11
Convert Push Tokens to Hex String
let keyString = "a8142f3b 2ec20c27 6e3ed04c c5808202 913a6d69 1a1ffb55 5545d84f e4de17d7"
if let deviceToken = Data(base64Encoded: keyString) {
let token = deviceToken.map { String(format: "%02.2hhx", $0 as CVarArg) }.joined()
print(token)
}