Skip to content

Instantly share code, notes, and snippets.

View shuhei's full-sized avatar
🐶
This is fine

Shuhei Kagawa shuhei

🐶
This is fine
View GitHub Profile
@shuhei
shuhei / shape-animation.md
Last active May 14, 2021 14:10
A short introduction to animating shape in ReactNative

A short introduction to animating Shape in React Native

This note explains the basic idea of the animated chart in https://github.com/shuhei/Compare.

Before animation

We can draw a shape if we have:

@shuhei
shuhei / example.js
Created April 24, 2017 10:14
Compile JSX to string
function Foo(props) {
return (
<div className="yes">
<p>Hello, {props.name}</p>
</div>
);
}
function FooCompiled(props) {
return (
@shuhei
shuhei / README.md
Last active April 1, 2017 13:51
Check whether memory leaks on a stream error

Result

There were not memory leaks detected for:

  • error on the unzip stream
  • error on the request object

Couldn't get error on the response object. When the connection is destroyed, request object emits an error.

How to

@shuhei
shuhei / README.md
Last active March 21, 2017 15:11
Convert ava to mocha + assert

Incomplete code mod for converting ava tests to mocha + assert

Usage:

npm install -g jscodeshift
jscodeshift -t ava2mocha.js $(find src server -name '*.spec.js')
@shuhei
shuhei / README.md
Last active March 12, 2017 08:08
WIP: Typing HOCs with recompose

WIP: Typing HOCs with recompose

It's hard to keep prop types of underlying components of HOCs. Even the official documentation is not working well. It's even harder to have multiple HOCs typed and maintain with peer developers. Here comes recompose, the HOC utility module. If we have recompose properly typed, we can omit typing of our own HOCs taking advantage of recompose and flowtype's type inference.

recompose still doesn't have official flowtype definition, but there are some efforts:

This gist is an effort to make it happen based on the PRs above.

@shuhei
shuhei / README.md
Last active January 23, 2017 08:51
Gunzip multiple gzip chunks
@shuhei
shuhei / dracula.yml
Created January 9, 2017 21:19
Dracula color scheme for Alacritty
# Colors (Dracula)
colors:
# Default colors
primary:
background: '0x282a36'
foreground: '0xf8f8f2'
# Normal colors
normal:
black: '0x000000'
@shuhei
shuhei / README.md
Last active November 17, 2016 22:58
experiment on http.globalAgent.maxSockets of Node.js

It was fastest without maxSockets until the client gets Error: connect ECONNRESET 127.0.0.1:8080. maxSockets avoided the error but didn't work for performance.

@shuhei
shuhei / README.md
Last active October 18, 2016 10:46
Keyboard configuration on Sierra

Karabiner currently doesn't work on Mac OS X Sierra. This note is to simulate some of my favorite configurations on Karabiner on Sierra.

  • Ctrl + hjkl -> arrow keys
  • Space + some key -> Shift + the key (still quite buggy)

Karabiner Elements

Put the karabiner.json at ~/.karabiner.d/configuration/karabiner.json.

英かな

@shuhei
shuhei / count-import.hs
Created September 17, 2016 07:48
Count import statements: an exercise of http://qiita.com/hiratara/items/169b5cb83b0adbfda764
#!/usr/bin/env stack
-- stack --resolver lts-7.0 --install-ghc runghc --package turtle
{-# LANGUAGE OverloadedStrings #-}
import Prelude hiding (FilePath)
import qualified Control.Foldl as Fold
import Turtle
import Data.Maybe (fromMaybe)
main :: IO ()