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
// Run with: | |
// kotlinc -script script.main.kts | |
@file:Repository("https://jcenter.bintray.com") | |
@file:DependsOn("io.uniflow:uniflow-core:0.11.6") | |
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5") | |
import io.uniflow.core.flow.* | |
import io.uniflow.core.flow.data.UIEvent | |
import io.uniflow.core.flow.data.UIState |
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 setup = """ | |
ℹ️ SETUP | |
Set up the Age I cards like in a normal game, but sit so you're facing the first row of cards in the structure. | |
The zone to the left of the card structure is your City. The zone to the right of the structure is the Leader's City. Begin the game by giving 7 coins to yourself and none to the Leader. | |
Shuffle all the Wonder cards and draw 3. Choose 2 of these cards for yourself and give the third to the Leader. | |
Do this a second time. You will therefore start with 4 Wonder cards in your city and 2 in the Leader's City. | |
The Leader's 2 Wonder cards are treated as if already constructed. Immediately apply the following effects if they are on the Leader's Wonders: |
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.CoroutineExceptionHandler | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.SupervisorJob | |
import kotlinx.coroutines.async | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.runBlocking | |
fun main() = |
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.example | |
import org.junit.Assert.assertEquals | |
import org.junit.Assert.assertThrows | |
import org.junit.Test | |
import org.junit.function.ThrowingRunnable | |
/** | |
* JUnit 4.13 test | |
*/ |
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 kotlin.math.PI | |
fun main() { | |
val shapes = listOf( | |
Square(1.0), | |
Square(2.0), | |
Circle(3.0) | |
) | |
val shapeVisitors = listOf( |
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.example | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.channels.BroadcastChannel | |
import kotlinx.coroutines.channels.Channel.Factory.CONFLATED | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.asFlow | |
import kotlinx.coroutines.flow.collect |
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.example | |
import androidx.fragment.app.FragmentActivity | |
import androidx.lifecycle.ViewModel | |
import org.junit.After | |
import org.junit.Assert.assertEquals | |
import org.junit.Before | |
import org.junit.Test | |
import org.junit.runner.RunWith | |
import org.koin.androidx.scope.currentScope |
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 kotlin.reflect.KFunction | |
typealias CartesianProduct = Set<List<*>> | |
/** | |
* Create the cartesian product of any number of sets of any size. Useful for parameterized tests | |
* to generate a large parameter space with little code. Note that any type information is lost, as | |
* the returned set contains list of any combination of types in the input set. | |
* | |
* @param a The first set. |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>ANSIBrightWhiteColor</key> | |
<data> | |
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS | |
AAGGoKMHCA9VJG51bGzTCQoLDA0OV05TV2hpdGVcTlNDb2xvclNwYWNlViRjbGFzc00w | |
LjUwMzc5NTU0NjQAEAOAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqIS | |
FFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FIUF1k |
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.example; | |
import com.google.common.collect.Lists; | |
import java.util.List; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
public class CopyOnWriteArrayListBehaviour { | |
// Change this to a regular ArrayList to see what different behaviour the CopyOnWriteArrayList has |
NewerOlder