This file contains hidden or 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 PlaygroundSupport | |
| import UIKit | |
| final class LoadingIndicator: UIView { | |
| var color: UIColor = .blue | |
| private var index: Int = 0 | |
| private let lap: TimeInterval = 2 | |
| private let movingAngle: CGFloat = 5 / 6 * .pi2 | |
| private let rotationCount: Int = 6 | |
| private let minimumAngle: CGFloat = .pi2 / 24 |
This file contains hidden or 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 | |
| import PlaygroundSupport | |
| import UIKit | |
| final class TimerIndicator: UIView { | |
| deinit { | |
| displayLink?.invalidate() | |
| } |
This file contains hidden or 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
| // refers to https://qiita.com/imk2o/items/1771682e9665865851e1 | |
| import Foundation | |
| protocol UserDefaultConvertible { | |
| init?(with object: Any) | |
| func object() -> Any? | |
| } | |
| extension UserDefaultConvertible { |
This file contains hidden or 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 | |
| private extension CFStringTokenizer { | |
| var hiragana: String { string(to: kCFStringTransformLatinHiragana) } | |
| var katakana: String { string(to: kCFStringTransformLatinKatakana) } | |
| private func string(to transform: CFString) -> String { | |
| var output: String = "" | |
| while !CFStringTokenizerAdvanceToNextToken(self).isEmpty { | |
| output.append(letter(to: transform)) |
This file contains hidden or 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
| public protocol IDProtocol: RawRepresentable, Hashable, Sendable, Identifiable, Codable, CustomStringConvertible where RawValue: Hashable & Sendable & Codable & CustomStringConvertible { | |
| init(rawValue: RawValue) | |
| } | |
| public extension IDProtocol { | |
| init(_ rawValue: RawValue) { | |
| self.init(rawValue: rawValue) | |
| } | |
| // MARK: CustomStringConvertible |
This file contains hidden or 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 | |
| # Google Sheets の最終行に追記するスクリプト | |
| # 訳あって最終行の位置を特定するために行数を取得している | |
| # OAuth周りは下記がわかりやすい | |
| # https://qiita.com/shin1ogawa/items/49a076f62e5f17f18fe5 | |
| CLIENT_ID="Google API ClientID" | |
| CLIENT_SECRET="Google API's client secret" | |
| REFRESH_TOKEN="Google API's refresh token" |
This file contains hidden or 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 PlaygroundSupport | |
| import UIKit | |
| /// Solver for cubic bezier curve with implicit control points at (0, 0) and (1, 1) | |
| /// Based on https://github.com/adobe/webkit/blob/master/Source/WebCore/platform/graphics/UnitBezier.h | |
| struct UnitBezier { | |
| private let a: CGPoint | |
| private let b: CGPoint | |
| private let c: CGPoint | |
| private let epsilon: CGFloat = 0.000001 |
This file contains hidden or 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 ViewController: UITableViewController { | |
| private var names: [String] = (50...99).map { String($0) } | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { |
This file contains hidden or 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
| public struct Extension<Base> { | |
| public let base: Base | |
| public init(_ base: Base) { | |
| self.base = base | |
| } | |
| } | |
| public protocol ExtensionCompatible { | |
| associatedtype Compatible | |
| var ex: Extension<Compatible> { get set } |
This file contains hidden or 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
| public final class Extension<Base> { | |
| public let base: Base | |
| public init(_ base: Base) { | |
| self.base = base | |
| } | |
| } | |
| public struct StaticExtension<Base> { } | |
| public protocol ExtensionCompatible { |