This file contains hidden or 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 fr.francetv.francetvsport.arch.infrastructure.data.source.remote.pic | |
//You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters. | |
fun getMiddle(word: String): String { | |
val middleIndex = word.length / 2 | |
return if (word.length.isEven()) { | |
word.substring((middleIndex - 1)..middleIndex) | |
} else { | |
word[middleIndex].toString() | |
} |
This file contains hidden or 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 fr.francetv.francetvsport.arch.presentation.main.navigations | |
import java.io.IOException | |
import java.util.* | |
import java.util.stream.Collectors | |
object GroupByDemoInJava8 { | |
@Throws(IOException::class) | |
@JvmStatic |
This file contains hidden or 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 fr.francetv.francetvsport.arch.presentation.base | |
import android.view.View | |
import android.widget.Toast | |
class DebouncingOnClickListener( | |
private val intervalMillis: Long, | |
private val doClick: ((View) -> Unit) | |
) : View.OnClickListener { | |
private var enabled = true |
This file contains hidden or 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
@RequiresApi(Build.VERSION_CODES.P) | |
fun StrictMode.VmPolicy.Builder.detectAllExpect(ignoredViolationPackageName: String, justVerbose: Boolean = true): StrictMode.VmPolicy.Builder { | |
return detectAll() | |
.penaltyListener(Executors.newSingleThreadExecutor(), StrictMode.OnVmViolationListener | |
{ | |
it.filter(ignoredViolationPackageName, justVerbose) | |
}) | |
} |
This file contains hidden or 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 io.reactivex.Observable | |
import io.reactivex.subjects.PublishSubject | |
import java.util.* | |
fun main(args: Array<String>) { | |
val vm = VM(Repo()) | |
vm.observableData.subscribe { | |
println("from sub1 $it") | |
} | |
Thread.sleep(3333) |
This file contains hidden or 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.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.support.v4.util.ArrayMap; | |
import java.io.IOException; | |
import java.util.Collections; | |
import java.util.Map; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; |
This file contains hidden or 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.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.support.v4.util.ArrayMap; | |
import java.io.IOException; | |
import java.util.Collections; | |
import java.util.Map; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; |
This file contains hidden or 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.example.hzaier.myapplicationkt.dsl | |
import org.junit.Test | |
interface Matcher<T> { | |
fun test(lhs: T) | |
infix fun or(other: Matcher<T>): Matcher<T> = object : Matcher<T> { | |
override fun test(lhs: T) { |
This file contains hidden or 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 qa.com.espressospoonstructure.tests; | |
import org.junit.Test; | |
import qa.com.espressospoonstructure.screenObjects.LoginScreen; | |
import static android.support.test.espresso.assertion.ViewAssertions.matches; | |
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; | |
public class TestLoginScreen extends BaseTestCase<MainActivity> { |
This file contains hidden or 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 qa.com.espressospoonstructure.screenObjects; | |
import android.support.test.espresso.ViewInteraction; | |
import org.hamcrest.Matcher; | |
import static android.support.test.espresso.Espresso.onView; | |
import static android.support.test.espresso.action.ViewActions.clearText; | |
import static android.support.test.espresso.action.ViewActions.click; | |
import static android.support.test.espresso.action.ViewActions.scrollTo; |