Skip to content

Instantly share code, notes, and snippets.

View racka98's full-sized avatar
🏠
Working from home

rackadev racka98

🏠
Working from home
View GitHub Profile
@eggbean
eggbean / add_vim_to_path.ps1
Last active September 24, 2024 01:42
PowerShell script to make a persistent symlink to Vim for Windows and add it to $PATH
# Jason Gomez - June 2024
# Problem 1: When installing Vim for Windows using winget it's not added
# to $PATH so it cannot easily be used from the command line.
# Problem 2: The path to the Vim executables keeps changing as the
# version number is part of the path.
# Solution: This script makes a persistent symlink to the latest installed
# version of Vim for Windows and adds it to $PATH. Re-run the
# script when a new version of Vim is installed.
# Get all Vim directories and sort them by version number
@LouisCAD
LouisCAD / ModalBottomSheet.kt
Last active November 20, 2023 09:16
Put this in its own Gradle module to have ModalBottomSheet in Material3 (or even without Material Design at all).
package com.louiscad.splitties.eap.bottomsheet
import android.app.Activity
import android.view.ViewGroup
import androidx.activity.compose.BackHandler
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.ModalBottomSheetLayout
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
@OptIn(ExperimentalAnimationApi::class)
@Composable
fun CountDown(
count: Int?,
modifier: Modifier = Modifier,
) {
val transitionDuration = 500
val enterTransition = scaleIn(initialScale = 1.5f, animationSpec = tween(transitionDuration))
val exitTransition = scaleOut(targetScale = 4f, animationSpec = tween(transitionDuration)) + fadeOut(animationSpec = tween(transitionDuration))
AnimatedVisibility(
@surajsau
surajsau / ParallaxScreen.kt
Last active June 28, 2024 21:14
Parallax effect with Jetpack Compose
@Composable
fun ParallaxScreen(modifier: Modifier = Modifier) {
val context = LocalContext.current
val scope = rememberCoroutineScope()
var data by remember { mutableStateOf<SensorData?>(null) }
DisposableEffect(Unit) {
val dataManager = SensorDataManager(context)
dataManager.init()
/*
* Copyright 2020 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
@mihai-dinculescu
mihai-dinculescu / 01-build.rs
Last active September 4, 2024 17:48
ESP32-MQTT-Rust
// build.rs
use embuild::build::LinkArgs;
fn main() -> anyhow::Result<()> {
// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641
LinkArgs::output_propagated("ESP_IDF")?;
Ok(())
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group.contains('org.jetbrains.compose')) {
def groupName = details.requested.group.replace("org.jetbrains.compose", "androidx.compose")
details.useTarget(
[group: groupName, name: details.requested.name, version: details.requested.version]
)
}
}
}
@c5inco
c5inco / MaterialMotionTransitions.kt
Last active December 7, 2023 08:12
Reusable transitions that map to Material 2 motion system - https://material.io/develop/android/theming/motion
// Requires Compose 1.1.0-alpha02+
// Best used with navigation animation transitions in Accompanist 0.17.0+
import androidx.compose.animation.*
import androidx.compose.animation.core.FastOutLinearInEasing
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.tween
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.dp
@phhusson
phhusson / AppsOverADB.kt
Created February 2, 2021 21:33
Remote control apps running on a smartphone
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active November 19, 2024 11:06
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).