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
# Pull Request の差分に対して swift-format でフォーマットして commit & push | |
name: swift-format | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "**/*.swift" |
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 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 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 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 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 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 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 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 |
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 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 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() | |
} |
NewerOlder