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 wtf_required_if.py
class RequiredIf(object):
"""Validates field conditionally.
Usage::
login_method = StringField('', [AnyOf(['email', 'facebook'])])
email = StringField('', [RequiredIf(login_method='email')])
password = StringField('', [RequiredIf(login_method='email')])
facebook_token = StringField('', [RequiredIf(login_method='facebook')])
"""
View kb_balance.py
# -*- coding: utf-8 -*-
from datetime import datetime
import urllib2
def kb_balance(account, password, resident, username):
"""
국민은행 계좌 잔액 빠른조회. 빠른조회 서비스에 등록이 되어있어야 사용 가능.
빠른조회 서비스: https://obank.kbstar.com/quics?page=C018920
View GitHub3.css
/*
* GitHub CSS for MacDown
* https://gist.github.com/devxoul/8df5792ce330985a633b
* http://sindresorhus.com/github-markdown-css/
*/
@font-face {
font-family: octicons-link;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYF
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 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 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 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()