Skip to content

Instantly share code, notes, and snippets.

View travisdachi's full-sized avatar
🖖
Live long and prosper

Travis P travisdachi

🖖
Live long and prosper
View GitHub Profile
class SampleTest {
lateinit var driver: AppiumDriver<WebElement>
val platform = MobilePlatform.ANDROID
@Before
fun setup() {
if (platform == MobilePlatform.ANDROID) {
val dir = System.getProperty("user.dir")
val path = Paths.get(dir, "apps/hello-appium.apk")
class SampleTest {
lateinit var driver: AppiumDriver<WebElement>
val platform = MobilePlatform.IOS
@Before
fun setup() {
if (platform == MobilePlatform.ANDROID) {
val dir = System.getProperty("user.dir")
val path = Paths.get(dir, "apps/hello-appium.apk")
package net.appsynth.seven.domain
import io.reactivex.Completable
import io.reactivex.Observable
import net.appsynth.seven.models.promotion.PromotionData
object UseCase4
fun UseCase4.getPrepaid(): Observable<PromotionData> {
TODO()
/**
* Pros:
* Super simple
*
* Cons:
* You need to [UseCase1.toObservable] and [Observable.blockingFirst] to exit Rx world
*/
interface UseCase1<T> {
fun toObservable(): Observable<T>
}
package com.blacklenspub.android.playground;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class ListUtil {
public static <T> List<T> filter(Iterable<T> source, Predicate<T> predicate) {
return filterTo(source, new ArrayList<T>(), predicate);
package com.blacklenspub.android.playground;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class FilterableArrayList<T> extends ArrayList<T> {
public FilterableArrayList(Collection<? extends T> c) {
super(c);
public interface Predicate<T> {
Boolean check(T element);
}
/**
* Returns a list containing only elements matching the given [predicate].
*/
public inline fun <T> Iterable<T>.filter(predicate: (T) -> Boolean): List<T> {
return filterTo(ArrayList<T>(), predicate)
}
/**
* Appends all elements matching the given [predicate] to the given [destination].
*/
package com.example.android.testing.notes.notes
import com.example.android.testing.notes.data.Note
import com.example.android.testing.notes.data.NotesRepository
import com.nhaarman.mockito_kotlin.*
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.given
import org.jetbrains.spek.api.dsl.it
import org.jetbrains.spek.api.dsl.on
public class MainActivity extends AppCompatActivity {
StringAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
adapter = new StringAdapter(
Arrays.asList("Harry Potter", "Ron Weasley"),