Skip to content

Instantly share code, notes, and snippets.

View MoyuruAizawa's full-sized avatar
🐈

Moyuru Aizawa MoyuruAizawa

🐈
View GitHub Profile
@MoyuruAizawa
MoyuruAizawa / OverlengthHighlightVisualTransformation.kt
Created April 29, 2023 20:14
VisualTransformation highlights text that exceeds the maxLength.
class OverlengthHighlightVisualTransformation(
private val maxLength: Int,
private val highlightColor: Color
) : VisualTransformation {
override fun filter(text: AnnotatedString) = TransformedText(
buildAnnotatedString {
append(text.take(maxLength).toString())
if (text.length > maxLength)
withStyle(style = SpanStyle(background = highlightColor)) {
append(text.substring(maxLength, text.length))
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.calculateCentroidSize
import androidx.compose.foundation.gestures.calculatePan
import androidx.compose.foundation.gestures.calculateZoom
import androidx.compose.foundation.gestures.forEachGesture
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.input.pointer.AwaitPointerEventScope
import androidx.compose.ui.input.pointer.PointerInputScope
import androidx.compose.ui.input.pointer.positionChanged
import androidx.compose.ui.util.fastAny
# depends on this plugin https://github.com/konifar/gradle-unused-resources-remover-plugin
name: Daily Resource Clean Up
on:
schedule:
- cron: '0 0 * * *'
jobs:
remove-resource:
runs-on: ubuntu-latest
@MoyuruAizawa
MoyuruAizawa / ragnarok_m_damage_calc.rb
Last active August 9, 2019 19:50
ラグマスダメージ計算, Ragnarok M Damage Calculation
atk = 1 # ステータス画面に表示されている偽ATK値
str = 1 # 弓ならDEX, WizならINT
luk = 1
dex = 1 # 弓ならSTR
refine_atk = 0 # ステータス画面の精錬物理攻撃
ignore_def = 0.00 # ステータス画面の物理防御無視
def_penetration = 0.00 # ステータス画面の物理防御貫通
enemy_def = 0 # 敵DEF かかしは0
ignored_enemy_def = enemy_def * (1 - ignore_def)
import android.util.SparseArray
import androidx.activity.ComponentActivity
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import androidx.recyclerview.widget.RecyclerView.RecycledViewPool
class RecycledViewPoolFactory {
package io.moyuru.simplelinearlayoutmanager
import android.os.Parcel
import android.os.Parcelable
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.Recycler
import androidx.recyclerview.widget.RecyclerView.State
import kotlin.math.max
import kotlin.math.min