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
@Suppress("DEPRECATION") | |
@SuppressLint("PackageManagerGetSignatures") | |
fun getSignature(algorithm: String): String { | |
fun byteArrayToReadableString(array: ByteArray, delimiter: String = ":"): String { | |
return array.joinToString(delimiter) { | |
var str = Integer.toHexString(it.toInt()) | |
str = (if (str.length == 1) "0$str" else str).replace("ff", "") | |
if (str.isEmpty()) str = "FF" | |
str.uppercase(Locale.getDefault()) | |
} |
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
# based: https://stackoverflow.com/a/67000032 | |
# ghコマンドのセッションチェック | |
gh auth status >/dev/null | |
if [ $? -ne 0 ]; then | |
echo "Please login to GitHub with gh command." | |
exit 1 | |
fi | |
# org, repo を引数から取得する |
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 IntExt on int { | |
/// 3.indexMap((idx) => "$idx!") | |
/// => [0!, 1!, 2!] | |
Iterable<T> map<T>(T Function(int idx) f) sync* { | |
int k = 0; | |
while (k < this) { | |
yield f(k++); | |
} | |
} | |
} |
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
fun Context.loadFileFromAssets(fileName: String): File { | |
return File(cacheDir, fileName) | |
.also { | |
if (it.exists()) it.delete() | |
it.outputStream().use { cache -> | |
assets.open(fileName).use { inputStream -> | |
inputStream.copyTo(cache) | |
} | |
} | |
} |
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
#!/usr/bin/env bash | |
PUBSPEC_FILE_NAME='pubspec.yaml' | |
echo '------------------------------------' | |
echo '-- flutter clean' | |
echo $(pwd) | |
# .dart_tool を除いたプロジェクトフォルダ内の $PUBSPEC_FILE_NAME が格納されているディレクトリ一覧を取得 | |
PUB_SPEC_DIRS=$(find "$(pwd)" \ |
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
/** | |
* ここから始まる | |
* @param {string} appName - アプリ名 | |
* @param {string} fromAddress - 送信元アドレス | |
* @param {string} slackChannelName - 投稿先チャンネル名 | |
* @param {string} slackMessageIcon - 投稿メッセージアイコン | |
* @param {string} slackMessageUserName - 投稿者名 | |
* @param {string} webhookUrl - 投稿スペースのWebhookUrl | |
*/ |
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
/* | |
pubspec.yaml | |
dependencies: | |
flutter_inappwebview: 5.5.0 | |
http: ^0.13.5 | |
*/ | |
// https://developer.yahoo.co.jp/yconnect/v2/authorization_code/ |
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 | |
extension UIView { | |
func dumpChildViewTree(_ indent: Int = 0) { | |
print("\(String(repeating: " ", count: indent)) \(className)") | |
subviews.forEach { $0.dumpChildViewTree(indent + 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
import UIKit | |
import Flutter | |
@IBDesignable | |
class FlutterView: UIView { | |
@IBInspectable | |
var routeName: String = "" { | |
didSet { | |
setupFlutterView() |
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 android.text.SpannableString | |
import android.text.Spanned | |
import android.text.style.ClickableSpan | |
import android.view.View | |
import java.util.regex.Pattern | |
// 格納先のTextViewに以下の設定が必須 | |
// textView.movementMethod = LinkMovementMethod.getInstance() | |
fun CharSequence.setTextClickListener(regex: String = "", onClick: ((text: String) -> Unit)): SpannableString { | |
// regexが空だったら自分自身を指定する (テキスト全てがClickableになる) |
NewerOlder