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 Apple {} | |
class Banana {} | |
List<Apple> bag([List<Apple> apples]) => apples ?? <Banana>[]; | |
void main() { | |
// ok | |
final bag1 = bag([Apple()]); | |
print(bag1); |
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
object Rx { | |
fun <T> delayFlowable(delay: Long, timeUnit: TimeUnit, scheduler: Scheduler = Schedulers.computation(), | |
block: () -> Flowable<T>): Flowable<T> { | |
return Completable.timer(delay, timeUnit, scheduler).andThen(Flowable.defer { block() }) | |
} | |
fun <T> delayObservable(delay: Long, timeUnit: TimeUnit, scheduler: Scheduler = Schedulers.computation(), | |
block: () -> Observable<T>): Observable<T> { | |
return Completable.timer(delay, timeUnit, scheduler).andThen(Observable.defer { block() }) | |
} |
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
public class HelloWorldActivity | |
extends TiActivity<HelloWorldPresenter, HelloWorldView> | |
implements HelloWorldView { | |
private TextView mOutput; | |
@NonNull | |
@Override | |
public HelloWorldPresenter providePresenter() { | |
return new HelloWorldPresenter(); |
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
/** | |
* Maps the [Single] value [T] to a nullable type [R?] which will become [Maybe.empty] when `R == null`, | |
* otherwise [Maybe.just] | |
*/ | |
inline fun <T, R> Single<T>.mapNullable(crossinline mapper: (T) -> R?): Maybe<R> = this.flatMapMaybe { | |
val result = mapper(it) | |
if (result == null) Maybe.empty() else Maybe.just(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
/* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2014 Konstantin Mikheev sirstripy-at-gmail-com | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
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
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:2.1.0' | |
// NOTE: Do not place your application dependencies here; they belong | |
// in the individual module build.gradle files |
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
#!/bin/sh | |
# Check if 7zip is installed and install it if not | |
hash 7z 2>/dev/null || { | |
echo >&2 "7z is required to be installed"; | |
echo "I will install it for you"; | |
brew install p7zip; | |
} | |
# Read the commit sha |
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
public class ParcelableTest extends AndroidTestCase { | |
/** | |
* Parcels the given Parcelable, unparcels it and returns the unparceled value | |
* | |
* @param value the Parcelable to operate on | |
*/ | |
public static Parcelable parcelAndUnparcel(Parcelable value) { | |
Parcel parcel = Parcel.obtain(); | |
value.writeToParcel(parcel, 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 com.pascalwelsch.mockito; | |
import org.mockito.exceptions.base.MockitoException; | |
import org.mockito.exceptions.verification.ArgumentsAreDifferent; | |
import org.mockito.internal.debugging.LocationImpl; | |
import org.mockito.internal.junit.JUnitTool; | |
import org.mockito.internal.reporting.SmartPrinter; | |
import org.mockito.internal.verification.VerificationModeFactory; | |
import org.mockito.internal.verification.api.VerificationData; | |
import org.mockito.internal.verification.argumentmatching.ArgumentMatchingTool; |
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
dependencies { | |
compile "ThirtyInch:thirtyinch" | |
compile "ThirtyInch:thirtyinch-rx" | |
compile "ThirtyInch:thirtyinch-plugin" | |
testCompile "ThirtyInch:thirtyinch-test" | |
} |