Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

class ViewController: UIViewController {
@IBOutlet weak var countingLabel: UILabel!
private var timer: NSTimer?
private var startTimeStamp: Int = 0
private var startCountingValue: Int = 0
override func viewDidLoad() {
super.viewDidLoad()
}
import UIKit
class CountingLabel: UILabel {
enum CountingMode: Int {
case Decrease = -1
case Increase = 1
}
var countingMode: CountingMode = .Decrease
var isCounting: Bool = false
@Calvin-Huang
Calvin-Huang / CHProgressSuit-CircularProgress.swift
Last active September 5, 2016 02:09
Sample for explain how to use Cubic Bezier to start a new animation from past animations progression. - https://github.com/Calvin-Huang/CHProgressSuit/blob/master/CHProgressSuit/CircularProgress.swift
//
// CircularProgress.swift
// CHProgressSuit
//
// Created by Calvin on 6/26/16.
// Copyright © 2016 CapsLock. All rights reserved.
//
import UIKit
import CHCubicBezier
import UIKit
import CHCubicBezier
class CountingLabel: UILabel {
var duration: Float = 0
var easingControlPoints: (x1: Double, y1: Double, x2: Double, y2: Double)? {
didSet {
cubicBezier = CubicBezier(controlPoints: easingControlPoints!)
}
}
import UIKit
import CHCubicBezier
class CountingLabel: UILabel {
var duration: Float = 0
var easingControlPoints: (x1: Double, y1: Double, x2: Double, y2: Double)? {
didSet {
cubicBezier = CubicBezier(controlPoints: easingControlPoints!)
}
}
func test_changeContentView() {
let xctExpectation = expectation(description: "Wait for carousel auto slide.")
let carouselView = self.app.scrollViews.element
let alertView = self.app.alerts.element
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 4.5) { [unowned self] in
carouselView.tap()
XCTAssertTrue(alertView.staticTexts["You selected page: 1 in carousel."].exists, "CarouselView should auto slides to second .")
@Calvin-Huang
Calvin-Huang / ViewController.swift
Created October 19, 2016 10:04
Implement UICollectionView relatived delegate in class.
import UIKit
class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
@IBOutlet var collectionView: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
self.collectionView.dataSource = self
self.collectionView.delegate = self

About redux-saga

不論是 redux-thunk 或是 redux-saga,他們的基底都是 redux,所以就由 redux 的基礎開始看起。

接下來會以官方最簡單也最核心的 To-Do App demo 作為一步步推演、展示 redux 的核心

To-Do App in classic js implmented

在一個 To-Do App 裡面,我們可以設想到會有兩個物件在互相作動

// Model
// Verify with FB console.
app.get('/fb-subscribe', (req, res, next) => {
if (req.param('hub.mode') == 'subscribe' && req.param('hub.verify_token') == process.env.VERIFY_TOKEN) {
res.send(req.param('hub.challenge'));
} else {
res.sendStatus(400);
}
});
// Subscriber for receiving FB notification.
app.post('/fb-subscribe',
@Calvin-Huang
Calvin-Huang / AccountKit-Comparsion.md
Last active September 10, 2019 03:58
Account Kit 優缺點整理

Account Kit - Pros & Cons

Pros

  • 不需要重新實作簡訊/Email註冊流程(PhoneNumber / Email 可擇一)
  • 集成 iOS/Android/Web SDK
  • 沒有與 Facebook 帳號做綁定(實測過沒問題) 測試用 App
  • 支援國家包含中國,詳細可見 支援 SMS 國碼一覽

Cons

  • 只能拿到 PhoneNumber/Email & AccountKit ID, 所以其他會員資料需要後補