Skip to content

Instantly share code, notes, and snippets.

View jisungbin's full-sized avatar
🌴
언어의 정원사

Ji Sungbin jisungbin

🌴
언어의 정원사
  • 여의도 (South Korea)
  • South Korea, Seoul
  • 01:16 (UTC +09:00)
View GitHub Profile
import androidx.compose.runtime.Composable
import androidx.compose.runtime.InternalComposeApi
import androidx.compose.runtime.NonRestartableComposable
import androidx.compose.runtime.RememberObserver
import androidx.compose.runtime.currentComposer
import androidx.compose.runtime.remember
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
@jisungbin
jisungbin / DropShadow.kt
Created November 7, 2023 01:52
JetpackCompose-DropShadow
@Stable
fun Modifier.dropShadow(
borderRadius: Dp,
spreadRadius: Dp = 3.dp,
blurRadius: Dp = spreadRadius,
color: Color = Color.DarkGray.copy(alpha = 0.1f),
offsetX: Dp = 0.dp,
offsetY: Dp = 0.dp,
) =
drawBehind {
@jisungbin
jisungbin / Modifier.drawHorizontalFadingEdges.kt
Last active October 18, 2023 18:16
Jetpack Compose horizontal fading edges with ScrollableState.
@Stable
fun Modifier.drawHorizontalFadingEdges(
target: Color = Color.White,
width: Dp = 10.dp,
scrollState: ScrollableState,
) =
if (!scrollState.canScrollForward && !scrollState.canScrollBackward) this
else drawWithCache {
val gradientWidth = width.toPx()
/*
* Designed and developed by "옴마야" Team 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/mash-up-kr/WeQuiz-Android/blob/main/LICENSE
*/
package team.ommaya.wequiz.android
import android.os.Bundle
@file:OptIn(ExperimentalComposeUiApi::class)
@file:Suppress("unused")
@file:NoLiveLiterals
package land.sungbin.androidplayground.extension
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.AnimationVector2D
import androidx.compose.animation.core.Spring
@file:OptIn(
ExperimentalComposeUiApi::class,
ExperimentalMaterialApi::class
)
package land.sungbin.androidplayground.snippet.animation
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBarsPadding
@jisungbin
jisungbin / 01: basic types.ts
Created April 22, 2023 13:45 — forked from dimitardanailov/01: basic types.ts
Typescript in action
/**
* Boolean
*
* The most basic datatype is the simple true/false value,
* which JavaScript and TypeScript (as well as other languages) call a 'boolean' value.
*/
var isDone: boolean = false;
/**
* Number
class PlaygroundActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Layout(
modifier = Modifier.fillMaxSize(),
content = {
Box(
modifier = Modifier
.layoutId("green")
fun <A, B> mutableStatePairOf(first: A, second: B): SnapshotMutablePair<A, B> {
return SnapshotMutablePairImpl(first, second)
}
fun <A, B> mutableStatePairOf(value: Pair<A, B>): SnapshotMutablePair<A, B> {
return SnapshotMutablePairImpl(value.first, value.second)
}
@Stable
interface SnapshotMutablePair<A, B> {