Skip to content

Instantly share code, notes, and snippets.

Avatar

Yasuhiro SHIMIZU yshrsmz

View GitHub Profile
@yshrsmz
yshrsmz / LoggerTest.kt
Last active Jan 23, 2020
KMP logger comparison
View LoggerTest.kt
package com.codingfeline.loggertest
import com.github.aakira.napier.DebugAntilog
import com.github.aakira.napier.Napier
import ru.pocketbyte.kydra.log.KydraLog
import ru.pocketbyte.kydra.log.debug
import ru.pocketbyte.kydra.log.initDefault
import kotlin.native.concurrent.TransferMode
import kotlin.native.concurrent.Worker
import kotlin.test.Test
@yshrsmz
yshrsmz / HomeFragment.kt
Last active Jan 17, 2020
ViewBinding sample
View HomeFragment.kt
class HomeFragment: Fragment(R.layout.fragment_home) {
private val binding by viewBinding { FragmentHomeBinding.bind(it) }
// do not implement onCreateView!
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
binding.mainText.text = "Hello World!"
}
}
View AbstractStateNotifier.kt
abstract class AbstractStateNotifier<ACTION : Action, STATE : State, EFFECT : Effect, VM : MviViewModel<*, ACTION, STATE, EFFECT>>(
uiContext: CoroutineContext
) : CoroutineScope {
private val job = SupervisorJob()
override val coroutineContext: CoroutineContext = job + uiContext
fun stateChanged(vm: VM, state: (state: STATE) -> Unit): Job {
return launch { vm.states.collect { state(it) } }
View gist:3b2819a72fceb57beb76a40196c11cc2
Verifying my Blockstack ID is secured with the address 1HTj28w1QgzARDLpxBepDFEMb1fGc8kBtp https://explorer.blockstack.org/address/1HTj28w1QgzARDLpxBepDFEMb1fGc8kBtp
@yshrsmz
yshrsmz / schema.json
Created Apr 25, 2019
kibela api schema
View schema.json
{
"data": {
"__schema": {
"queryType": {
"name": "Query"
},
"mutationType": {
"name": "Mutation"
},
"subscriptionType": null,
View IntrospectionQuery.graphql
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
@yshrsmz
yshrsmz / IntrospectionQuery.gql
Last active Apr 22, 2019
GitHub GraphQL API schema
View IntrospectionQuery.gql
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
@yshrsmz
yshrsmz / 1_common.kt
Last active Apr 13, 2019
Multiplatform ViewModel
View 1_common.kt
expect abstract class ViewModel() {
open fun onCleared()
}
@yshrsmz
yshrsmz / 0_common.kt
Created Mar 4, 2019
SQLDelight Kotlin Multiplatform Project sample
View 0_common.kt
internal expect fun <B> backToFront(b: () -> B, job: (B) -> Unit)
View FreezedFunTest.kt
package com.codingfeline.sample
import co.touchlab.stately.concurrency.ThreadLocalRef
import co.touchlab.stately.concurrency.value
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Runnable
import platform.darwin.dispatch_async
import platform.darwin.dispatch_get_main_queue
import platform.darwin.dispatch_queue_t
import kotlin.coroutines.CoroutineContext