Skip to content

Instantly share code, notes, and snippets.

Christian Passold Chrispassold

Block or report user

Report or block Chrispassold

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@luisfelipeas5
luisfelipeas5 / SonarQubeREADME.md
Last active Oct 31, 2019
Um guia para configurar o básico do SonarQube + Jacoco
View SonarQubeREADME.md

Adicione o plugin do SonarQube

Primeiro, adicione ao build.gradle de nível de projeto:

buildscript {
   repositories {
       //...
       maven {
           url "https://plugins.gradle.org/m2/"
       }
View a-ktools.md

ktools

Kotlin Tools for Android ViewModel, LiveData, Data Binding, Dependency injection, Async operations, Repository pattern, Retrofit, Form Validation, Cloud Firestore, etc.

@OmkarAmberkar
OmkarAmberkar / NetworkBoundResource.kt
Last active Jan 21, 2020
NetworkBoundResource with RxJava and Kotlin sealed classes
View NetworkBoundResource.kt
abstract class NetworkBoundResource<ResultType, RequestType>(context: Context) {
private val result: Flowable<Resource<ResultType>>
init {
// Lazy disk observable.
val diskObservable = Flowable.defer {
loadFromDb()
// Read from disk on Computation Scheduler
.subscribeOn(Schedulers.computation())
@arekolek
arekolek / LiveDataReactiveStreamsActivity.kt
Last active Jan 30, 2020
Using LiveDataReactiveStreams to handle lifecycle and threading while computing list diff for recycler view
View LiveDataReactiveStreamsActivity.kt
package com.github.arekolek.diffutil
import android.arch.lifecycle.*
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.util.DiffUtil
import android.support.v7.widget.RecyclerView
import android.util.Log
import android.view.LayoutInflater
import android.view.View
@maiconhellmann
maiconhellmann / UnsafeHttpClient.kt
Created Nov 21, 2017
UnsafeHttpClient wrote in Kotlin
View UnsafeHttpClient.kt
import okhttp3.OkHttpClient
import java.security.cert.CertificateException
import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
class UnsafeOkHttpClient {
companion object {
fun getUnsafeOkHttpClient(): OkHttpClient.Builder {
try {
@karthiks
karthiks / NotificationUtils.java
Last active Aug 22, 2018
Create NotificationChannel object per Channel, with the desired options
View NotificationUtils.java
public class NotificationUtils extends ContextWrapper {
public static final String ANDROID_CHANNEL_ID = "com.androidstuff.tutsplustalerts.ANDROID";
public static final String IOS_CHANNEL_ID = "com.androidstuff.tutsplustalerts.IOS";
public static final String ANDROID_CHANNEL_NAME = "ANDROID CHANNEL";
public static final String IOS_CHANNEL_NAME = "IOS CHANNEL";
private NotificationManager notificationManager;
//..
public NotificationUtils(Context base) {
@tinmegali
tinmegali / LiveData.ext.kt
Created Jul 14, 2017
Kotlin extension to allow Unit tests on Android LiveData
View LiveData.ext.kt
package com.tinmegali.daggerwithkotlin.room
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.Observer
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
// Extension to allow unit tests on LiveData
// discussion on: https://stackoverflow.com/questions/44270688/unit-testing-room-and-livedata
@Jeevuz
Jeevuz / Extensions.kt
Last active Mar 27, 2020
Here I collect some of my most useful Kotlin extensions
View Extensions.kt
inline fun SharedPreferences.edit(changes: SharedPreferences.Editor.() -> SharedPreferences.Editor) {
edit().changes().apply()
}
fun ImageView.tintSrc(@ColorRes colorRes: Int) {
val drawable = DrawableCompat.wrap(drawable)
DrawableCompat.setTint(drawable, ContextCompat.getColor(context, colorRes))
setImageDrawable(drawable)
if (drawable is TintAwareDrawable) invalidate() // Because in this case setImageDrawable will not call invalidate()
}
@sheharyarn
sheharyarn / RVEmptyObserver.java
Created May 13, 2017
Set Empty Layout for RecyclerViews in Android
View RVEmptyObserver.java
/**
* Custom implementation of AdapterDataObserver to show empty layouts
* for RecyclerView when there's no data
*
* Usage:
*
* adapter.registerAdapterDataObserver(new RVEmptyObserver(recyclerView, emptyView));
*/
public class RVEmptyObserver extends RecyclerView.AdapterDataObserver {
private View emptyView;
@javilobo8
javilobo8 / download-file.js
Last active Mar 31, 2020
Download files with AJAX (axios)
View download-file.js
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
You can’t perform that action at this time.