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
# Pull Request の差分に対して swift-format でフォーマットして commit & push | |
name: swift-format | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "**/*.swift" |
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 | |
import Security | |
/// JWT検証 | |
/// - Parameters: | |
/// - rsaPublicKey: 公開鍵の SecKey | |
/// - signature: JWT のドット区切りの3番目 | |
/// - headerAndPayload: JWT のドット区切りの1・2番目 | |
/// - Returns: JWTの検証結果 | |
func verifyJWT(rsaPublicKey: SecKey, signature: String, headerAndPayload: String) -> Bool { |
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 | |
enum Either<L, R> { | |
case left(L) | |
case right(R) | |
} | |
extension Either: Equatable where L: Equatable, R: Equatable {} | |
extension Either: Hashable where L: Hashable, R: Hashable {} | |
extension Either: Codable where L: Codable, R: Codable { |
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
extension Sequence where Iterator.Element: Hashable { | |
var unique: [Iterator.Element] { | |
var checked: Set<Iterator.Element> = [] | |
return filter { checked.insert($0).inserted } | |
} | |
} | |
extension Sequence where Iterator.Element: Equatable { | |
var unique: [Iterator.Element] { | |
reduce([]) { $0.contains($1) ? $0 : $0 + [$1] } |
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/sh | |
| |
# ~/say_with_volume.sh "hello world" # default volume is 20 | |
# ~/say_with_volume.sh "hello world" 30 | |
| |
volume=`osascript -e "output volume of (get volume settings)"` | |
default_volume=20 | |
say_volume=$2 | |
| |
if [ $volume = "0" ]; then |
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/sh | |
/opt/cisco/anyconnect/bin/vpn disconnect |
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/sh | |
# setting | |
COMMAND=/opt/cisco/anyconnect/bin/vpn | |
GROUP='' | |
USER='' | |
SERVICE='Cisco AnyConnect' | |
PASS=`security find-generic-password -a "${USER}" -s "${SERVICE}" -w` | |
PASS2='' | |
HOST='' |
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
// https://www.w3.org/TR/WCAG20/ | |
// Contrast ratio | |
// Relative luminance | |
import UIKit | |
extension UIColor { | |
convenience init(hex: UInt, alpha: CGFloat = 1) { | |
self.init(red: CGFloat((hex & 0xff0000) >> 16) / 255, | |
green: CGFloat((hex & 0x00ff00) >> 8) / 255, |
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 RippleCheckmark: UIView { | |
private let circleLayer: CAShapeLayer = .init() | |
private let rippleLayer: CAShapeLayer = .init() | |
private let checkmarkLayer: CAShapeLayer = .init() | |
private var completion: (() -> Void)? | |
var fillColor: UIColor = .blue { | |
didSet { update() } |
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 GoogleLoadingIndicator: UIView { | |
var colors: [UIColor] = [] | |
private var index: Int = 0 | |
private let totalDuration: TimeInterval = 2 | |
private let movingAngle: CGFloat = 5 / 6 * .pi2 | |
private let rotationCount: Int = 6 | |
private let minimumAngle: CGFloat = .pi2 / 24 |
NewerOlder