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 Main { | |
private static class ConsolePrinter implements Runnable { | |
private final String text = "my text"; | |
private ConsolePrinter(String text) { | |
this.text = text; | |
} | |
@Override |
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 validators = mapOf( | |
String::class to { s: String -> s != "123" }) | |
inline fun <vararg T, R> validate(vars: tuple<T>, action: (tuple<T>) -> R): R? = | |
if (vars.all { validators(it::class)(it) }) | |
action(vars) | |
else | |
null | |
get("/methor") { request, _ -> |
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
Observable.just(1) | |
.flatMap { digit -> | |
Observable.just("my digit is $digit") | |
} | |
.flatMap { string -> | |
Observable.just("awesome $string") | |
} | |
.subscribeOn(io()) | |
.observeOn(mainThread()) | |
.subscribe { string -> |
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 io.adev.fast_pet; | |
import android.os.Bundle; | |
import android.support.annotation.Nullable; | |
import android.support.v7.app.AppCompatActivity; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.ViewGroup; | |
import android.widget.TextView; |
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 io.adev.rxwrapper | |
import io.reactivex.Observable | |
import io.reactivex.Scheduler | |
import io.reactivex.schedulers.Schedulers | |
import java.lang.System.currentTimeMillis | |
abstract class CacheObservableFactory<T, in C>( | |
private val expireTime: Long = 2000, | |
workScheduler: Scheduler = Schedulers.io()) : ObservableFactory<T, C>(workScheduler) { |
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 Drawable.copy(context: Context) = run { | |
when (this) { | |
is BitmapDrawable -> { | |
BitmapDrawable(bitmap) | |
} | |
else -> { | |
null |
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 A(foo: Bar) |
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 main(args: Array<String>) { | |
val a = args[0].toDouble() | |
val b = args[1].toDouble() | |
val c = args[2].toDouble() | |
val r = println(x1(a, b, c)) | |
println(r) | |
} | |
// fun run(action: () -> Any): Any = <...> |
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 de.nielsfalk.playground.ktor.swagger.* | |
import entity.Magazine | |
import entity.Publisher | |
import entity.aggregate.ApplicationSettingsResponse | |
import exceptions.installExceptions | |
import io.ktor.application.Application | |
import io.ktor.application.call | |
import io.ktor.application.install | |
import io.ktor.content.resources |
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 doFrame(long frameTimeNanos, int frame) { | |
final long startNanos; | |
synchronized (mLock) { | |
if (!mFrameScheduled) { | |
return; // no work to do | |
} | |
if (DEBUG_JANK && mDebugPrintNextFrameTimeDelta) { | |
mDebugPrintNextFrameTimeDelta = false; | |
Log.d(TAG, "Frame time delta: " | |
+ ((frameTimeNanos - mLastFrameTimeNanos) * 0.000001f) + " ms"); |
OlderNewer