View intersection.txt
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
fun runCmd( | |
cwd: File, | |
cmd: String | |
) = runCatching { | |
println("In cwd ${cwd.path}, Running cmd $cmd") | |
ProcessBuilder("\\s".toRegex().split(cmd)) | |
.directory(cwd) | |
.redirectOutput(ProcessBuilder.Redirect.PIPE) | |
.redirectError(ProcessBuilder.Redirect.PIPE) | |
.start() |
View build.gradle.kts
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
val outputFile = File("output.txt") | |
if(outputFile.exists() { | |
outputFile.delete() | |
} | |
afterEvaluate { | |
project.tasks.forEach { task -> | |
buildString { | |
appendLine("---------------") | |
appendLine("${task.name}") |
View print_permissions_from_androidmanifest.py
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
from xml.dom.minidom import parseString | |
# Documentation on Permissions in AndroidManifest.xml | |
# https://developer.android.com/guide/topics/manifest/manifest-intro#perms | |
data = '' # string data from file | |
with open('AndroidManifest.xml', 'r') as f: | |
data = f.read() | |
dom = parseString(data) # parse file contents to xml dom |
View InstallReferrerExt.kt
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.content.Context | |
import android.os.RemoteException | |
import com.android.installreferrer.api.InstallReferrerClient | |
import com.android.installreferrer.api.InstallReferrerStateListener | |
import com.android.installreferrer.api.ReferrerDetails | |
import kotlinx.coroutines.CompletableDeferred | |
/** | |
* https://developer.android.com/google/play/installreferrer/library | |
* |
View PokeballCompose.kt
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.compose.animation.core.Animatable | |
import androidx.compose.animation.core.LinearEasing | |
import androidx.compose.animation.core.tween | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.border | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.height | |
import androidx.compose.foundation.layout.padding |
View Actor.kt
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
/** | |
* JVM Implementation from KotlinX Coroutines | |
* https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/src/channels/Actor.kt#L31-L124 | |
*/ | |
@ObsoleteCoroutinesApi | |
public fun <E> CoroutineScope.actor( | |
context: CoroutineContext = EmptyCoroutineContext, | |
capacity: Int = 0, // todo: Maybe Channel.DEFAULT here? | |
start: CoroutineStart = CoroutineStart.DEFAULT, | |
onCompletion: CompletionHandler? = null, |
View Dropdown.kt
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 DropdownComposable(items: List<String> = listOf("A", "B", "C"), onClick: (String) -> Unit) { | |
var expanded by remember { mutableStateOf(false) } | |
var selectedIndex by remember { mutableStateOf(0) } | |
Box( | |
modifier = Modifier | |
.wrapContentSize(Alignment.TopStart) | |
) { | |
Text( | |
text = state.value.eventName, |
View MyLifecycleOwner.kt
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.os.Bundle | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleRegistry | |
import androidx.savedstate.SavedStateRegistry | |
import androidx.savedstate.SavedStateRegistryController | |
import androidx.savedstate.SavedStateRegistryOwner | |
internal class MyLifecycleOwner : SavedStateRegistryOwner { | |
private var mLifecycleRegistry: LifecycleRegistry = LifecycleRegistry(this) | |
private var mSavedStateRegistryController: SavedStateRegistryController = SavedStateRegistryController.create(this) |
View ImmutableDataWithMutableStateFlowTest.kt
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.handstandsam.mutablestateflow | |
import kotlinx.coroutines.flow.MutableStateFlow | |
import kotlinx.coroutines.test.runBlockingTest | |
import org.junit.Test | |
class UseImmutableDataWithMutableStateFlow { | |
data class SomePojo(var name: String = "placeholder") |
View a_Classes.kt
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
/** Whether the Oven command was successful, or something happened */ | |
sealed class OvenResult { | |
object Success : OvenResult() | |
data class Failure(val e: Exception) : OvenResult() | |
} | |
/** Class we will use Mockito to Mock */ | |
class Oven { | |
fun setTemperatureFahrenheit(tempF: Int) { | |
TODO("Implementation Goes Here") |
NewerOlder