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
@Composable fun App() { | |
DebugBounds { | |
Column(Modifier.background(Color.White).fillMaxSize()) { | |
BasicText("Some text") | |
Spacer(Modifier.size(10.dp)) | |
BasicText("More text") | |
Spacer(Modifier.size(5.dp)) | |
BasicText("Button", Modifier | |
.clickable { } | |
.background(Color.Blue, RoundedCornerShape(3.dp)) |
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.util.Log | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.currentComposer | |
import androidx.compose.runtime.remember | |
import androidx.compose.ui.unit.IntBounds | |
import androidx.ui.tooling.CallGroup | |
import androidx.ui.tooling.Group | |
import androidx.ui.tooling.NodeGroup | |
import androidx.ui.tooling.asTree |
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 androidx.animation.PhysicsBuilder | |
import androidx.animation.Spring.DampingRatioHighBouncy | |
import androidx.animation.Spring.StiffnessLow | |
import androidx.compose.Composable | |
import androidx.compose.Model | |
import androidx.compose.remember | |
import androidx.ui.animation.animate | |
import androidx.ui.core.DrawClipToBounds | |
import androidx.ui.core.Text | |
import androidx.ui.core.drawLayer |
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
interface Host { | |
suspend fun getMovies(): List<Movies> | |
suspend fun setWatched(movie: Movie): Boolean | |
close() | |
} | |
class HostImpl( | |
// You could have a different WorkerPool for each system you need to talk to | |
// that has its own throttling requirements. | |
private val workerPool: WorkerPool |
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 kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.Channel | |
import kotlin.coroutines.CoroutineContext | |
import kotlin.coroutines.coroutineContext | |
class DatabaseExecutor( | |
nWorkers: Int, | |
context: CoroutineContext | |
) { |
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
class CoroutineNamesTest { | |
@Test fun coroutineNames() { | |
runBlocking(CoroutineName("parent")) { | |
println("parent: $coroutineContext") | |
launch { | |
println("unnamed child: $coroutineContext") | |
} | |
launch(CoroutineName("named child")) { |
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 com.zachklipp.coroutines | |
import kotlinx.coroutines.experimental.DisposableHandle | |
import kotlinx.coroutines.experimental.intrinsics.startCoroutineCancellable | |
import kotlinx.coroutines.experimental.selects.SelectClause0 | |
import kotlinx.coroutines.experimental.selects.SelectClause1 | |
import kotlinx.coroutines.experimental.selects.SelectClause2 | |
import kotlinx.coroutines.experimental.selects.SelectInstance | |
/** |
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
#!/bin/zsh | |
if [ "$1" = '-h' ]; then | |
cat <<-EOF | |
Usage: git-edit <branch> [args-to-commit] | |
e.g. If your tree looks like this: | |
* cc3cd23 (HEAD -> feat1) Feature 1.2 | |
* 53f56c1 Feature 1 | |
* 08355e5 (master) Initial commit. |
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/local/bin/go run $0 "$@"; exit | |
/* | |
Terminal program that plays a sine wave. | |
The pitch and volume can be controlled (help is shown in the UI). | |
Installation: | |
go get github.com/gizak/termui |