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
| object FakeApi { | |
| suspend fun fetchItems(): List<String> { | |
| // TODO use context swiching | |
| delay(1500) | |
| if ((1..10).random() < 5) { | |
| throw IOException("Network error: Failed to reach server") | |
| } | |
| return List(10) { i -> "Item #${(100..999).random()}" } | |
| } | |
| } |
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
| val formatter by safeThread { | |
| SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss:SSS'Z'", Locale.getDefault()) | |
| } | |
| fun main(): Unit = runBlocking { | |
| val time = "2024-01-24T22:58:54:322Z" | |
| launch { | |
| launch { | |
| withContext(Dispatchers.Default) { |
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
| sealed interface LoginAction { | |
| data object NavigateToTerm: LoginAction | |
| data object Login: LoginAction | |
| data object ShowDialog: LoginAction | |
| data object HideDialog: LoginAction | |
| } |
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
| :set number | |
| :set relativenumber | |
| :set tabstop=4 | |
| :set shiftwidth=4 | |
| :set autoindent | |
| :set smarttab | |
| :set softtabstop=4 | |
| :set mouse=a | |
| call plug#begin() |
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
| set number | |
| set relativenumber | |
| set tabstop=4 | |
| set shiftwidth=4 | |
| set autoindent | |
| set mouse=a |
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
| [*] | |
| charset = utf-8 | |
| end_of_line = crlf | |
| indent_size = 4 | |
| trim_trailing_whitespace = true | |
| insert_final_newline = true | |
| max_line_length = 100 | |
| ij_kotlin_imports_layout = *, android.*, androidx.*, com.*, java.*, javax.*, kotlin.*, kotlinx.*, $* | |
| # Tab indentation (no size specified) |
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
| import kotlin.math.pow | |
| fun main() { | |
| println("^" * 5) // "^^^^^" | |
| println(5 `^` 3) // 125.0 | |
| println(199 `%%` 24) // (24 * 199) / 100 = 47.76 | |
| println(5 / 2) // 2 | |
| println(5 `÷` 2) // 2.5 | |
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
| import Jumps.BREAK | |
| import Jumps.CONTINUE | |
| enum class Jumps { BREAK, CONTINUE } | |
| inline fun repeat(action: (index: Int) -> Any) { | |
| var counter = 0 | |
| loop@ while (true) { | |
| val result = action(counter) | |
| if (result == BREAK) break@loop |
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
| # Inserts a blank line between shell prompts | |
| add_newline = false | |
| # Disable the package module, hiding it from the prompt completely | |
| [package] | |
| disabled = true | |
| # Exec time | |
| command_timeout=5000 |
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() { | |
| println("asdf".isDigits) | |
| println("asdf1234".isDigits) | |
| println("123456".isDigits) | |
| val content: String? = null | |
| println(content.orEmpty()) | |
| String.print("hello") | |
| } |
NewerOlder