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 fr.francetv.francetvsport.arch.infrastructure.data.source.remote.pic | |
//Your task is to split the chocolate bar of given dimension n x m into small squares. | |
//Each square is of size 1x1 and unbreakable. Implement a function that will return minimum number of breaks needed. | |
// | |
//For example, if you are given a chocolate bar of size 2 x 1 you can split it to single squares in just one break, but for size 3 x 1 you must perform two breaks. | |
// | |
//If input data is invalid you should return 0 (as in no breaks are needed if we do not have any chocolate to split). Input will always be a non-negative integer. | |
fun breakChocolate(n: Int, m: Int): Int = if ((n in 0..1) && (m in 0..1)) { | |
0 |
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 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 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 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 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 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 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 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 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 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; |