Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
@RestController | |
@RequestMapping("/requests") | |
class CoroutineNetworkRequestController { | |
private val url = "https://en.wikipedia.org/api/rest_v1/page/summary" | |
private val logger = LogManager.getLogger(CoroutineNetworkRequestController::class.java) | |
/** | |
* do request with async and awaitAll | |
*/ |
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.random.Random | |
fun main() { | |
while (true) { | |
val (result, expression) = calculate() | |
if (result == 10.0) { | |
println("${expression.removeSurrounding("(", ")")} = ${result.toInt()}") | |
break | |
} | |
} |
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.system.measureTimeMillis | |
const val GOAT = "goat" | |
const val CAR = "car" | |
const val OUT = "out" | |
val RANGE = (0..2) | |
/** | |
* put a car behind one door | |
*/ |
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
/** | |
* See [Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml) of IANA. | |
*/ | |
object MimeTypes { | |
enum class Application(val extensions: Array<String>, val mimeType: String) { | |
/** AbiWord document */ | |
ABI_WORD(arrayOf(".abw"), "application/x-abiword"), | |
/** Archive document (multiple files embedded) */ |