Skip to content

Instantly share code, notes, and snippets.

View Skaldebane's full-sized avatar
💻
Coding thingies...

Houssam Elbadissi Skaldebane

💻
Coding thingies...
View GitHub Profile
@Skaldebane
Skaldebane / video-demo.kt
Created April 23, 2025 07:59
Compose/JS video player demo. This is just a prototype with huge performance issues, DO NOT USE. Based on code by Alex Styl, with some changes.
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
@Skaldebane
Skaldebane / wk-experiment.kt
Last active April 22, 2025 01:34
WaniKani radical/kanji/vocab/reading highlight colors for Compose.
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.appendInlineContent
import androidx.compose.material.LocalTextStyle
import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.CornerRadius
@Skaldebane
Skaldebane / AngledSweepGradient.kt
Created October 12, 2023 07:49
AngledSweepGradient Android
import android.graphics.SweepGradient
import android.os.Build
import androidx.annotation.VisibleForTesting
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import androidx.compose.ui.geometry.*
import androidx.compose.ui.graphics.*
import androidx.compose.ui.util.fastForEachIndexed
import androidx.core.graphics.transform
@Skaldebane
Skaldebane / AngledSweepGradient.android.kt
Last active April 17, 2025 06:48
AngledSweepGradient - Sweep gradient implementation for Compose with a customizable start angle
import android.graphics.SweepGradient
import android.os.Build
import androidx.annotation.VisibleForTesting
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import androidx.compose.ui.geometry.*
import androidx.compose.ui.graphics.*
import androidx.compose.ui.util.fastForEachIndexed
import androidx.core.graphics.transform
@Skaldebane
Skaldebane / index.css
Created October 6, 2023 01:50
CSS - Animated Border Colors with Conic Gradients [Works on Firefox™]
html { font-family: sans-serif }
.top {
width: 196px;
height: 46px;
margin: 2px;
position: absolute;
top: 0;
left: 0;
right: 0;
@Skaldebane
Skaldebane / AnimationInPopup.kt
Last active March 5, 2023 11:24
Popup with Show/Hide animations. Read comment for more details.
/**
* This popup uses two hacks:
* 1. Deferring the AnimatedVisibility's `visible` state: If `AnimatedVisibility` enters the composition
* with `visible = true` by default, it won't animate. So I work around that by setting it to a state defaulting to
* `false`, then instantly switch it to `true` during composition by means of a `LaunchedEffect`.
*
* 2. Deferring the Popup's hiding until the animation is complete: When we set `show = false`, the `Popup` leaves
* the composition immediately, so the exit animation isn't shown. To work around this, I set the aforementioned
* internal state of the AnimatedVisibility to `false` first (which will start the exit animation), then set
* `show = false` once the exit animation is finished by means of a `DisposableEffect`, whose `onDispose` lambda
@Skaldebane
Skaldebane / IntegerToText.kt
Created August 18, 2022 00:48
Small Kotlin helper function for converting a number to its textual representation, with a heavily functional approach.
fun main() {
while (true) {
val number = input("Number: ").toIntOrNull()
if (number != null)
println(number.getName())
else
println("Invalid Number!")
}
}
@Skaldebane
Skaldebane / main.kt
Created May 23, 2021 15:40
Initial testing for a font viewer for desktop, using Jetpack Compose - Skaldebane.
import androidx.compose.desktop.Window
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle