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
#!/usr/bin/env tnode | |
import { execSync } from "child_process"; | |
import fs from "fs"; | |
import WebSocket from "ws"; | |
const WINDOW_SIZE_MS = 50; | |
const SAMPLE_RATE = 16000; | |
const BYTES_PER_SAMPLE = 2; | |
const API_KEY = ""; |
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
> Task :testAll | |
2021-12-20 22:11:48.627 [Thread-22] INFO TestDatabasesManagerKt - Worker is shutting down, finishing cleanups. | |
Kotlin build report is written to /Users/achraf/health/server/build/reports/kotlin-build/server-build-2021-12-20-22-09-07.txt | |
Task timings: | |
48666ms :testAll | |
21136ms :jooq:generated:compileKotlin | |
6622ms :graphql:generated:compileKotlin | |
5377ms :features:story:impl:compileTestKotlin | |
3709ms :jooq:generated:generateJooq |
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
/** | |
* Will emit all values from Flow<T1>, plus those from Flow<T2> after transformation giving the latest from Flow<T1>. | |
* | |
*/ | |
fun <T1, T2> Flow<T1>.alterOn(other: Flow<T2>, transform: suspend (a: T1, b: T2) -> T1): Flow<T1> = channelFlow { | |
coroutineScope { | |
val thisLatestValue = AtomicReference<T1?>() | |
launch { | |
other.collect { t2 -> |
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
data class AA( | |
val a1: String, | |
val a2: BB, | |
val a3: Int, | |
) | |
data class BB( | |
val b1: CC, | |
val b2: Int, |
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 android.view.View | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.SupervisorJob | |
import kotlinx.coroutines.cancel | |
val View.viewCoroutineScope: CoroutineScope | |
get() { | |
var viewScope = getTag(R.id.viewCoroutineScope) as CoroutineScope? |
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 android.app.AppOpsManager | |
import android.app.AsyncNotedAppOp | |
import android.app.SyncNotedAppOp | |
import android.content.Context | |
import android.util.Log | |
import androidx.annotation.RequiresApi | |
@RequiresApi(30) | |
class AppOpsCallback(private val context: Context) : AppOpsManager.OnOpNotedCallback() { |
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 com.jakewharton.rxbinding2.view.clicks | |
… | |
viewModel.bind(follow_button.clicks().map{ ProfileUiEvent.Follow }) | |
… | |
viewModel.uiState.observe(this, ::showState) | |
viewModel.uiContent.observe(this, ::showContent) | |
… |
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
ProfileActivity.kt | |
import com.jakewharton.rxbinding2.view.clicks | |
... | |
viewModel.bind(follow_button.clicks().map{ ProfileUiEvent.Follow }) | |
… | |
viewModel.uiState.observe(this, ::showState) | |
viewModel.uiContent.observe(this, ::showContent) | |
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 aurelienribon.bodyeditor; | |
import com.badlogic.gdx.graphics.Color; | |
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; | |
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; | |
import com.badlogic.gdx.math.Matrix4; | |
import org.jbox2d.collision.WorldManifold; | |
import org.jbox2d.collision.shapes.ChainShape; | |
import org.jbox2d.collision.shapes.CircleShape; |