Skip to content

Instantly share code, notes, and snippets.

View ffgiraldez's full-sized avatar

Fernando Franco Gíraldez ffgiraldez

View GitHub Profile
public final class Result<S, F> {
private final Optional<S> success;
private final Optional<F> failure;
public Result(Optional<S> success, Optional<F> failure) {
this.success = success;
this.failure = failure;
}
@alphamu
alphamu / Android Privacy Policy Template
Created February 9, 2017 03:17
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
### Download Vysor App
https://play.google.com/store/apps/details?id=com.koushikdutta.vysor
- Execute Vysor on Phone
- Enable ADB Settings (Open Developer Options -> Back)
- Enable ADB Debugging
### Download ADB drivers & Install
https://adb.clockworkmod.com/
@pablisco
pablisco / Logger.kt
Last active May 17, 2018 10:35
Fluent Logging with Kotlin
inline fun <A> A.logWith(logger: Logger, block: Logger.(A) -> Unit) : A =
this.also { logger.block(it) }
// With interface injection
interface HasLog {
val log: Logger
fun <A> A.log(block: Logger.(A) -> Unit) : A =
logWith(logger, block)
}
@aballano
aballano / ThenRx.kt
Created November 16, 2018 09:09
Mockito & RxJava extensions to facilitate mocking
@JvmName("thenErrorObservable")
fun <T> OngoingStubbing<Observable<T>>.thenError(throwable: Throwable) {
thenReturn(Observable.error(throwable))
}
fun OngoingStubbing<Completable>.thenComplete() {
thenReturn(Completable.complete())
}
@JvmName("thenErrorCompletable")
@d4vidi
d4vidi / VolatileLiveData.kt
Last active June 14, 2020 23:26
A MutableLiveData variant that introduces a volatile behavior
package com.und0.vocabularymate.x.utils
import androidx.annotation.MainThread
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import java.util.concurrent.atomic.AtomicInteger
/**
* A [MutableLiveData] variant that introduces a _volatile_ behavior. Namely, it has no "memory" of values set
@cliffom
cliffom / egpu.md
Last active February 16, 2024 05:16
macOS + Win10/bootcamp eGPU Findings
@raulraja
raulraja / rules.kt
Created March 5, 2020 17:51
Validation rules abstracting strategies with operations as extension functions
package arrow.rules.test
import arrow.Kind
import arrow.core.Either
import arrow.core.EitherPartialOf
import arrow.core.Nel
import arrow.core.NonEmptyList
import arrow.core.Validated
import arrow.core.ValidatedPartialOf
import arrow.core.extensions.either.applicativeError.applicativeError
@arkivanov
arkivanov / DaggerParentChildExample.kt
Created October 14, 2020 15:50
Dagger parent-child example
// Deps
interface Database
interface Network
// Child
interface ChildRepository
class Child(dependencies: Dependencies) {