TwoClocks
if( someProp.returnType == Double::class )
Double
oday
tylerwilson
Justin
Alex Askerov
Nick Kleban
.gradle/caches/
Peter
HTMX
kotlinx-html
filter
fun createInnerUL(block: UL.() -> Unit): String { var first = true return createHTML().filter { if (first && it.tagName == "ul") { first = false SKIP } else { PASS } }.ul { block() } }
val a = createInnerUL { li { +"one" } li { +"two" } li { ul { li { +"two-a" } } } }
println(a) <li>one</li> <li>two</li> <li> <ul> <li>two-a</li> </ul> </li>
Louis
Pablo
fun <T> debounce( delayMillis: Long = 300L, scope: CoroutineScope, action: (T) -> Unit ): (T) -> Unit { var debounceJob: Job? = null return { param: T -> if (debounceJob == null) { debounceJob = scope.launch { action(param) delay(delayMillis) debounceJob = null } } } }
fun setDebounceListener(view: Button, onClickListener: View.OnClickListener) { val clickWithDebounce: (view: View) -> Unit = debounce(scope = MainScope()) { onClickListener.onClick(it) } view.setOnClickListener(clickWithDebounce) }
deviant
A modern programming language that makes developers happier.