Skip to content

Instantly share code, notes, and snippets.

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

脉脉不得语 inferjay

🏠
Working from home
View GitHub Profile
@Kshitij09
Kshitij09 / ComposeAutoCompleteTextField.kt
Last active April 3, 2023 10:06
AutoCompleteTextView implemented in Jetpack Compose.
@Composable
fun AutoCompleteTextField(
initialText: String,
itemList: List<String>,
onQuery: (String) -> Unit,
onClearResults: () -> Unit,
modifier: Modifier = Modifier
) {
val (field, changeField) = savedInstanceState(saver = TextFieldValue.Saver) { TextFieldValue(text = initialText) }
LaunchedEffect(subject = field.text) {
@loloof64
loloof64 / DragAndDropWithAnimation.kt
Last active December 17, 2020 01:49
Drag and drop then animation for going back (Jetpack compose 1.0.0-alpha07) : Thank you Joost Klitsie for your help on the Slack channel :)
@Preview
@Composable
fun DragAndDropComponent() {
Column(modifier = Modifier.size(300.dp).background(Color.Red)) {
val x = animatedFloat(150f)
val y = animatedFloat(150f)
val bouncySpring = SpringSpec(
dampingRatio = DampingRatioMediumBouncy,
stiffness = StiffnessLow,
visibilityThreshold = DefaultDisplacementThreshold)
@cedrickring
cedrickring / ColoredShadow.kt
Last active April 18, 2024 10:29
Draw a colored shadow in Android Jetpack Compose
/*
Copyright 2020 Cedric Kring.
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
distributed under the License is distributed on an "AS IS" BASIS,
@Skrilltrax
Skrilltrax / ColorfulBorders.kt
Created October 31, 2020 08:24
A modifier that add colorful border around your composables
import androidx.compose.foundation.border
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
fun Modifier.colorfulBorders(width: Dp = 1.dp) = composed {
val red = (0..255).random()
val green = (0..255).random()
@pt2121
pt2121 / ExpandCollapseButton.kt
Last active December 22, 2023 11:28
Android Jetpack Compose caret animation
/*
* Copyright 2020 Prat Tana. All rights reserved.
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
@jifalops
jifalops / _README.md
Last active June 30, 2019 18:53
Headless Crostini quick setup script for Flutter, VS Code, Node/npm (via nvm), Firebase tools, and pip for Python3

Headless Crostini quick setup script for Flutter, VS Code, Node/npm (via nvm), Firebase tools, and pip for Python3

Modify lines 20 and 21 with your gist and token for the VS Code settings-sync extension.

The script adds a symbolic link to the ChromeOS Downloads folder at ~/Downloads. For it to work, share your Downloads folder with Linux by right-clicking it in the Files app.

WARNING

  • The script appends to the PATH environment variable each time it runs (at the end).
  • settings.json for VS Code will be overwritten if it exists! (The default settings are empty and it was easier to do it this way than to use jq.)
@pepasflo
pepasflo / .gitignore
Last active October 22, 2023 12:06
Scripts for encrypting / decrypting secrets (to prevent them from being accidentally checked into git)
secrets/
@oliveratgithub
oliveratgithub / emojis.json
Last active April 26, 2024 22:35
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family: woman, woman, girl, girl", "shortname": ":woman_woman_girl_girl:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F467", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family: woman, woman, girl, boy", "shortname": ":woman_woman_girl_boy:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family: woman, woman, boy, boy", "shortname": ":woman_woman_boy_boy:", "unicode": "1F469 200D 1F469 200D 1F466 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family: man, woman, girl, girl", "shortname": ":man_woman_girl_girl:", "unicode": "1F468 200D 1F469 200D 1F467 200D 1F467", "html": "&#128104;&zwj;&#128105;&z
@oasisfeng
oasisfeng / Hack.java
Last active April 6, 2023 04:54
Reflection helper for hacking non-public APIs.
package com.oasisfeng.hack;
import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import java.io.IOException;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
@tasomaniac
tasomaniac / screenrecord.sh
Last active June 28, 2022 22:05 — forked from PaulKinlan/getdeviceart.sh
Screen Record for Android
#!/bin/sh
set -e
if [ -z "$1" ]; then
shot_path=$(date +%Y-%m-%d-%H-%M-%S).mp4
else
shot_path="$*"
fi