Skip to content

Instantly share code, notes, and snippets.

@DHosseiny
DHosseiny / BasePreferencesDataSource.kt
Created February 23, 2020 12:43
Delegates for SharedPreferences(Copy paste usage) (Maybe add some other delegates for other types soon)
import android.content.SharedPreferences
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
abstract class BasePreferencesDataSource {
protected abstract val preferences : SharedPreferences
protected class StringPrefProperty(private val key: String) : ReadWriteProperty<BasePreferencesDataSource, String> {
@MRezaNasirloo
MRezaNasirloo / Ganjeh.kt
Last active October 9, 2021 13:17
Share ViewModels across LifecycleOwners
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
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);
@ftabashir
ftabashir / Git_SSL_Certificate_Error.txt
Last active August 30, 2017 06:49
this is a how to solve for this git problem: fatal: unable to access 'https://domain.com/path/to/git': SSL certificate problem: unable to get local issuer certificate. REFERENCE: to see original post visit here: https://stackoverflow.com/questions/11621768/how-can-i-make-git-accept-a-self-signed-certificate/26785963#26785963
SSL Certificate error:
- To permanently accept a specific certificate
1. Initial clone
- GIT_SSL_CAINFO=/path/to/cert.pem git clone https://repo.or.cz/org-mode.git
2. Ensure all future interactions with origin remote also work
- cd my-repo-directory
- git config http.sslCAInfo /etc/ssl/certs/rorcz_root_cert.pem
- To disable TLS/SSL verification for a single git command
git -c http.sslVerify=false clone https://domain.com/path/to/git
- To disable SSL verification for that singular repository
@jemshit
jemshit / proguard-rules.pro
Last active June 13, 2024 07:25
Proguard Rules for Android libraries
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
### RxJava, RxAndroid (https://gist.github.com/kosiara/487868792fbd3214f9c9)
-keep class rx.schedulers.Schedulers {
public static <methods>;