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 / StaggeredGridBorderDecoration.kt
Last active June 6, 2022 08:11
Border ItemDecoration for StaggeredGridLayoutManager & RecyclerView
package net.yslibrary.tumblegrid.dashboard
import android.graphics.Canvas
import android.graphics.Rect
import android.graphics.drawable.ColorDrawable
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.StaggeredGridLayoutManager
import android.view.View
class StaggeredGridBorderDecoration(private val borderSize: Int,
@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 / readme.md
Last active July 1, 2020 23:29
Iris Keyboard作る上で必要そうなもの
@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