This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/dominictarr/pull-stream-examples/blob/master/pull.js | |
import Foundation | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
/// Pull stream events | |
enum Event<T> { | |
case next(T) | |
case error(Error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RxSwift | |
// MARK: globals | |
private var noOp: () -> Void = { _ in } | |
// MARK: Pager | |
public class Pager<T> { | |
public typealias PagingFunction = ([T]) -> Observable<[T]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { inspect } from 'util' | |
const Tree = Object.create({ | |
init(value) { | |
this.value = value | |
this.height = 0 | |
return this | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.file-header') | |
.filter(function() { | |
const path = $(this).data('path') | |
return !path.endsWith("swift") | |
}) | |
.each(function() { | |
$(this).parent().remove() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCPlayground | |
import Firebase | |
import PromiseKit | |
// MARK: FirebaseArrayDelegate | |
protocol FirebaseArrayDelegate: class { | |
func childNotFound(key: String) | |
func childAdded(snapshot: FDataSnapshot, atIndex index: Int) | |
func childChanged(snapshot: FDataSnapshot, atIndex index: Int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MARK: CircleComponent protocol | |
protocol CircleComponent { | |
var circleSize: CGFloat { get } | |
var borderColor: UIColor { get } | |
var borderWidth: CGFloat { get } | |
var hasCircleMaskLayer: Bool { get } | |
var hasRingLayer: Bool { get } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// global singleton instance | |
let tweaks = FBTweakStore.sharedInstance() | |
/** | |
* ## Usage | |
* | |
* class MyClass { | |
* struct statics { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
class <#name#>: UIViewController { | |
// MARK: static properties | |
struct statics { | |
static let someValue = 1 | |
static let someOtherValue = "foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// custom unique identifier | |
/// @see https://www.firebase.com/blog/2015-02-11-firebase-unique-identifiers.html | |
private let ASC_CHARS = Array("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz") | |
private let DESC_CHARS = ASC_CHARS.reverse() | |
private var lastPushTime: UInt64 = 0 | |
private var lastRandChars = Array<Int>(count: 12, repeatedValue: 0) | |
func generatePushID(ascending: Bool = true) -> String { | |
let PUSH_CHARS = ascending ? ASC_CHARS: DESC_CHARS | |
var timeStampChars = Array<Character>(count: 8, repeatedValue: PUSH_CHARS.first!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var autoId: Int = 1 | |
// MARK: Subscription Protocol | |
protocol Subscription { | |
func remove() | |
} | |
// MARK: AbstractSubscription<T> |