Skip to content

Instantly share code, notes, and snippets.

View jisungbin's full-sized avatar
๐Ÿ‘ป
Beep beep boop

Ji Sungbin (Forky) jisungbin

๐Ÿ‘ป
Beep beep boop
View GitHub Profile
@hsz
hsz / Clean Gradle Transformers Cache.kt
Created July 19, 2024 14:44
This scripts remove all IntelliJ Platform extracted copies from the Gradle Transformer Cache.
@file:OptIn(ExperimentalPathApi::class)
import kotlin.io.path.*
/**
* This scripts remove all IntelliJ Platform extracted copies from the Gradle Transformer Cache.
*/
fun main() {
val userHome = Path(System.getProperty("user.home"))
val caches = userHome.resolve(".gradle/caches")
Kotlin K2 FIR Example. Related Post: https://handstandsam.com/2024/05/30/kotlin-k2-fir-quickstart-guide/
@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()
@fvilarino
fvilarino / draggable_content_final.kt
Created June 22, 2023 18:56
Draggable Contente - Final
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
PlaygroundTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background,
) {
Box {
@oianmol
oianmol / platform.android.kt
Created May 19, 2023 10:01
Jetpack Compose Side Effect to update Android or iOS status-bar and navigation-bar color
@Composable
actual fun PlatformColors(statusBarColor: Color, navBarColor: Color){
val sysUiController = rememberSystemUiController()
SideEffect {
sysUiController.setSystemBarsColor(color = topColor)
sysUiController.setNavigationBarColor(color = bottomColor)
}
}
@kconner
kconner / macOS Internals.md
Last active June 18, 2025 19:55
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@Peanuuutz
Peanuuutz / CachedDrawModifierNode.kt
Last active June 14, 2024 01:24
Modifier.Node Version of Modifier.drawWithCache
@file:OptIn(ExperimentalComposeUiApi::class)
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
package net.peanuuutz.compose.desktop
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.BuildDrawCacheParams
import androidx.compose.ui.draw.CacheDrawScope
import androidx.compose.ui.draw.DrawResult

์•ˆ๋…•ํ•˜์„ธ์š”! ์„ฑ๋นˆ๋žœ๋“œ ์Šคํ„ฐ๋”” ๊ณต์ง€ ๋“œ๋ฆฝ๋‹ˆ๋‹ค. ์„ฑ๋นˆ๋žœ๋“œ ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ ๊ฐœ๋ฐœ์„ ์‹œ์ž‘ํ•˜๊ธฐ ์ „์— ํ•œ ๋‹ฌ๊ฐ„ ์ฝ”๋ฃจํ‹ด๊ณผ ์•ˆ๋“œ๋กœ์ด๋“œ ํ”„๋ ˆ์ž„์›Œํฌ ๋‚ด๋ถ€ ๋”ฅ๋‹ค์ด๋ธŒ ์Šคํ„ฐ๋””๋ฅผ ์ง„ํ–‰ํ•˜๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ํ‰์†Œ ํ˜ผ์ž ๊ณต๋ถ€ํ•˜๋Š” ํŽธ์ด์ง€๋งŒ ์›Œ๋‚™ ์–ด๋ ต๊ณ  ์ข‹์€ ์ฃผ์ œ์ธ ๋งŒํผ ํ•จ๊ป˜ ๊ณต๋ถ€ํ•ด ๋ณด๋ฉด ์ข‹์„ ๊ฑฐ ๊ฐ™์•„ ์Šคํ„ฐ๋””์›์„ ๋ชจ์ง‘ํ•˜๊ฒŒ ๋์Šต๋‹ˆ๋‹ค.

์ตœ์‹  ๋‚ด์šฉ์€ ์„ฑ๋นˆ๋žœ๋“œ ๊ณต์ง€๋ฅผ ํ†ตํ•ด ํ™•์ธํ•ด ์ฃผ์„ธ์š”!

๋ชฉ์ 

์ด ์Šคํ„ฐ๋””์˜ ์ฒซ ๋ฒˆ์งธ ๋ชฉ์ ์€ ์—”์ง€๋‹ˆ์–ด์  ๊ด€์ ์—์„œ ์—ญ๋Ÿ‰์„ ํ‚ค์šฐ๊ธฐ ์œ„ํ•จ์ž…๋‹ˆ๋‹ค. ๋˜ํ•œ ๋‚ด๋ถ€๋ฅผ ์•Œ๊ณ  ์„ค๊ณ„ํ•˜๋Š” ๊ฒƒ๊ณผ ๋‚ด๋ถ€๋ฅผ ๋ชจ๋ฅด๊ณ  ์„ค๊ณ„ํ•˜๋Š” ๊ฒƒ์—์„œ ๋ถ„๋ช…ํ•œ ์ฐจ์ด๊ฐ€ ์žˆ์Œ์„ ์ œ๊ฐ€ ์ปดํฌ์ฆˆ ๋‚ด๋ถ€ ๊ณต๋ถ€๋ฅผ ํ†ตํ•ด ๋А๊ผˆ์œผ๋ฏ€๋กœ ๋” ์ข‹์€ ์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๋ชฉ์ ๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

์ œ๊ฐ€ ์ปดํฌ์ฆˆ ๋‚ด๋ถ€๋ฅผ ๊ณต๋ถ€ํ•˜๋ฉด์„œ ๋А๋‚€ ์ ์ด ํ˜ผ์ž์„œ ์ด ๋งŽ์€ ๋‚ด์šฉ์„ ์ดํ•ดํ•˜๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ์–ด๋ ต๋‹ค๋Š” ๊ฑฐ์˜€์Šต๋‹ˆ๋‹ค. ์ดˆ๋ฐ˜์—” ์–ด๋А ํ๋ฆ„์„ ๋ด์•ผ ํ•  ์ง€๋„ ๋ชจ๋ฅด๊ฒ ์–ด์„œ ๋ฐฉํ™ฉํ•˜๋Š” ์‹œ๊ฐ„์ด ๋„ˆ๋ฌด ๋งŽ์•˜์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ๊ทน๋ณตํ•˜๊ธฐ ์œ„ํ•ด ์ œ๊ฐ€ ์‹œ๋„ํ–ˆ๋˜ ์ผ๋“ค์€ ์ œ๊ฐ€ ์ฐธ๊ณ ํ•œ ์ปดํฌ์ฆˆ ๋‚ด๋ถ€ ๋ ˆํผ๋Ÿฐ์Šค์˜ ์ž‘์„ฑ์ž๋ถ„๊ณผ ์™ธ๊ตญ ์•ˆ๋“œ๋กœ์ด๋“œ GDE ์ด์‹  ๋ถ„๋“ค, StackOverflow, kotlinlang ์Šฌ๋ž™, ๊ทธ๋ฆฌ๊ณ  ๊ตฌ๊ธ€ ์ปดํฌ์ฆˆ ํŒ€์— ๊ณ„์‹  ๋ถ„๋“ค์—๊ฒŒ ์—ฌ๋Ÿฌ ๋ฒˆ ์งˆ๋ฌธ์„ ํ†ตํ•ด 6๊ฐœ์›”๊ฐ„ ์”จ๋ฆ„ ๋์— ๋“œ๋””์–ด ๋ฐฉํ–ฅ์„ ์žก๊ณ  ์ดํ•ดํ•  ์ˆ˜ ์žˆ์—ˆ๊ณ , ์„ฑ๋นˆ๋žœ๋“œ์— ์ปดํฌ์ฆˆ ๋‚ด๋ถ€ ๊ธ€์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

package foo.bar
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.*
private val testingScope = CoroutineScope(CoroutineName("TestingScope"))
@alexvanyo
alexvanyo / ScreenshotTests.kt
Last active July 9, 2024 16:48
Automatic @Preview screenshot tests with Showkase and Paparazzi
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
import androidx.compose.foundation.layout.Box
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.platform.LocalInspectionMode
import app.cash.paparazzi.DeviceConfig
import app.cash.paparazzi.Paparazzi
import com.airbnb.android.showkase.models.Showkase