Skip to content

Instantly share code, notes, and snippets.

View yshrsmz's full-sized avatar

Yasuhiro SHIMIZU yshrsmz

View GitHub Profile

turns out we simply use nitro.devProxy.

At first hostRewrite option seems to rewrite request header, but it actually rewrites host field of the response header. So we need to manually pass headers option.

https://github.com/http-party/node-http-proxy

const endpoint = 'https://api.example.com/graphql'
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
@yshrsmz
yshrsmz / build.gradle
Created May 6, 2022 15:37
Gradle plugins
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
// https://github.com/Kotlin/kotlinx.atomicfu/issues/56
classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.17.2"
}
@yshrsmz
yshrsmz / LoggerTest.kt
Last active January 23, 2020 02:35
KMP logger comparison
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 January 17, 2020 02:51
ViewBinding sample
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!"
}
}
@yshrsmz
yshrsmz / AbstractStateNotifier.kt
Created December 5, 2019 02:57
AbstractStateNotifier
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) } }
Verifying my Blockstack ID is secured with the address 1HTj28w1QgzARDLpxBepDFEMb1fGc8kBtp https://explorer.blockstack.org/address/1HTj28w1QgzARDLpxBepDFEMb1fGc8kBtp
@yshrsmz
yshrsmz / schema.json
Created April 25, 2019 02:05
kibela api schema
{
"data": {
"__schema": {
"queryType": {
"name": "Query"
},
"mutationType": {
"name": "Mutation"
},
"subscriptionType": null,
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
@yshrsmz
yshrsmz / IntrospectionQuery.gql
Last active April 22, 2019 04:45
GitHub GraphQL API schema
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
@yshrsmz
yshrsmz / 1_common.kt
Last active April 13, 2019 05:43
Multiplatform ViewModel
expect abstract class ViewModel() {
open fun onCleared()
}