Skip to content

Instantly share code, notes, and snippets.

View tkdn's full-sized avatar
🏠
Working From Home.

Satoshi Takeda tkdn

🏠
Working From Home.
View GitHub Profile
@tkdn
tkdn / foo.jsx
Created June 16, 2017 14:28 — forked from tmeasday/foo.jsx
Redux container
// This is a vastly simplified implementation of what a Redux container would do
class MyComponentContainer extends Component {
mapStateToProps(state) {
// this function is specific to this particular container
return state.foo.bar;
}
render() {
// This is how you get the current state from Redux,
// and would be identical, no mater what mapStateToProps does
@tkdn
tkdn / Brewfile
Last active April 9, 2021 19:25
ReMac
tap "fujiwara/tap"
tap "getsentry/tools"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
tap "libero18/mycask"
tap "olleolleolle/adr-tools"
tap "rcmdnk/file"
@tkdn
tkdn / Brewfile
Last active August 28, 2019 09:49
tap "fujiwara/tap"
tap "getsentry/tools"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "libero18/mycask"
tap "olleolleolle/adr-tools"
tap "rcmdnk/file"
tap "stns/stns_passwd"
@tkdn
tkdn / index.test.tsx
Created August 13, 2018 08:34
Next.js' `nextjs-dynamic-routes` unit-test
import { Index } from '@Components/pages'
import * as React from 'react'
import { cleanup, render } from 'react-testing-library'
jest.mock('../../../routes', () => {
const React = require('react')
return {
Link: ({ children }) => {
return <div>{children}</div>
}
@tkdn
tkdn / summary.md
Created August 30, 2018 04:23
GraphQL について知っておきべく事

以下、記事の要約と個人的な疑問点などです。 GraphQL: Everything You Need to Know – Weblab Technology – Medium

また記事中に出てくるサンプルについてはより削ぎ落としたもので、依存がほとんどない。 GraphQL はクライアントからすると、クライアントキャッシングやその他課題はあるものの、クエリ言語である以外何者でもなさそうというがよく分かる。


@tkdn
tkdn / pluck.ts
Created November 9, 2018 02:37
like `array_pluck` on Laravel
const pluck = (
array: Array<{[key: any]: value: any}>,
props: string[],
pickedKey: string,
): {[valuePickedByKey: any]: {[prop:any]: any}} => {
return array.reduce((prevOut, item) => {
const valuePickedByKey = item[pickedKey];
const pickedObj = props.reduce((prevItem, pickProp) => {
return {
...prevItem,
@tkdn
tkdn / pluck.ts
Last active November 9, 2018 02:41
like `array_pluck` on Laravel
const pluck = (
array: Array<{[key: any]: value: any}>,
props: string[],
pickedKey: string,
): {[valuePickedByKey: any]: {[prop:any]: any}} => {
return array.reduce((prevOut, item) => {
const valuePickedByKey = item[pickedKey];
const pickedObj = props.reduce((prevItem, pickProp) => {
return {
...prevItem,
@tkdn
tkdn / 2018-3-28.md
Created December 29, 2018 11:53
HOCs と TypeScript における型付けの肝

React HOCs on TypeScript

参考: https://medium.com/@jrwebdev/react-higher-order-component-patterns-in-typescript-42278f7590fb

まだ HOC と TypeScript の良い落としどころが見えてないが、何となく理解しつつある現状。 「TypeScript こわい」から卒業したのと、良記事があったので簡単にまとめておきます。

HOCs と TypeScript の相性

悪い。 => 型を設定することが難しい。 しかしやっていきたいので、any を使わずに整理していこう。

@tkdn
tkdn / 2018-6-1.md
Created December 29, 2018 11:56
GraphQL について知っておくべきこと

以下、記事の要約と個人的な疑問点などです。 GraphQL: Everything You Need to Know – Weblab Technology – Medium

また記事中に出てくるサンプルについてはより削ぎ落としたもので、依存がほとんどない。 GraphQL はクライアントからすると、クライアントキャッシングやその他課題はあるものの、クエリ言語である以外何者でもなさそうというがよく分かる。


@tkdn
tkdn / docker-compose.yml
Last active October 7, 2019 09:19
docker-compose mysql
version: "3.7"
services:
mysql:
container_name: apollo-work-mysql
image: mysql:5.7
restart: always
ports:
- 3306:3306
volumes: