func customPrint(line: Int = #line, file: String = #file, _ target: Any) {
Pretty.splatPrint(
label: nil,
targets: ["file", file],
separator: " : ",
option: Pretty.Option(colored: true)
)
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
| grep -Rn \ | |
| --exclude='*.sh' \ | |
| -e 'activeInputModes' |
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://online.swiftplayground.run/ でSwift Concurrencyを試す用のサンプル | |
| struct Example { | |
| @available(macOS 10.15.0, *) | |
| static func factors(for number: Int) async -> [Int] { | |
| var result = [Int]() | |
| for check in 1...number { | |
| if number.isMultiple(of: check) { | |
| result.append(check) |
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
| def assert(actual, expected) | |
| # p "actual: #{actual}" | |
| if actual == expected | |
| return | |
| else | |
| puts "#{actual} is not equal to #{expected}!" | |
| exit(false) | |
| end | |
| end |
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
| /* | |
| The rawValue of UIContentSizeCategory is not as clear as `UICTContentSizeCategoryL`(see example below) . | |
| ```swift | |
| UIContentSizeCategory.large.rawValue//"UICTContentSizeCategoryL" | |
| UIContentSizeCategory.accessibilityExtraExtraExtraLarge.rawValue//"UICTContentSizeCategoryAccessibilityXXXL" | |
| ``` | |
| To solve this problem, I defined mapping. |
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
| ffmpeg -i foo.mkv -vcodec copy -acodec copy foo.mp4 |
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 { | |
| func drop(start at: Int, quantity: Int) -> [Element] { | |
| return Array(self.dropFirst(at).prefix(quantity)) | |
| } | |
| } | |
| let array = [0, 1, 2, 3, 4, 5] | |
| let actual = array.drop(start: 2, quantity: 3) | |
| print(actual == [2, 3, 4]) |
In root directory of project:
% swift-format -m dump-configuration > .swift-format.json
% code .swift-format.jsonconfigure indentation in .swift-format.json:
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
| # precondition | |
| # install ffmpeg | |
| for f in *.aiff; | |
| do | |
| ffmpeg -i "$f" -f mp3 -acodec libmp3lame -ab 320000 -ar 44100 "output/${f%.aiff}.mp3"; | |
| done |
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 SwiftUI | |
| class ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| configure(BindingView()) | |
| } | |
| } |
NewerOlder