Skip to content

Instantly share code, notes, and snippets.

View SorrowBlue's full-sized avatar

Sorrow Blue SorrowBlue

View GitHub Profile
package com.sorrowblue.comicviewer.feature.bookshelf.edit
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.Serializer
import kotlinx.serialization.encodeToString
import kotlinx.serialization.encoding.Decoder
ExtraPaneScaffold2(
modifier = Modifier.clip(ComicTheme.shapes.large).background(ComicTheme.colorScheme.surface),
extraPane = {
Scaffold(
topBar = {
TopAppBar(
title = { Text(text = "Side sheet title") },
actions = {
IconButton(onClick = onInfoSheetCloseClick) {
Icon(imageVector = ComicIcons.Close, contentDescription = null)
@SorrowBlue
SorrowBlue / extract_material3_colors.js
Last active May 15, 2022 04:30
Bookmarklet to extract XML from Material Theme Builder
javascript:(function(){var b=prompt("1_light/dark");var a=' <color name="md_theme_'+b+'_primary">'+getComputedStyle(document.getElementsByTagName("body")[0]).getPropertyValue("--md-sys-color-primary")+"</color>\n";a+=' <color name="md_theme_'+b+'_onPrimary">'+getComputedStyle(document.getElementsByTagName("body")[0]).getPropertyValue("--md-sys-color-on-primary")+"</color>\n";a+=' <color name="md_theme_'+b+'_primaryContainer">'+getComputedStyle(document.getElementsByTagName("body")[0]).getPropertyValue("--md-sys-color-primary-container")+"</color>\n";a+=' <color name="md_theme_'+b+'_onPrimaryContainer">'+getComputedStyle(document.getElementsByTagName("body")[0]).getPropertyValue("--md-sys-color-on-primary-container")+"</color>\n";a+=' <color name="md_theme_'+b+'_secondary">'+getComputedStyle(document.getElementsByTagName("body")[0]).getPropertyValue("--md-sys-color-secondary")+"</color>\n";a+=' <color name="md_theme_'+b+'_onSecondary">'+getComputedStyle(document.getElementsByTagName("body")[0
@SorrowBlue
SorrowBlue / JVM_IR_Backend_Is_Stable.kt
Created April 6, 2021 00:08
The New JVM IR Backend Is Stable for android.
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
// https://blog.jetbrains.com/kotlin/2021/02/the-jvm-backend-is-in-beta-let-s-make-it-stable-together/
android {
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.useIR = true
}
}
@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つ使用すると擬似的に使用できます。

@SorrowBlue
SorrowBlue / exclude
Last active May 30, 2020 13:53
android kotlin build.gradle tips
android {
packagingOptions {
exclude("META-INF/**.kotlin_module")
}
}
{
"talks": [
{
"ask": ["名前は?"],
"answer": ["福嶋 悠"]
}, {
"ask": ["学歴は?"],
"answer": ["名古屋情報メディア専門学校", "ITスペシャリスト学科"]
}, {
"ask": ["趣味は?"],
@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)
@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()
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;