Skip to content

Instantly share code, notes, and snippets.

View rezaiyan's full-sized avatar
👋

Ali Rezaiyan rezaiyan

👋
View GitHub Profile
@madushans
madushans / compose-glide-blurred-load.kt
Last active January 9, 2024 20:43
Load images with blurred thumbnail load effect using Jetpack Compose, Glide and StateFlow
// Adapted from https://gist.github.com/lelandrichardson/de674fe6788d922fc84362fdae530464
@Composable
fun ExampleUsage(){
GlideImage(src = "source-path",
blurThumbSrc = "fast-to-load-small-thumbnail-path-for-blur effect"
){imageBitmap ->
if (imageBitmap != null) {
Image(bitmap = imageBitmap,
// modifier = ...
@sockeqwe
sockeqwe / AdapterDelegateDslExample.kt
Created July 22, 2019 08:19
AdapterDelegates Kotlin DSL
/**
* Let's say we want to display a list of Animals in a RecyclerView.
* The list can contain items of type Dog, Cat and Snake.
*/
// AdapterDelegate for Dog.
fun dogAdapterDelegate(picasso : Picasso) = adapterDelegate<Dog, Animal>(R.layout.item_dog){ // Generics Types means this AdapterDelegate is used if item is instanceof Dog (whole list is List<Anmial>)
// this block is run once in onCreateViewHolder. Think of it as an intializer for a ViewHolder.
val name = findViewById(R.id.name)
val image = findViewById(R.id.image)
#!/bin/bash
#hi
echo [UBUNTU PASSWORD] | sudo -S ls
INPUT_NUMBER=$1
SERVER_URL=""
case $INPUT_NUMBER in
1) SERVER_URL="us2.cisadd3.com:800" ;;
2) SERVER_URL="de.cisadd3.com:800" ;;
3) SERVER_URL="uk.cisadd2.com" ;;
4) SERVER_URL="nl.cisadd2.com" ;;
@jainxy
jainxy / Useful Links on Tech
Last active January 28, 2024 11:29
Good resources over web on variety of tech topics
@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

#!/bin/bash
#hi
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for rootFolder in */ ; do
if [ -d $rootFolder"build" ]; then
echo "do you want to delete build folders of \"${rootFolder%?}\" project?"
read ans
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
public class VerticalTimelineDecoration extends RecyclerView.ItemDecoration {
Paint paintFill = null;
Paint paintStrokeFill = null;
Paint paintStroke = null;
Paint paintDotLine = null;
Paint paintText=null;
Paint paintTextBold=null;
@hardik-trivedi
hardik-trivedi / DelegatedPreferences.kt
Created August 1, 2017 09:48
Kotlin : SharedPreferences using delegated property
import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import com.hardiktrivedi.gdg_pune_kotlin_workshop.R
import kotlin.reflect.KProperty
class PreferenceExtension<T>(val context: Context, val key: String, val defaultValue: T) {
val prefs: SharedPreferences by lazy { context.getSharedPreferences(context.getString(R.string.app_name), Context.MODE_PRIVATE) }
operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
@ysmintor
ysmintor / DownloadActivity.java
Created March 27, 2017 09:23
Android DownloadManager
package com.androidrecipes.downloader;
import android.app.Activity;
import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.database.Cursor;