Skip to content

Instantly share code, notes, and snippets.

View wizmea's full-sized avatar

Arcadius TCHOKPODO wizmea

View GitHub Profile
@wizmea
wizmea / BaseRecyclerViewAdapter.kt
Last active August 30, 2018 12:18
Base Template for RecyclerView with it own adapter with databinding
class BaseRecyclerViewAdapter<BIND: ViewDataBinding>(val ressource: Int,val variableId: Int) : RecyclerView.Adapter<BaseRecyclerViewAdapter<BIND>.Holder>() {
private var layoutInflater: LayoutInflater? = null
private var items: MutableList<Any> = ArrayList()
private lateinit var callback: (data: Any) -> Unit
constructor(ressource: Int,variableId: Int,items: MutableList<Any>) : this(ressource, variableId){
this.items = items
}
@wizmea
wizmea / Downloader.kt
Created August 28, 2018 10:42
Download any file with retrofit rxjava and okio
interface ApiService {
@GET("api/apk-download/5b84691a312bdc094694cada")
fun download(@Query("access-token") token: String): Observable<Response<ResponseBody>>
}
//initialize api service with retrofit
fun download(service: ApiService,id: String) {
service.download(id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@luizwbr
luizwbr / nodejs_java_encrypt_decrypt_128.js
Last active October 22, 2024 05:01
Encrypt and Decrypt using 128 for Nodejs or Javascript that actually works
// None of the tutorals could help me, so I adapted a few codes.
// What I really want is make a full duplex way between NodeJS and Java, using encrypt/decrypt with AES 128 bit
// 1 - you must have to generate the key
openssl enc -aes-128-cbc -k secret -P -md sha1
// key examples:
// DCDD74627CD60252E35DFBA91A4556AA
// 2CB24CFDB3F2520A5809EB4851168162
// 468CA14CA44C82B8264F61D42E0E9FA1
@wizmea
wizmea / App.java
Created September 5, 2017 09:45
Handle all android app exception
public class App extends Application {
// Called when the application is starting, before any other application objects have been created.
// Overriding this method is totally optional!
@Override
public void onCreate() {
super.onCreate();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread paramThread, Throwable paramThrowable) {
Log.e("Error"+Thread.currentThread().getStackTrace()[2],paramThrowable.getLocalizedMessage());
}