View building-funnels-with-google-bigquery.sql
#standardSQL
WITH events AS (
SELECT "A" AS user, 100 AS time, "view" AS event
UNION ALL SELECT "B", 200, "click"
UNION ALL SELECT "B", 300, "view"
UNION ALL SELECT "A", 400, "click"
UNION ALL SELECT "A", 500, "click"
UNION ALL SELECT "A", 600, "buy"
),
View swift4.1-openurl-workaround.diff
- func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool
+ func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any?) -> Bool
View ReactorTests.swift
func testBookmark() {
// 1. 리액터를 준비합니다.
let reactor = MyReactor()
// 2. 리액터에 액션을 전달합니다.
reactor.action.onNext(.toggleBookmarked)
// 3. 리액터의 상태가 변경되는지를 검증합니다.
XCTAssertEqual(reactor.currentState.isBookmarked, true)
}
View ViewTests.swift
func testAction_refresh() {
// 1. Stub 리액터를 준비합니다.
let reactor = MyReactor()
reactor.stub.isEnabled = true
// 2. Stub된 리액터를 주입한 뷰를 준비합니다.
let view = MyView()
view.reactor = reactor
// 3. 사용자 인터랙션을 발생시킵니다.
View UserViewReactorMutateReduce.swift
func mutate(action: Action) -> Observable<Mutation> {
switch action {
case .follow:
return UserService.follow()
.map { Mutation.setFollowing(true) }
.catchErrorJustReturn(Mutation.setFollowing(false))
case .unfollow:
return UserService.unfollow()
.map { Mutation.setFollowing(false) }
View UserViewReactor.swift
import ReactorKit
import RxSwift
final class UserViewReactor: Reactor {
enum Action {
case follow
}
enum Mutation {
case setFollowing(Bool)
View UserViewControllerBind.swift
func bind(reactor: UserViewReactor) {
// Action
self.followButton.rx.tap
.map { Reactor.Action.follow }
.bind(to: reactor.action)
.disposed(by: self.disposeBag)
// State
reactor.state.map { $0.isFollowing }
.distinctUntilChanged()
View UserViewController.swift
import ReactorKit
import RxSwift
class UserViewController: UIViewController, View {
var disposeBag = DisposeBag()
func bind(reactor: UserViewReactor) {
}
}
View filter-codecov-filename.js
$('#tree tbody tr').each((i, tr) => {
const filename = $(tr).find('td:first a').text();
if (!filename.includes('Reactor.swift')) {
$(tr).remove();
}
});
View Central.swift
func centralManager(central: CBCentralManager,
didDiscoverPeripheral peripheral: CBPeripheral,
advertisementData: [String : AnyObject],
RSSI: NSNumber) {
guard let packet = advertisementData[CBAdvertisementDataLocalNameKey] as? String else {
return
}
let version = Int(packet[packet.startIndex..<packet.startIndex.advancedBy(2)])
let channel = Int(packet[packet.startIndex.advancedBy(2)..<packet.startIndex.advancedBy(4)])
let cardRawValue = Int(packet[packet.startIndex.advancedBy(4)..<packet.startIndex.advancedBy(6)], radix: 16)