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 Foundation | |
open class MockResponse { | |
static let errorDomain = "API Mock Error" | |
enum ErrorCode: Int { | |
case fileNotFound = -10001 | |
case disableReadFile = -10002 | |
var description: String { | |
switch self { |
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 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), |
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 | |
# ファイルの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 |
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
############################### | |
# 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| |
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
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 { |
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://techracho.bpsinc.jp/baba/2013_05_31/8837 | |
# | |
dir = '~/Downloads/Dev/JSON/' | |
dir = File.expand_path(dir) | |
def decode(file) | |
puts file |
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
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 | |
} |
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
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| |
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
# -Xfrontend -debug-time-function-bodies -Xfrontend -warn-long-function-bodies=100 | |
lane :profile_build_time do |options| | |
gym( | |
... | |
) | |
options.merge!(product_name: 'Sample', display_limit: 30) | |
xcprofiler(options) | |
output_path = Actions.lane_context[SharedValues::XCPROFILER_OUTPUT_PATH] |
NewerOlder