Skip to content

Instantly share code, notes, and snippets.

View ultra-taco's full-sized avatar
💭
hacking in progress..¯¯̿̿'̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\=(•̪̀●́)=o/̵͇̿̿/'̿̿ ̿ ̿̿

Anonymous ultra-taco

💭
hacking in progress..¯¯̿̿'̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\=(•̪̀●́)=o/̵͇̿̿/'̿̿ ̿ ̿̿
View GitHub Profile
@JvmStatic
fun getAllChildren(v: View, recursive: Boolean, ignoredElements: List<View>): ArrayList<View> {
if (v !is ViewGroup || v.childCount == 0) {
val r = ArrayList<View>()
r.add(v)
return r
} else {
val list = ArrayList<View>()
list.add(v)
val children = v.childCount
@ultra-taco
ultra-taco / gist:a9320c42008016b4947a7de342b1c67e
Last active May 21, 2019 14:50
Parallel coroutine extensions
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlin.coroutines.CoroutineContext
suspend fun <A, B> Collection<A>.parallelMap(
context: CoroutineContext = GlobalScope.coroutineContext,
block: suspend (A) -> B
) = map {
GlobalScope.async(context) { block(it) }