Skip to content

Instantly share code, notes, and snippets.

View aabanaag's full-sized avatar
🏠
Working from home

Alexis A. Banaag Jr. aabanaag

🏠
Working from home
View GitHub Profile
import RxCocoa
import RxSwift
import Foundation
class PrintManager {
private var printer: BRPtouchPrinter!
init(printerObj: Printer, type: PrinterConnectionType = .BLUETOOTH) {
setupPrinter(with: type, using: printerObj)
printer.setPrintInfo(printConfig())
@aabanaag
aabanaag / Table+Rx.swift
Created December 18, 2018 05:58
UITableView nearBottom scroll
import UIKit
import RxSwift
import RxCocoa
extension Reactive where Base: UITableView {
var nearBottom: Driver<Bool> {
func isNearBottomEdge(tableView: UITableView, edgeOffset: CGFloat = 20.0) -> Bool {
return tableView.contentOffset.y + tableView.frame.size.height + edgeOffset > tableView.contentSize.height
}
@aabanaag
aabanaag / EventViewController.swift
Last active August 21, 2018 15:39
Updated Event
class EventViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
bindable()
}
private func bindable() {
searchbar.rx.text
.orEmpty
@aabanaag
aabanaag / EventViewController.swift
Last active August 21, 2018 15:36
EventViewController
class EventViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
bindable()
}
private func bindable() {
searchbar.rx.text
private func bindAttendeePhoto() {
let attendeePhoto = viewModel.photo
.flatMap { image -> Observable<UIImage> in
self.printBadge()
return Observable.just(image!)
}
.observeOn(ConcurrentDispatchQueueScheduler(qos: .background))
.flatMapLatest { image -> Observable<(UIImage, Bool)> in
let eventId = self.event.id
let fileSize = image.getFilesize()
@aabanaag
aabanaag / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console