This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Created by: Westley K | |
# Date: Aug 14, 2018 | |
# | |
# run this in your terminal, and | |
# you will get nice colors and effects! | |
# | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Date { | |
func add(_ component: Calendar.Component, value: Int) -> Date { | |
return Calendar.current.date(byAdding: component, value: value, to: self)! | |
} | |
} | |
@propertyWrapper | |
struct BeginEndDate { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
final class InfiniteLoopView<T, Cell>: UIView, | |
UICollectionViewDelegate, | |
UICollectionViewDataSource, | |
UICollectionViewDelegateFlowLayout | |
where Cell: UICollectionViewCell { | |
private lazy var collectionView: UICollectionView = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.1' | |
services: | |
wordpress: | |
image: wordpress | |
restart: always | |
ports: | |
- 80:80 | |
environment: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Double { | |
/// 無條件進位至小數 | |
/// - Parameter decimal: 第幾位 | |
func ceiling(toDecimal decimal: Int) -> Double { | |
let numberOfDigits = abs(pow(10.0, Double(decimal))) | |
if self.sign == .minus { | |
return Double(Int(self * numberOfDigits)) / numberOfDigits | |
} else { | |
return Double(ceil(self * numberOfDigits)) / numberOfDigits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"citys": [ | |
{"name": "基隆市", "area": [ { "name": "仁愛區", "code": "200"}, { "name": "信義區", "code": "201"}, { "name": "中正區", "code": "202"}, { "name": "中山區", "code": "203"}, { "name": "安樂區", "code": "204"}, { "name": "暖暖區", "code": "205"}, { "name": "七堵區", "code": "206"} ] }, | |
{"name": "台北市", "area": [ { "name": "中正區", "code": "100" }, { "name": "大同區", "code": "103" }, { "name": "中山區", "code": "104" }, { "name": "松山區", "code": "105" }, { "name": "大安區", "code": "106" }, { "name": "萬華區", "code": "108" }, { "name": "信義區", "code": "110" }, { "name": "士林區", "code": "111" }, { "name": "北投區", "code": "112" }, { "name": "內湖區", "code": "114" }, { "name": "南港區", "code": "115" }, { "name": "文山區", "code": "116" } ] }, | |
{"name": "新北市", "area": [ { "name": "萬里區", "code": "207" }, { "name": "金山區", "code": "208" }, { "name": "板橋區", "code": "220" }, { "name": "汐止區", "code": "221" }, { "name": "深坑區", "code": "222" }, { "name": "石碇區", "code": "223" }, { "name": "瑞芳區", "code": "224" }, { "name": "平溪區", "co |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Alamofire | |
struct HTTPHeader { | |
enum Field: String { | |
case contentType = "Content-Type" | |
case acceptType = "Accept" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc func buttonPressed() { | |
let vc = PresentSecondViewController() | |
animation.destinationPoint = button.center | |
vc.transitioningDelegate = animation | |
vc.modalPresentationStyle = .custom | |
animation.interaction.wireGesture(on: vc) | |
present(vc, animated: true, completion: nil) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UpToDownIneraction: UIPercentDrivenInteractiveTransition { | |
// ... | |
@objc func handleGesture(_ gestureRecoginizer: UIPanGestureRecognizer) { | |
let gestureView = gestureRecoginizer.view! | |
let trainsiton = gestureRecoginizer.translation(in: gestureView) | |
switch gestureRecoginizer.state { | |
case .began: | |
print("began") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UpToDownIneraction: UIPercentDrivenInteractiveTransition { | |
// ... | |
func wireGesture(on viewController: UIViewController) { | |
presentingViewController = viewController | |
let gesture = UIPanGestureRecognizer(target: self, action: #selector(handleGesture(_:))) | |
viewController.view.addGestureRecognizer(gesture) | |
} | |
NewerOlder