Skip to content

Instantly share code, notes, and snippets.

View M0rtyMerr's full-sized avatar

Anton Nazarov M0rtyMerr

View GitHub Profile
@M0rtyMerr
M0rtyMerr / NativeKeyboardHeight_vs_RxKeyboard.swift
Last active June 2, 2019 18:13
Old plain way of getting keyboard height vs RxKeyboard framework. Rx frameworks can be found here - https://github.com/RxSwiftCommunity/RxKeyboard
// native way
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardChangedFrame),
name: UIResponder.keyboardDidChangeFrameNotification,
object: nil
)
}
@M0rtyMerr
M0rtyMerr / NativeGestureRecognizer_vs_RxGesture.swift
Last active January 20, 2019 11:09
Old plain way of handling gestures vs RxGesture framework. Rx frameworks can be found here - https://github.com/RxSwiftCommunity/RxGesture
// Native way
override func viewDidLoad() {
super.viewDidLoad()
let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(self.handlePan))
panGestureRecognizer.maximumNumberOfTouches = 3
view.addGestureRecognizer(panGestureRecognizer)
}
@objc private func handlePan(_ sender: UIPanGestureRecognizer) {
switch sender.state {
@M0rtyMerr
M0rtyMerr / UITableViewDelegate_vs_RxDataSource.swift
Last active January 23, 2019 12:47
UITableViewDelegate vs RxCocoa. Rx framework can be found here - https://github.com/RxSwiftCommunity/RxDataSources
// Native way
var sections = [["Section 1": [1, 2, 3]],
["Section 2": [4, 5, 6]]]
func numberOfSections(in tableView: UITableView) -> Int {
return sections.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return sections[section].count
@M0rtyMerr
M0rtyMerr / RxSwiftExt_errors, elements.swift
Last active January 23, 2019 13:20
RxSwiftExt fromAsync. Rx frameworks can be found here - https://github.com/RxSwiftCommunity/RxGesture
// materialized + errors, elements
let checkinEvents = checkin
.flatMapLatest { [checkinService] in
checkinService.post(checkinRequest: $0).asObservable().materialize()
}
.share()
checkinEvents
.elements()
.bind(to: showSuccessScreen)
@M0rtyMerr
M0rtyMerr / RxSwiftExt_smallFriends.swift
Last active June 2, 2019 18:24
Small useful operators from RxSwiftExt, my top-3.
//______ unwrap
Observable.from([1, 2, nil, 4])
.unwrap()
.bind { print($0) }
// Output: 1, 2, 4
//______ filterMap
Observable.of(1, 2, 3, 4, 5, 6)
.filterMap { $0 % 2 == 0 ? .map($0 * 2) : .ignore }
// Output: 4, 8, 12
@M0rtyMerr
M0rtyMerr / combine_vs_RxSwift_perfomance.swift
Last active April 22, 2024 07:48
Combine vs RxSwift perfomance
import XCTest
import Combine
import RxSwift
final class PlaygroundTests: XCTestCase {
private let input = stride(from: 0, to: 10_000_000, by: 1)
override class var defaultPerformanceMetrics: [XCTPerformanceMetric] {
return [
XCTPerformanceMetric("com.apple.XCTPerformanceMetric_TransientHeapAllocationsKilobytes"),
@M0rtyMerr
M0rtyMerr / gist:03bfed48b2cb7bdcc6f2ccdeaeaddbb7
Created April 30, 2021 11:53 — forked from Caramel-Pudding/gist:940c660314ecf6ab600bd5ce428ccf0e
Interview questions FROM candidate TO company
HR Process /
* Why is the vacancy open? Is this a new position or has someone previously held it?
* What's the main problem company is trying to solve by filling this position
* What are the recruitment steps?
* What’s the documental employment basis? How do we manage the docs?
* How do we handle payments? Do I send invoices?
Process /
* What are the day-to-day processes?
* How do you plan new tasks? How do you estimate them? What about deadlines management?