Skip to content

Instantly share code, notes, and snippets.

View beigirad's full-sized avatar

Farhad Beigirad beigirad

View GitHub Profile
@kliphouse
kliphouse / IndefinitePagerIndicator.kt
Last active January 3, 2024 02:01
A horizontal pager indicator for compose that uses [PagerState](https://google.github.io/accompanist/pager/#pagerstate) (based on [IndefinitePagerIndicator](https://github.com/wching/Android-Indefinite-Pager-Indicator)
package com.rbrooks.indefinitepagerindicator
import android.view.animation.DecelerateInterpolator
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.ContentAlpha
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
@amal
amal / Tooltip.kt
Last active December 21, 2023 11:25
How to show a tooltip in AndroidX Jetpack Compose?
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
// Tooltip implementation for AndroidX Jetpack Compose
// See usage example in the next file
// Tested with Compose version **1.1.0-alpha06**
// Based on material DropdownMenu implementation.
import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.animation.core.animateFloat
@jbaranski
jbaranski / GradleTaskAlias.md
Created August 1, 2020 14:49
Alias a task name in Gradle

The following snippet is how to alias a task name in Gradle:

build.gradle

    // You can now run "gradle alias" and it would be equivalent to running "gradle taskToAlias"
    task alias {
        dependsOn allprojects.collect { proj ->
            proj.tasks.matching {
                it.name == 'taskToAlias'
 }
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active May 6, 2024 10:50
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@runo280
runo280 / 00readme.md
Last active September 29, 2020 11:36
Download script for C@ster.i0 free courses

How to use

1- Install requirements

This command is for Ubuntu based distros

sudo apt install aria2 youtube-dl

2- Make [course_name].sh file excutable:

chmod +x [course_name].sh

public abstract class ResponseWithErrorHandling<R, E> implements Callback<ResponseBody> {
private Type responseType;
private Type errorType;
public abstract void onResponseRequest(Call<ResponseBody> call, R response);
public abstract void onErrorRequest(Call<ResponseBody> call, E error);
public abstract void onFailureRequest(Call<ResponseBody> call, Throwable error);
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools
defaultConfig {
applicationId "samples.linhtruong.com.ui_reactive_rxjava_realm"
minSdkVersion versions.minSdk
@BenDLH
BenDLH / CenteredTitleToolbar.java
Last active November 18, 2020 08:14
The Joy of Custom Views: How to make a centered title Toolbar in Android
//
// CenteredTitleToolbar
//
// Created by Ben De La Haye on 25/05/2016.
//
public class CenteredTitleToolbar extends Toolbar {
private TextView _titleTextView;
private int _screenWidth;
private boolean _centerTitle = true;
@milaptank
milaptank / build.gradle
Created April 15, 2016 13:26 — forked from ok3141/build.gradle
Gradle obfuscate string
apply from: "$rootDir/utils.gradle"
android {
defaultConfig {
buildConfigField 'String', 'SECRET_KEY', toJavaCodeString(SECRET_KEY)
}
}
@Iman
Iman / clean.sh
Last active April 15, 2024 16:50
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs