Skip to content

Instantly share code, notes, and snippets.

@SEAbdulbasit
SEAbdulbasit / Moving Gradient
Last active December 6, 2024 04:31
Moving Mesh Gradient
@Composable
fun FluidMeshGradient(
modifier: Modifier = Modifier
) {
val infiniteTransition = rememberInfiniteTransition(label = "gradient")
// Angle animations for smoother movement
val angle1 = infiniteTransition.animateFloat(
initialValue = 0f,
@luca992
luca992 / s3.kt
Last active April 15, 2025 18:28
Kotlin Multiplatform S3 Request
import io.ktor.client.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
import okio.ByteString.Companion.encodeUtf8
@trd86
trd86 / mouse-tap-sample.c
Last active February 19, 2025 03:42
Tap Dance and Mouse Key. You can define the hold to be CMD or layer.
#define ACTION_TAP_DANCE_MOUSE_LAYER(kc1, layer) \
{ .fn = {mousekey_tap, mousekey_finished, mousekey_reset}, .user_data = (void *)&((qk_tap_dance_pair_t){kc1, layer}), }
// Tap Dance declarations
enum {
TD_MB_CMD,
TD_MB_L1,
TD_RMB_L2
};
@willyrh495
willyrh495 / EncryptionAES.kt
Created June 17, 2020 03:43
AES encryption using AndroidKeyStore
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import java.security.*
import javax.crypto.*
import javax.crypto.spec.GCMParameterSpec
import android.util.Base64
import androidx.annotation.VisibleForTesting
class EncryptionAES {
@yashaka
yashaka / how-to-add-markdown-to-tilda-page-ru.md
Last active April 8, 2025 13:59
Как добавить markdown в tilda

Как добавить markdown в tilda

Базовой функционал

1 В head страницы добавляем:

<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2/webcomponents-loader.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@1/src/zero-md.min.js"></script>
@humblehacker
humblehacker / mutablelivedata.md
Last active October 4, 2024 19:17
Don't expose MutableLiveData
@florina-muntenescu
florina-muntenescu / Data.kt
Last active February 19, 2025 14:28
Using RoomDatabase#Callback to pre-populate the database - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@swankjesse
swankjesse / HostSelectionInterceptor.java
Last active May 17, 2024 19:11
This OkHttp application interceptor will replace the destination hostname in the request URL.
import java.io.IOException;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
/** An interceptor that allows runtime changes to the URL hostname. */
public final class HostSelectionInterceptor implements Interceptor {
private volatile String host;
@TWiStErRob
TWiStErRob / OkHttpProgressGlideModule.java
Last active July 1, 2024 09:15
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}