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
| #!/bin/zsh | |
| for i in */.git; | |
| do ( echo $i; cd $i/..; git pull; git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done ); | |
| done |
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
| package com.trendyol.inventorycenterapi.helper | |
| import com.trendyol.inventorycenterapi.domain.inventory.CurrencyCode | |
| import java.lang.reflect.* | |
| import java.time.Instant | |
| import kotlin.random.Random | |
| import kotlin.reflect.full.createType | |
| import kotlin.reflect.KClass | |
| import kotlin.reflect.KType | |
| import kotlin.reflect.KTypeProjection |
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
| namespace StockDomain | |
| { | |
| class Stock // aggregate root = nosql doc optimistic lock etc. | |
| { | |
| /* | |
| * | |
| * noSql document like this | |
| * { |
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 json(init: Json.() -> Unit): Json { | |
| val json = Json() | |
| json.init() | |
| return json | |
| } | |
| open class Json { | |
| private val entries: LinkedHashMap<String, Any> = linkedMapOf() | |
| infix fun String.to(value: Any): Unit { |
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(){ | |
| launch(Dispatchers.IO) { | |
| val user = api.fetchUserInfoAsync(id).await() | |
| withContext(Dispatchers.Default) { | |
| val hash = user.username.hash() | |
| } | |
| } | |
| } | |
| fun String.md5(): String { |
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 concurrencyTest(){ | |
| val time1 = measureTimeMillis { | |
| runBlocking { | |
| val listOfDeferred: List<Deferred<Int>> = (1..50).map { i -> | |
| async { | |
| delay(100) | |
| Int.MIN_VALUE | |
| } | |
| } | |
| } |
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() = runBlocking { | |
| GlobalScope.launch { | |
| delay(1000L) | |
| print("World!") | |
| } | |
| print("Hello") | |
| } |
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() { | |
| runBlocking { | |
| val deferred1 = async { operation1() } | |
| val deferred2 = async { operation2() } | |
| println("[${(SimpleDateFormat("hh:mm:ss")).format(Date())}] Awaiting computations...") | |
| val result = deferred1.await() + deferred2.await() | |
| println("[${(SimpleDateFormat("hh:mm:ss")).format(Date())}] The result is $result") | |
| } | |
| } |
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() { | |
| runBlocking { | |
| val deferred1 = async { operation1() } | |
| val deferred2 = async { operation2() } | |
| println("[${(SimpleDateFormat("hh:mm:ss")).format(Date())}] Awaiting computations...") | |
| val result = deferred1.await() + deferred2.await() | |
| println("[${(SimpleDateFormat("hh:mm:ss")).format(Date())}] The result is $result") | |
| } | |
| } |
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
| suspend fun doOperation1() { | |
| delay(1000L) | |
| } | |
| suspend fun getSomeResult(): String { | |
| delay(2000L) | |
| return "hello" | |
| } | |
| fun main(){ |
NewerOlder