attribute vec4 a_Position;
attribute vec2 a_TexCoordinate;
varying vec2 v_TexCoordinate;
void main()
{
v_TexCoordinate = a_TexCoordinate;
gl_Position = a_Position;
}
ChatGPT
This is a simple vertex shader written in GLSL (OpenGL Shading Language).
This file contains hidden or 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 'package:video_player/video_player.dart'; | |
class VideoQuestion extends StatefulWidget { | |
final String videoUrl; | |
VideoQuestion({Key? key, required this.videoUrl}) | |
: super(key: key); | |
@override | |
State<VideoQuestion> createState() => _VideoQuestionState(); |
This file contains hidden or 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.AppOpsManager.OnOpChangedListener | |
import android.content.Context | |
import android.os.Build | |
import android.os.Process | |
import androidx.core.content.getSystemService | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.channels.awaitClose | |
import kotlinx.coroutines.flow.Flow |
This file contains hidden or 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
fun main() { | |
var delta = -1 | |
val m = 3 | |
val offsets: List<Int> = (0..10).scan(0) { acc, _ -> | |
(acc + delta).also { | |
if (it == -m || it == m) { | |
delta = -delta | |
} | |
} |
This file contains hidden or 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
class MyEffectPreviewView : GLView { | |
constructor(context: Context?) : super(context) | |
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) | |
private var index = 0 | |
private var bitmaps: List<Bitmap> = emptyList() | |
override fun onGLDraw(canvas: ICanvasGL) { | |
val bitmaps = this.bitmaps | |
val index = this.index |
This file contains hidden or 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
// ----------------------------------------------------------------------------- Domain | |
interface HomeRepository { | |
suspend fun fetchData(): String | |
suspend fun syncData() | |
fun observeData(): Flow<String> | |
} | |
// -----------------------------------------------------------------------------Demo: Home screen UI | |
sealed interface HomeAction { | |
object FetchData : HomeAction |
This file contains hidden or 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 kotlinx.coroutines.flow.* | |
import kotlinx.coroutines.* | |
data class State(val isLoading: Boolean = false, val items: List<Int> = emptyList()) | |
sealed interface Reducer { | |
operator fun invoke(current: State): State | |
} | |
object LoadingReducer : Reducer { |
This file contains hidden or 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 kotlinx.coroutines.flow.* | |
import kotlinx.coroutines.* | |
data class State(val isLoading: Boolean = false, val items: List<Int> = emptyList()) | |
fun interface Reducer { | |
operator fun invoke(current: State): State | |
} | |
val loadingReducer = Reducer { it.copy(isLoading = true) } |
This file contains hidden or 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 kotlinx.coroutines.flow.* | |
import kotlinx.coroutines.* | |
data class State(val isLoading: Boolean = false, val items: List<Int> = emptyList()) | |
typealias Reducer = (current: State) -> State | |
val loadingReducer: Reducer = { it.copy(isLoading = true) } | |
val loadedReducer: Reducer = { it.copy(isLoading = false, items = listOf(1, 2, 3)) } |
This file contains hidden or 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
subprojects { | |
apply<KoverPlugin>() | |
afterEvaluate { | |
tasks.withType<Test> { | |
testLogging { | |
showExceptions = true | |
showCauses = true | |
showStackTraces = true | |
showStandardStreams = true |