Skip to content

Instantly share code, notes, and snippets.

View MegaBlackLabel's full-sized avatar

底なし沼の魔女 MegaBlackLabel

View GitHub Profile
# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
run:
linters-settings:
govet:
enable-all: true
disable:
- shadow
unused:
check-exported: true
unparam:
@MegaBlackLabel
MegaBlackLabel / clean_architecture.md
Created April 23, 2020 08:56 — forked from mpppk/clean_architecture.md
クリーンアーキテクチャ完全に理解した

実装から学ぶクリーンアーキテクチャ

クリーンアーキテクチャはRobert C. Martin(Uncle Bob)が2012年に提唱した、DBやフレークワークからの独立性を確保するためのアーキテクチャであり、以下の図が大変有名です。

CleanArchitecture.jpg

最初にクリーンアーキテクチャについて言及されたブログが書かれてからは既に7年が経過しており、書籍Clean Architecture 達人に学ぶソフトウェアの構造と設計をはじめ、日本語での情報も十分存在します。 しかし私が学び始めた時、以下の理由で理解が難しいと感じました。

  • DDDの概念や用語を流用しているが、レイヤーに関する考え方はDDDとは異なる
@MegaBlackLabel
MegaBlackLabel / tslint.json
Created February 12, 2018 13:19 — forked from oukayuka/tslint.json
My TSLint configuration
{
"extends": [
"tslint:latest",
"tslint-config-airbnb",
"tslint-config-prettier",
"tslint-eslint-rules",
"tslint-react"
],
"rulesDirectory": [
"tslint-plugin-prettier"
@MegaBlackLabel
MegaBlackLabel / index.ts
Created February 7, 2018 03:01 — forked from monzou/index.ts
Next.js + TypeScript
import { Context } from 'next'
import Head from 'next/head'
import * as React from 'react'
import { compose, lifecycle, pure, wrapDisplayName } from 'recompose'
function withInitialProps<Props>(provider: (context: Context) => object) {
return (BaseComponent: React.ComponentType<Props>) => {
return class extends React.Component<Props> {
public static displayName = wrapDisplayName(BaseComponent, 'withInitialProps')
public static async getInitialProps(context: Context) {
@MegaBlackLabel
MegaBlackLabel / Counter.jsx
Created February 7, 2018 02:59 — forked from joeporpeglia/Counter.jsx
Redux as a Render Prop
import StoreProvider from './StoreProvider';
const increment = { type: '@counter/increment' };
const decrement = { type: '@counter/decrement' };
const initialState = { count: 0 };
const reducer = (state = initialState, action) => {
switch (action.type) {
case increment.type:
@MegaBlackLabel
MegaBlackLabel / FlashMessage.tsx
Created February 6, 2018 21:30 — forked from oukayuka/FlashMessage.tsx
Recompose withStateHandlers with TypeScript
import * as React from 'react';
import { compose, lifecycle, pure, StateHandler, StateHandlerMap, withStateHandlers } from 'recompose';
import { Message, Transition } from 'semantic-ui-react';
import './FlashMessage.css';
export interface FlashMessageProps {
message: string;
isWarning?: boolean;
}
@MegaBlackLabel
MegaBlackLabel / AuthorizationHOC.js
Created February 1, 2018 07:07 — forked from wuct/AuthorizationHOC.js
An authorization high-order-component using recompose, redux and react-router.
import { emptyObject } from 'fbjs/lib/emptyObject';
import { connect } from 'react-redux';
import { pushState } from 'redux-router';
import pure from 'recompose/pure';
import defaultProps from 'recompose/defaultProps';
import doOnReceiveProps from 'recompose/doOnReceiveProps';
import renderNothing from 'recompose/renderNothing';
import renderComponent from 'recompose/renderComponent';
import branch from 'recompose/branch';
import compose from 'recompose/compose';