Skip to content

Instantly share code, notes, and snippets.

@oukayuka
oukayuka / SKILL.md
Created April 10, 2026 14:20
japanese-proofreader skill
name japanese-proofreader
description 日本語の技術書原稿(Markdown)の文章校正を行うスキル。 誤字脱字・助詞の誤り・表記ゆれなどの純粋な文章レベルの誤りのみを検出し、 内容の書き換えや構成変更は一切行わない。 ユーザーが「校正して」「proofread」「文章チェック」「誤字脱字」「表記ゆれ」 「てにをは」「校正モード」と言ったとき、または Markdown 原稿を渡して 文章の誤りを見つけてほしいという趣旨のリクエストをしたときに必ず使うこと。
@oukayuka
oukayuka / lint-staged-around
Last active March 31, 2021 01:23
Execute each lint-staged entry in sub-directories projects recursively
#!/bin/sh
# lint-staged-around
# execute each lint-staged entry in sub-directories projects recursively
#
# Riakuto! Project by Klemiwary Books
fileTypes="js|jsx|ts|tsx|html|css|less|sass|scss|gql|graphql|json"
target="src|public"
@oukayuka
oukayuka / sailormoon-transform.ts
Last active May 28, 2020 13:11
TypeScript Functions OverLoads Sample
class Brooch {
pentagram = 'Silver Crystal';
}
type Compact = {
silverCrystal: boolean;
};
class CosmicCompact implements Compact {
silverCrystal = true;
@oukayuka
oukayuka / result-type.ts
Last active May 1, 2020 03:59
TypeScript higher order function which wraps async fetcher and returns with Result<T,E> like Rust
/* eslint-disable max-classes-per-file, no-useless-constructor, lines-between-class-members */
type Result<T, E extends Error> = Ok<T, E> | Err<T, E>;
export class Ok<T, E extends Error> {
constructor(readonly val: T) {}
isOk = (): this is Ok<T, E> => true;
isErr = (): this is Err<T, E> => false;
}
export class Err<T, E extends Error> {
@oukayuka
oukayuka / stylelint.config.js
Created March 21, 2020 09:29
styled-components 用に JSX ファイルを振り分ける設定
const { argv } = require('yargs');
const glob = argv._ && argv._[0];
const isJsxFile = glob && /.{jsx,tsx}/.test(glob);
if (isJsxFile) {
module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-styled-components',
@oukayuka
oukayuka / findBooks.ts
Created December 10, 2019 11:04
Firestore のスナップショットをいい感じにキャッシュしてくれるライブラリの構想
import { getByQuery, strategies } from 'firestore-snapbox';
const maxEntries = 100;
const maxAgeSeconds = 60 * 60;
const expiredDate = new Date(2020, 0, 10, 15);
const snap = await getByQuery(query, strategies.CacheFirst, { maxEntries, maxAgeSeconds, expiredDate });
const books = snap.docs.map(doc => { ...doc, id: doc.id } as Book);
@oukayuka
oukayuka / use-find-book.ts
Last active December 7, 2019 09:30
findBook() をコールする Custom Hook
import { useContext, useEffect, useRef, useState } from 'react';
import { Book } from 'domains/mangarel/models/book';
import findBook from 'domains/mangarel/services/find-book';
import { FirebaseContext } from 'contexts';
const useFindBook = (id: string) => {
const [book, setBook] = useState<Book>();
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<Error | null>(null);
@oukayuka
oukayuka / InfinitScroll.tsx
Last active November 9, 2019 01:51
Infinit scroll component sample with React Hooks
import React, { FC, useEffect, useRef } from 'react';
import ListLoader from '../atoms/ListLoader';
type InfinitScrollProps = {
loadMore?: () => void;
hasMore?: boolean;
isLoading?: boolean;
threshold?: number;
};
@oukayuka
oukayuka / axiosInterceptor.ts
Last active April 9, 2019 09:17
axios のレスポンスからスネークケースのキーをキャメルケースに変換して、日付をDateTimeオブジェクトにする
import { AxiosResponse } from 'axios';
import { camel } from 'change-case';
import { isArray, isObject, isString } from 'lodash';
import { DateTime } from 'luxon';
export const reform = (
obj: object,
keyConverter: (k: string) => string,
): any => {
if (isArray(obj)) {
@oukayuka
oukayuka / keybindings.json
Last active April 26, 2018 06:23
VSCode Vim plugin undo / redo settings
[
{
"key": "ctrl+]",
"command": "extension.vim_escape",
"when": "editorTextFocus"
},
{
"key": "ctrl+e",
"command": "workbench.action.toggleSidebarVisibility"
},