Skip to content

Instantly share code, notes, and snippets.

View SorrowBlue's full-sized avatar

Sorrow Blue SorrowBlue

View GitHub Profile
@SorrowBlue
SorrowBlue / file0.txt
Last active December 21, 2017 11:32
いまさら RuntimePermission を簡単に実装するやつ作ってみた ref: https://qiita.com/SorrowBlue/items/52ecd509cbd63b0e6552
dependencies {
implementation 'com.sorrowblue.library:supportruntimepermission:1.0.0'
}
repositories {
maven { url 'https://raw.githubusercontent.com/SorrowBlue/Android-Library/master/' }
}
isTech -> falseでクリエイティブに追加する
// アイテムID登録
IDRegistry.genItemID("testItem")
// 普通のアイテム追加
Item.createItem("item_id", "item_name", {name: "texture_name", meta: 0}, {isTech: false, stack: 64})
// 食べられるアイテム追加
Item.createFoodItem("item_id", "item_name", {name: "texture_name", meta: 0}, {isTech: false, stack: 64, food: 1})
@SorrowBlue
SorrowBlue / Timer.js
Created April 12, 2018 17:47
Inner Core
// standard
const timer = new java.util.Timer();
timer.schedule(new JavaAdapter(java.util.TimerTask, {
run: function () {
alert('timer test');
}
}), 100, 5000);
// ExtraScript
View
TextView
ImageView
Layout
LayoutParams
MarginLayoutParams
Window
Frame
const Class = function Class(ctr) {
this._class = ctr;
};
Class.prototype.build = function () {
return this._class;
};
Class.prototype.addMethod = function (name, methods) {
this._class.prototype[name] = methods;
@SorrowBlue
SorrowBlue / AppFragment.kt
Last active July 5, 2018 00:22
FragmentでBackPressedを捕る取る採る盗る ref: https://qiita.com/SorrowBlue/items/e740899702bb88d1c7b4
class AppFragment: Fragment(), FragmentOnBackPressed {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.catchBackPressed(this)
}
override fun onBackPressed(): Boolean {
return if (flag) {
some()
@SorrowBlue
SorrowBlue / .commit_template
Created December 15, 2018 09:56
Emoji prefix to use at commit message
# ==================== Emojis ====================
# 🎉 :tada: 初めてのコミット(Initial Commit)
# 🔖 :bookmark: バージョンタグ(Version Tag)
# ✨ :sparkles: 新機能(New Feature)
# 🐛 :bug: バグ修正(Bagfix)
# ♻️ :recycle: リファクタリング(Refactoring)
# 📚 :books: ドキュメント(Documentation)
# 🎨 :art: デザインUI/UX(Accessibility)
# 🐎 :horse: パフォーマンス(Performance)
{
"talks": [
{
"ask": ["名前は?"],
"answer": ["福嶋 悠"]
}, {
"ask": ["学歴は?"],
"answer": ["名古屋情報メディア専門学校", "ITスペシャリスト学科"]
}, {
"ask": ["趣味は?"],
@SorrowBlue
SorrowBlue / exclude
Last active May 30, 2020 13:53
android kotlin build.gradle tips
android {
packagingOptions {
exclude("META-INF/**.kotlin_module")
}
}
@SorrowBlue
SorrowBlue / inline_class.md
Created June 1, 2020 17:56
kotlinx serialize
title tags author slide
Kotlin hack where kotlinx.serialization supports inlineclass(kotlinx.serializationでinlineClassを使用するハック)
Kotlin serialize Android
SorrowBlue
false

はじめに

現時点(2020/3/28)では、kotlinx.serializationinline classをサポートしていません。(ロードマップにはあるみたいですが...) https://youtrack.jetbrains.com/issue/KT-28791 なので、コンストラクタを2つ使用すると擬似的に使用できます。