This file contains hidden or 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
extension Updateable where Self: RLMObject { | |
static func persistJSON(json: NSDictionary) { | |
let update = Self.partialUpdateDicWithJSON(json) | |
let realm = RealmPersister.realm | |
realm.beginWriteTransaction() | |
Self.createOrUpdateInRealm(realm, withValue: update) | |
try! realm.commitWriteTransaction() | |
} | |
} |
This file contains hidden or 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
// | |
// CollectionViewMagic.swift | |
// bodytonic-ios | |
// | |
// Created by Desmond McNamee on 2016-10-29. | |
// Copyright © 2016 Stadium Studio. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or 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
// | |
// KeyboardHeight.swift | |
// bodytonic-ios | |
// | |
// Created by Desmond McNamee on 2016-08-28. | |
// Copyright © 2016 Stadium Studio. All rights reserved. | |
// | |
import UIKit | |
import RxSwift |
This file contains hidden or 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
// | |
// ViewController.swift | |
// RetainCylceTests | |
// | |
// Created by Desmond McNamee on 15/09/16. | |
// Copyright © 2016 Teamplace. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or 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
// | |
// UITextView+Rx.swift | |
// bodytonic-ios | |
// | |
// Created by Desmond McNamee on 2017-02-04. | |
// Copyright © 2017 Stadium Studio. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
This file contains hidden or 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
class TestViewModel { | |
struct Inputs { | |
let tap = PublishSubject<Void>() | |
} | |
struct Outputs { | |
let someString: Observable<String?> | |
} | |
let inputs: TestViewModel.Inputs |
This file contains hidden or 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 | |
public protocol RequestConvertible { | |
var asRequest: NSMutableURLRequest { get } | |
} | |
enum NoDepsRouter: RequestConvertible { | |
case thing(id: String) | |
case postThings(id: String) |
This file contains hidden or 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
[alias] | |
co = checkout | |
br = branch | |
st = status | |
visual = log --graph --full-history --all --pretty=format:%h%x09%d%x20%s | |
branch-name = !git rev-parse --abbrev-ref HEAD | |
publish = !git push -u origin $(git branch-name) |
This file contains hidden or 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
public extension Sequence { | |
func scan<T>(_ seed: T, function:(T, Iterator.Element) -> T) -> T { | |
var current: T = seed | |
for element in self { | |
current = function(current, element) | |
} | |
return current | |
} |
This file contains hidden or 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
indirect enum LinkedListNode<T> { | |
case value(element: T, next: LinkedListNode<T>) | |
case end | |
} | |
extension LinkedListNode: Sequence { | |
func makeIterator() -> LinkedListIterator<T> { | |
return LinkedListIterator(current: self) | |
} | |
} |
OlderNewer