This file contains 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 android.os.Parcel; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.mockito.invocation.InvocationOnMock; | |
import org.mockito.stubbing.Answer; | |
import static org.mockito.Matchers.anyInt; | |
import static org.mockito.Matchers.anyLong; | |
import static org.mockito.Matchers.anyString; | |
import static org.mockito.Mockito.doAnswer; |
This file contains 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
val CaptainCrunch = Lib("../android-common--lib-android-captain-crunch", "com.adevinta.android:captaincrunch" to ":captaincrunch") | |
val AndroidExtensions = Lib("../android-common--lib-android-extensions", "com.adevinta.android:android-extensions" to ":android-extensions") | |
val Barista = Lib("../Barista", "com.schibsted.spain:barista" to ":library") | |
val AbTestingRunner = Lib( | |
"../android-common--lib-abtesting-runner", | |
"com.adevinta.android:abtesting" to ":abtesting", | |
"com.adevinta.android:abtesting-apptimize" to ":abtesting-apptimize", | |
"com.adevinta.android:abtesting-optimizely" to ":abtesting-optimizely", | |
"com.adevinta.android:abtesting-debug" to ":abtesting-debug", | |
"com.adevinta.android:abtesting-debugdrawer" to ":abtesting-debugdrawer", |
This file contains 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
void main() async { | |
Stopwatch stopwatch = new Stopwatch()..start(); | |
var p1 = delay(Duration(seconds: 2)); | |
var p2 = delay(Duration(seconds: 4)); | |
await p1; | |
await p2; | |
print('Executed in ${stopwatch.elapsed}'); |
This file contains 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 FirebaseLiveData( | |
private val reference: DatabaseReference | |
) : LiveData<DataSnapshot>() { | |
private var eventListener: ValueEventListener? = null | |
override fun onActive() { | |
super.onActive() | |
logd("onActive $reference") | |
eventListener = reference.addValueEventListener(FValueEventListener( |
This file contains 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 com.google.firebase.perf.FirebasePerformance | |
object FirebasePerformanceWrapper { | |
fun <T> trace(name: String, block: () -> T): T { | |
val trace = runCatching { FirebasePerformance.getInstance().newTrace(name) }.getOrNull() | |
trace?.start() | |
val result = block() | |
trace?.stop() | |
return result |
This file contains 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
/* | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
WARNING!!! | |
NO, SERIOUSLY. REAL WARNING!!! | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
This file contains 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 java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
class SyncAsync { | |
public static void main(String[] args) { | |
for (int i = 0; i < 10; i++) { | |
new Thread(() -> { |
This file contains 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
fun Query.observeLiveData(): FirestoreQueryLiveData { | |
return FirestoreQueryLiveData(this) | |
} | |
fun DocumentReference.observeLiveData(): FirestoreDocumentLiveData { | |
return FirestoreDocumentLiveData(this) | |
} | |
class FirestoreQueryLiveData( |
This file contains 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
git log --after={2019-06-01} --pretty=format: --name-only | sort | uniq -c | sort -rg | grep "\.java" | head -10 |
This file contains 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.sloydev.macookbuk.infrastructure.extensions | |
import android.arch.lifecycle.* | |
fun <T, R> LiveData<T>.map(transformation: (T) -> R): LiveData<R> { | |
return Transformations.map(this, transformation) | |
} | |
fun <A, B, C> LiveData<A>.zipWith(other: LiveData<B>, zipFunc: (A, B) -> C): LiveData<C> { | |
return ZippedLiveData<A, B, C>(this, other, zipFunc) |
NewerOlder