Skip to content

Instantly share code, notes, and snippets.

View lub0s's full-sized avatar
:octocat:

Lubos Mudrak lub0s

:octocat:
View GitHub Profile
@lub0s
lub0s / better-git-branch.sh
Created March 25, 2024 09:59 — forked from schacon/better-git-branch.sh
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@lub0s
lub0s / icons.sh
Last active February 12, 2024 13:36
reduce padding for macos topbar icons to prevent notch from hiding them
# 0 - 6. Always reset the session after these:
defaults -currentHost write -globalDomain NSStatusItemSelectionPadding -int 6
defaults -currentHost write -globalDomain NSStatusItemSpacing -int 6
# Revert to the original values
defaults -currentHost delete -globalDomain NSStatusItemSelectionPadding
defaults -currentHost delete -globalDomain NSStatusItemSpacing
@lub0s
lub0s / CircularReveal.kt
Created August 24, 2023 16:19 — forked from darvld/CircularReveal.kt
A circular reveal effect modifier for Jetpack Compose.
package cu.spin.catalog.ui.components
import android.annotation.SuppressLint
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.updateTransition
import androidx.compose.runtime.State
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.drawWithCache
import androidx.compose.ui.geometry.Offset

Automating Daily Reports, because fuck it, really...

Each day at our company, developers are required to document their activities, painstakingly jotting down their daily work and future plans. A monotonous chore that I just really dislike.

So now, there's a scribe for that :

auto-dr-

Code

@lub0s
lub0s / tmux.md
Created November 8, 2022 22:05 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@lub0s
lub0s / compose_offsets.kt
Created April 15, 2022 11:42
Difference in recomposition when using offset modfier in Jetpack Compose
@HiltViewModel
class UpdatingViewModel @Inject constructor() : ViewModel() {
val offset = mutableStateOf(Offset(0f, 0f))
init {
viewModelScope.launch {
while(isActive) {
delay(50)
offset.value = offset.value.copy(x = offset.value.x + 1)
package com.tonal.trainer.anvilcompilers
import com.google.auto.service.AutoService
import com.squareup.anvil.annotations.ContributesTo
import com.squareup.anvil.compiler.api.AnvilContext
import com.squareup.anvil.compiler.api.CodeGenerator
import com.squareup.anvil.compiler.api.GeneratedFile
import com.squareup.anvil.compiler.api.createGeneratedFile
import com.squareup.anvil.compiler.internal.asClassName
import com.squareup.anvil.compiler.internal.buildFile
@lub0s
lub0s / vector_color_path.kt
Created February 21, 2022 13:02
Coloring vector paths by name in the jetpack compose
fun ImageVector.colorPath(pathName: String, color: Color): ImageVector {
val path = root.findPath(pathName)
val f = VectorPath::class.java.getDeclaredField("fill")
f.isAccessible = true
f.set(path, SolidColor(color))
return this
}
@lub0s
lub0s / fast_extensions.kt
Created February 11, 2022 10:53
Fast variants of List extensions for Kotlin
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
@OptIn(ExperimentalContracts::class)
internal inline fun <T> List<T>.fastForEach(action: (T) -> Unit) {
contract { callsInPlace(action) }
for (index in indices) {
val item = get(index)
action(item)
}
@lub0s
lub0s / compose_color_shaddows.kt
Created January 22, 2022 21:20
Color shadows hack by translating background
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface