Skip to content

Instantly share code, notes, and snippets.

View muhammedesadcomert's full-sized avatar
🎯
Focusing

Muhammed Esad Cömert muhammedesadcomert

🎯
Focusing
View GitHub Profile
@ardakazanci
ardakazanci / InteractiveTouchCanvas.kt
Created February 15, 2024 18:09
Interactive Canvas for jetpack compose
@Composable
fun InteractiveCanvas(maxWidth: Int, maxHeight: Int) {
val random = remember { Random.Default }
var touchPosition by remember { mutableStateOf(Offset.Unspecified) }
val heartSize = 75F
val heartPath = createHeartPath(heartSize)
val heartOffsets = remember { mutableStateListOf<Offset>() }
val heartColors = remember { mutableStateListOf<Color>() }
if (heartOffsets.isEmpty()) {
@ardakazanci
ardakazanci / SpringAnimationWithDrawing.kt
Created February 3, 2024 18:02
Spring Animation for Canvas Drawing Star
@Composable
fun SpringAnimationForStar() {
var touchPointActions by remember { mutableStateOf(listOf<Offset>()) }
var animatedStars by remember { mutableStateOf(listOf<Animatable<Offset, AnimationVector2D>>()) }
LaunchedEffect(touchPointActions) {
if (touchPointActions.size > 1) {
val startPoint = touchPointActions[touchPointActions.size - 2]
val endPoint = touchPointActions.lastOrNull()
animatedStars += Animatable(startPoint, Offset.VectorConverter).also { animatable ->
@ardakazanci
ardakazanci / StickyFloatingDraggableButton.kt
Created January 16, 2024 19:04
Sticky Draggable Button for Jetpack Compose
@Composable
fun DraggableStickyButton() {
val context = LocalContext.current
val density = LocalDensity.current
val imageBitmap = remember {
val bitmap = BitmapFactory.decodeResource(context.resources, R.drawable.ball)
bitmap.asImageBitmap()
}
val screenWidthPx = with(density) { LocalConfiguration.current.screenWidthDp.dp.toPx() }
val screenHeightPx = with(density) { LocalConfiguration.current.screenHeightDp.dp.toPx() }
@bmc08gt
bmc08gt / 1_Screen.kt
Last active December 6, 2023 17:45
FKScaffold with accessory view triggers
FKScaffold(
modifier = Modifier.fillMaxSize(),
topBar = {
FKLargeTopAppBar(title = name)
},
) { padding, triggerAccessoryView ->
ItemForm(
modifier = Modifier.padding(top = padding.calculateTopPadding()),
state = state,
dispatch = viewModel::dispatchEvent
@inidamleader
inidamleader / AutoSizeText.kt
Last active June 12, 2024 10:27
Composable function that automatically adjusts the text size to fit within given constraints with optimal performance by using a binary search algorithm
// LAST UPDATE: 01 Jun 2024 V6:
// - Remove ImmutableWrapper due to new possibilities to make List class stable in jetpack compose (compose_compiler_config.conf or enableStrongSkippingMode)
package com.inidamleader.ovtracker.util.compose
import android.util.Log
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.BoxWithConstraintsScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.material3.LocalContentColor
@nhcodes
nhcodes / Picker.kt
Created May 17, 2023 11:19
Android NumberPicker for Jetpack Compose
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.Divider
import androidx.compose.material3.LocalContentColor
@mertceyhan
mertceyhan / TypewriterTextEffect.kt
Created May 8, 2023 13:54
TypewriterTextEffect: A customizable Jetpack Compose function that reveals text with a typewriter-like effect, one chunk at a time
/**
* A composable function that displays a text with a typewriter-like effect, revealing characters in chunks.
*
* @param text The input text to be displayed with the typewriter effect.
* @param minDelayInMillis The minimum delay in milliseconds between revealing character chunks, defaults to 10ms.
* @param maxDelayInMillis The maximum delay in milliseconds between revealing character chunks, defaults to 50ms.
* @param minCharacterChunk The minimum number of characters to reveal at once, defaults to 1.
* @param maxCharacterChunk The maximum number of characters to reveal at once, defaults to 5.
* @param onEffectCompleted A callback function invoked when the entire text has been revealed.
* @param displayTextComposable A composable function that receives the text to display with the typewriter effect.
@dellisd
dellisd / Test.kt
Created June 9, 2022 16:37
Explicit Backing Fields
class Test {
val names: List<String>
field: MutableList<String> = mutableListOf<String>()
fun doThing() {
names.add("Hello!")
}
}
fun main() {
@Darkere
Darkere / gist:9e2ebda80a92a91d9257cfc2bcc016a5
Last active April 8, 2024 02:05
Finding and editing chunks with NBT Explorer

Finding and editing chunks with NBT Explorer

Download: https://github.com/jaquadro/NBTExplorer/releases

Alternatively NBT Studio is much faster and cleaner but works the same way https://github.com/tryashtar/nbt-studio/releases/

1. Figure out which chunk you are going for.

1.a If you are crashing due to an entitiy or tileentity the crashlog might contain the exact coordinates

1.b If you have a waypoint there for example checking your map files can be helpful

1.c If your player is in the same chunk you can look up your players position

@madkoding
madkoding / pair-dual-boot-bluetooth.md
Last active June 18, 2024 12:18
Pairing bluetooth devices in dual boot with Linux Ubuntu and Windows 10/11

Pairing Bluetooth Devices in Dual Boot with Linux Ubuntu and Windows 10/11

Introduction

This guide provides updated instructions for pairing Bluetooth devices (such as keyboards or mice) in a dual-boot environment with Linux Ubuntu and Windows 10/11, incorporating community feedback and suggestions.

Instructions

1. Pair in Linux First

  • Pair your Bluetooth device in Linux. This is crucial to ensure the LinkKey remains consistent.
  • Note: Do not re-pair the device in Linux after completing the pairing in Windows.