I hereby claim:
- I am mtsd on github.
- I am mtsd (https://keybase.io/mtsd) on keybase.
- I have a public key ASDRawJ1ubw8q0mpwW3MKZWdpQ_a8z8mR0nh568DiLV99Qo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| import Foundation | |
| open class MockResponse { | |
| static let errorDomain = "API Mock Error" | |
| enum ErrorCode: Int { | |
| case fileNotFound = -10001 | |
| case disableReadFile = -10002 | |
| var description: String { | |
| switch self { |
| import CommonCrypto | |
| // MARK: AES128 暗号、復号化 | |
| public extension String { | |
| func aesEncrypt(key: String, iv: String) -> String? { | |
| guard | |
| let data = self.data(using: .utf8), | |
| let key = key.data(using: .utf8), | |
| let iv = iv.data(using: .utf8), |
| #!/bin/sh | |
| # ファイルの1年間のコミット数 | |
| git ls-files | | |
| while read file ; do | |
| commits=`git log --since=1.year --no-merges --oneline -- $file | wc -l`; | |
| echo "$commits - $file"; | |
| done | sort -n |
| ############################### | |
| # get latest release git branch | |
| ############################### | |
| desc "get latest release git branch" | |
| private_lane :git_latest_release_branch do | |
| pattern = "release\/(.+)" | |
| branches = git_find_branches(pattern: pattern) | |
| reg = Regexp.new(pattern) | |
| branches = branches.sort { |a, b| |
| internal extension KeyedDecodingContainer { | |
| /// 不正なurlだとdecodeエラーになるので、nilにしてスルーする | |
| /// @see https://github.com/apple/swift/blob/master/stdlib/public/Darwin/Foundation/URL.swift | |
| /// @see https://github.com/apple/swift/blob/master/stdlib/public/core/Codable.swift.gyb | |
| /// @see https://github.com/apple/swift/blob/master/stdlib/public/Darwin/Foundation/JSONEncoder.swift | |
| func decodeIfPresent(_ type: URL.Type, forKey key: K) throws -> URL? { | |
| guard try contains(key) && !decodeNil(forKey: key) | |
| else { return nil } | |
| do { |
| # | |
| # https://techracho.bpsinc.jp/baba/2013_05_31/8837 | |
| # | |
| dir = '~/Downloads/Dev/JSON/' | |
| dir = File.expand_path(dir) | |
| def decode(file) | |
| puts file |
| public extension UIImage { | |
| /// 画像を指定したサイズでリサイズする | |
| /// @see https://qiita.com/ruwatana/items/473c1fb6fc889215fca3 | |
| func resized(to size: CGSize) -> UIImage? { | |
| UIGraphicsBeginImageContextWithOptions(size, opaque, scale) | |
| draw(in: CGRect(origin: .zero, size: size)) | |
| let image = UIGraphicsGetImageFromCurrentImageContext() | |
| UIGraphicsEndImageContext() | |
| return image | |
| } |
| desc "check carthage outdated" | |
| lane :check_carthage_outdated do | |
| carthage_outdated( | |
| slack_url: "https://hooks.slack.com/services/xxxx", | |
| slack_username: "MyBot" | |
| ) | |
| end | |
| desc "check cocoapods outdated" | |
| lane :check_cocoapods_outdated do |options| |