Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am Danappelxx on github.
  • I am danappelxx (https://keybase.io/danappelxx) on keybase.
  • I have a public key whose fingerprint is 8DA1 4F99 0EE2 4BD3 9C27 59F0 2598 696E 0ECA 691A

To claim this, I am signing this object:

module CLibbson [system] {
header "/usr/local/include/libbson-1.0/bson.h"
link "bson-1.0"
export *
}
class EventListener<T> {
typealias Listener = T -> ()
let listener: Listener
var calls: Int
init(calls: Int, listener: Listener) {
self.calls = calls
self.listener = listener
}
//
// GameViewController.swift
// WordMatch
//
// Created by Dan Appel on 12/17/15.
// Copyright (c) 2015 Dan Appel. All rights reserved.
//
import UIKit
import QuartzCore
enum ReturnType<T> {
case Normal(T)
case Early(T)
}
extension SequenceType {
func rreduce<T>(initial: T, combine: (T, Self.Generator.Element) -> ReturnType<T>) -> T {
var result = initial
for el in self {
switch combine(result, el) {
struct Task<Input, Output> {
typealias TaskExecutor = Input -> Output
let task: TaskExecutor?
var subTasks = [Task<Any,Any>]()
init(task: TaskExecutor? = nil) {
self.task = task
}
struct Request {}
struct Response {}
enum MiddlewareBeforeResult {
case Next(Request)
case Respond(Response)
}
typealias MiddlewareBefore = Request -> MiddlewareBeforeResult
typealias MiddlewareAfter = (Request, Response) -> Response
// Add <https://github.com/samhann/Every.swift/blob/master/NSDateComponentsExtensions.swift> here
import Foundation
import XCPlayground
struct Every {
class Executor: NSObject {
let closure: NSTimer -> Void
var timer: NSTimer!
init(closure: NSTimer -> Void) { self.closure = closure }
struct RouteStorage {
var componentsTrie = Trie<Character, Int>()
var routesTrie = Trie<Int, Route>()
var nextComponentId = 1
init(routes: [Route]) {
for route in routes {
postfix operator +++ {}
postfix func +++(inout x: Int) -> Int {
let y = x
x += 1
return y
}
var i = 0 // -> 0
i+++ // -> 0