Skip to content

Instantly share code, notes, and snippets.

/** Возвращает первые 7 чисел хеша текущего коммита */
def getGitHash() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
suspend fun <A, B> Collection<A>.parallelMap(
context: CoroutineContext = DefaultDispatcher,
block: suspend (A) -> B
): Collection<B> {
return map {
// Use async to start a coroutine for each item
async(context) {
block(it)
}
}.map {
private fun brain() {
print(1{
what()
1.olala()
this > 1
2 < { "t" }
3[""]["aa"] < {"3"}["g"]()()()["2"]
"as"
})
}