This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.mrezanasirloo.ganjeh | |
| import android.util.SparseArray | |
| import androidx.activity.ComponentActivity | |
| import androidx.annotation.MainThread | |
| import androidx.fragment.app.Fragment | |
| import androidx.fragment.app.createViewModelLazy | |
| import androidx.lifecycle.LifecycleOwner | |
| import androidx.lifecycle.ViewModel | |
| import androidx.lifecycle.ViewModelLazy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is for ATV only | |
| alias adb-dev-options='adb shell am start -n com.android.tv.settings/.system.development.DevelopmentActivity' | |
| # For mobile use: | |
| #alias adb-dev-options='adb shell am start -n com.android.settings/.DevelopmentSettings' | |
| # Animations | |
| alias animations-off='adb shell settings put global animator_duration_scale 0' | |
| alias animations-slow='adb shell settings put global animator_duration_scale 10' | |
| alias animations-normal='adb shell settings put global animator_duration_scale 1' | |
| alias animations-fast='adb shell settings put global animator_duration_scale 0.5' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FileUtils { | |
| /** | |
| * @return The MIME type for the given file. | |
| */ | |
| public static String getMimeType(File file) { | |
| String extension = getExtension(file.getName()).toLowerCase(); | |
| if (!TextUtils.isEmpty(extension) && extension.length() > 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import androidx.paging.PageKeyedDataSource | |
| import kotlinx.coroutines.CoroutineScope | |
| import kotlinx.coroutines.Job | |
| import kotlinx.coroutines.launch | |
| import kotlin.coroutines.CoroutineContext | |
| abstract class CoroutinePageKeyedDataSource<K, V>(private val coroutineContext: CoroutineContext) : | |
| PageKeyedDataSource<K, V>() { | |
| private val job = Job() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SampleValidator( | |
| val balance: Long?, | |
| val amount: Long?, | |
| val acceptedTerms: Boolean? | |
| ) : Validator<SampleValidator> { | |
| override fun validate(): Validation<SampleValidator> { | |
| return when { | |
| balance ?: 0 <= 0 -> Validation.Invalid("بالانس شما کافی نیست") | |
| amount ?: 0 <= 0 -> Validation.Invalid("مبلغ وارد شده صحیح نیست") | |
| amount ?: 0 > balance ?: 0 -> Validation.Invalid("مبلغ وارد شده بیشتر از بالانس شماست") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BObserver<T> extends DisposableObserver<T> { | |
| private StateLiveData<T> liveData; | |
| public BObserver(StateLiveData<T> liveData) { | |
| this.liveData = liveData; | |
| } | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "log" | |
| "regexp" | |
| "github.com/dghubble/go-twitter/twitter" | |
| "github.com/dghubble/oauth1" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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" ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import kotlinx.coroutines.Dispatchers | |
| import kotlinx.coroutines.test.TestCoroutineDispatcher | |
| import kotlinx.coroutines.test.TestCoroutineScope | |
| import kotlinx.coroutines.test.resetMain | |
| import kotlinx.coroutines.test.setMain | |
| import org.junit.jupiter.api.extension.AfterAllCallback | |
| import org.junit.jupiter.api.extension.AfterEachCallback | |
| import org.junit.jupiter.api.extension.BeforeAllCallback | |
| import org.junit.jupiter.api.extension.ExtendWith | |
| import org.junit.jupiter.api.extension.ExtensionContext |