Skip to content

Instantly share code, notes, and snippets.

💭
hacking in progress..¯¯̿̿'̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\=(•̪̀●́)=o/̵͇̿̿/'̿̿ ̿ ̿̿

Alex Doub alexdoub

💭
hacking in progress..¯¯̿̿'̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\=(•̪̀●́)=o/̵͇̿̿/'̿̿ ̿ ̿̿
View GitHub Profile
@alexdoub
alexdoub / gist:a9320c42008016b4947a7de342b1c67e
Last active May 21, 2019
Parallel coroutine extensions
View gist:a9320c42008016b4947a7de342b1c67e
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) }
View getAllChildren
@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
You can’t perform that action at this time.