Skip to content

Instantly share code, notes, and snippets.

@StylianosGakis
StylianosGakis / Results as of 2023-10-07
Last active October 30, 2023 19:49
Get all contributors for all repos of a GitHub account
Number of contributors: 192
@StylianosGakis
StylianosGakis / AndroidManifest.xml
Created August 29, 2023 07:48
Snippet to snapping an image out of a composable and sharing it through a share sheet
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity
android:name="..."
android:exported="true"
android:label="..."
android:theme="...">
@StylianosGakis
StylianosGakis / HorizontalTextsWithMaximumSpaceTaken.kt
Created October 4, 2022 22:09
HorizontalTextsWithMaximumSpaceTaken composable to give two text composables fair space to expand as much as possible without taking each others space
import androidx.compose.foundation.layout.size
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@StylianosGakis
StylianosGakis / Bouncy ropes demo
Last active July 19, 2023 08:55
Jetpack Compose demo for an animated bouncy rope draggable with your mouse
import androidx.compose.animation.core.animateOffsetAsState
import androidx.compose.animation.core.spring
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.gestures.detectDragGestures
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
@StylianosGakis
StylianosGakis / Task.kt
Last active August 20, 2021 11:24
Kotlin solution for day 3 of advent of code 2020. https://adventofcode.com/2020/day/3
package day03
import java.io.File
@JvmInline
private value class Map(val map: List<List<Square>>) {
fun countNumberOfTreesForStep(step: Coordinate): Int {
return generateSequence(
seed = Coordinate(0, 0),
@StylianosGakis
StylianosGakis / ComposeAnimation.kt
Last active August 8, 2021 20:58
Running gif here: https://twitter.com/GakisStylianos/status/1424149663662411776 . Gist of a code example copying the functionality of https://twitter.com/doris4lt/status/1423373212063211522 showcasing different Row arrangements using Jetpack Compose animations. Built using Jetpack Compose for desktop version '1.0.0-alpha1'.
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.SpringSpec
import androidx.compose.animation.core.VectorConverter
import androidx.compose.animation.core.animate
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@StylianosGakis
StylianosGakis / health_container_pickup.lua
Created December 10, 2019 23:11
Health container pickup including adding extra max health (Note: Needs the MaxHealthAmount variable inside the config.lua to be defined as well)
dofile_once( "data/scripts/game_helpers.lua" )
dofile_once("data/scripts/lib/utilities.lua")
dofile( "mods/health_container/config.lua" )
function item_pickup( entity_item, entity_who_picked, item_name )
local pos_x, pos_y = EntityGetTransform( entity_item )
local damagemodels = EntityGetComponent( entity_who_picked, "DamageModelComponent" )
if( damagemodels ~= nil ) then