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
| class IosAppleAuthentication( | |
| private val supabase: SupabaseClient | |
| ) : AppleAuthentication { | |
| override suspend fun login() { | |
| val token = getToken() | |
| supabase.auth.signInWith(IDToken) { | |
| provider = Apple | |
| idToken = token | |
| } | |
| } |
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
| class IosGoogleAuthentication( | |
| private val supabaseClient: SupabaseClient, | |
| private val application: UIApplication | |
| ) : GoogleAuthentication { | |
| override suspend fun login() { | |
| val token = getToken() | |
| supabaseClient.auth.signInWith(IDToken) { | |
| provider = Google | |
| idToken = token | |
| } |
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 textSubject = PublishSubject.create<String>() | |
| val enterPressed = PublishSubject.create<String>() | |
| val debouncedInput = textSubject.debounce(500, TimeUnit.MILLISECONDS) | |
| .takeUntil(enterPressed) | |
| .repeat() | |
| val debounce = Observable.merge( | |
| debouncedInput.map { AnnotatedString(it, SpanStyle(Color.Red)) }, | |
| enterPressed.map { AnnotatedString(it, SpanStyle(Color.Blue)) } |
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
| /** | |
| * A utility class for managing a queue of suspended tasks (represented by Deferred objects) within | |
| * a given CoroutineScope. Tasks are executed in an ordered manner, and an "idle" callback can be | |
| * invoked when the queue becomes empty. | |
| * | |
| * @param coroutineScope The CoroutineScope in which tasks will be executed. | |
| * @param R The type of result produced by the tasks. | |
| */ | |
| class DeferredQueue<R>(private val coroutineScope: CoroutineScope) { |
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
| This is free and unencumbered software released into the public domain. | |
| Anyone is free to copy, modify, publish, use, compile, sell, or | |
| distribute this software, either in source code form or as a compiled | |
| binary, for any purpose, commercial or non-commercial, and by any | |
| means. | |
| In jurisdictions that recognize copyright laws, the author or authors | |
| of this software dedicate any and all copyright interest in the | |
| software to the public domain. We make this dedication for the benefit |
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() { | |
| val arr = ('a'..'z').shuffled().toTypedArray() | |
| var aPos = arr.indexOf('a') | |
| fun swapWithA(char: Char) { | |
| val charPos = arr.indexOf(char) | |
| arr[charPos] = 'a' | |
| arr[aPos] = char | |
| aPos = charPos |
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
| program QuickPlay; | |
| type | |
| states = (MAIN, PREFIGHT, POSTFIGHT, NONE); | |
| var | |
| cur: states; | |
| client: TSCARClient; | |
| w, h: Integer; | |
| prev_x, prev_y: Integer; |