Skip to content

Instantly share code, notes, and snippets.

View hrach's full-sized avatar

Jan Škrášek hrach

View GitHub Profile
@trvswgnr
trvswgnr / compress_video
Last active September 17, 2024 13:38
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@alexvanyo
alexvanyo / EdgeToEdgeAlertDialog.kt
Last active September 17, 2024 01:48
EdgeToEdgeDialogs
/*
* Copyright 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@NicolaVerbeeck
NicolaVerbeeck / EncryptedFileStorage.kt
Last active April 18, 2024 21:12
Encrypted file storage for data store
package com.a.b
import android.content.Context
import androidx.annotation.GuardedBy
import androidx.datastore.core.ReadScope
import androidx.datastore.core.Serializer
import androidx.datastore.core.Storage
import androidx.datastore.core.StorageConnection
import androidx.datastore.core.WriteScope
import androidx.datastore.core.use
@CanYumusak
CanYumusak / LabelLayoutModifier.kt
Last active July 29, 2024 07:13
LabelLayoutModifier which adjusts Android text placement to match Figma text placement
public class LabelLayoutModifier(
val context: Context,
val lineHeight: TextUnit,
val style: MyTextStyle,
) : LayoutModifier {
override fun MeasureScope.measure(
measurable: Measurable,
constraints: Constraints
): MeasureResult {
@Aidanvii7
Aidanvii7 / NavGraph.kt
Last active October 17, 2021 12:38
Navigate with Parcelable arguments in Jetpack Compose
composable(route = "screen_1") {
Button(
onClick = {
navController.navigate(
route = "screen_2",
args = parcelableArgs {
arg { MyParcelableArgument() }
arg("named") { MyParcelableArgument() }
},
)
import androidx.compose.animation.*
import androidx.compose.animation.core.tween
import androidx.compose.material.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.onCommit
import androidx.compose.ui.Modifier
@OptIn(ExperimentalAnimationApi::class, ExperimentalMaterialApi::class)
@Composable
fun <T> AnimatedSwipeDismiss(
Moved to https://google.github.io/accompanist/insets/
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@kokes
kokes / netflix-cs-audio.txt
Last active November 2, 2019 20:38
Filmy s českýma titulkama na Netflixu
Alexa & Katie
All or Nothing
Angel of the Lord 2
Another Life
Backstage
Barbie Dolphin Magic
Basketball or Nothing
Beats
Black Mirror
Captain Underpants: The First Epic Movie
@abdalin
abdalin / DividerItemDecorator.java
Created April 8, 2018 21:18
divider item decoration for recyclerview with space removed after last item
public class DividerItemDecorator extends ItemDecoration {
public static final int HORIZONTAL = LinearLayout.HORIZONTAL;
public static final int VERTICAL = LinearLayout.VERTICAL;
private Drawable mDivider;
private int mOrientation;
private final Rect mBounds = new Rect();
public DividerItemDecorator(Drawable divider, int orientation) {