Skip to content

Instantly share code, notes, and snippets.

View lightsound's full-sized avatar
🎮
Writing code like playing game

しまぶー lightsound

🎮
Writing code like playing game
View GitHub Profile
@lightsound
lightsound / index.html
Last active January 26, 2018 02:17
[HTMLテンプレート] Webページを作成時のベースとなるテンプレート。参照元→http://coliss.com/articles/build-websites/operation/work/html5-template-by-sixrevisions.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
@lightsound
lightsound / CleanCommitHistory.md
Last active January 25, 2018 02:07
GitPitchでコミットログをキレイにするためのTips
git checkout -b presentation-dev-branch

#
# Now develop your presentation content in this branch,
# committing as often as you want
# Then when you are finished, do the following:
#

git checkout master
@lightsound
lightsound / github.md
Created February 17, 2019 08:51
GitHub Repository Setup

GitHub Repository Setup

Opetions

Features

  • Wikis: off
  • Projects: off

Branchs

@lightsound
lightsound / index.js
Last active October 3, 2019 12:17
scrapbox custom css js
window.addEventListener('load', () => {
/* initializer */
const menu = [...$(".global-menu")[0].children];
const lastIndex = menu.findIndex(v => v.className === "divider") - 1;
const hasStreamParam = location.pathname.includes("stream");
$("#app-container").attr("data-stream", hasStreamParam);
setStreamBtn();
setProjects();
/* event */
@lightsound
lightsound / keybase.md
Created July 28, 2021 23:28
keybase.md

Keybase proof

I hereby claim:

  • I am lightsound on github.
  • I am shimabu_it (https://keybase.io/shimabu_it) on keybase.
  • I have a public key ASDFYCmRStJlCG6BT0Va_mVXGdluciP4Ct40JhkMf1xUkwo

To claim this, I am signing this object:

@lightsound
lightsound / test.tsx
Last active October 1, 2021 01:19
useSharedState
import useSWR from "swr";
const useSharedState = (key: string, fallbackData: any) => {
const { data, mutate } = useSWR(key, { fallbackData });
return [data, mutate];
};
const useCounter = () => {
const [count, setCount] = useSharedState("counter", 0);
const handleIncrement = () => {
@lightsound
lightsound / Button.tsx
Last active October 27, 2022 02:05
Next.jsでボタンを良い感じに使えるようにするためのコンポーネント
import Link, { LinkProps } from 'next/link'
import { ComponentPropsWithRef, createElement, forwardRef } from 'react'
// Types
type Tag = 'button' | 'input' | 'a'
type Element = HTMLButtonElement | HTMLInputElement | HTMLAnchorElement
type Button = {
tag: 'button'
type?: ComponentPropsWithRef<'button'>['type']
@lightsound
lightsound / createStorybookFactory.tsx
Created January 12, 2022 11:40
Storybookのテンプレートを削減するためのファクトリー関数
import { AnyFramework, ComponentTitle, StoryAnnotations } from '@storybook/csf'
import { ComponentMeta, ComponentStory } from '@storybook/react'
import { VFC } from 'react'
export const createStorybookFactory = <P extends object>(Component: VFC<P>) => {
const Template = ((args) => <Component {...args} />) as ComponentStory<
typeof Component
>
const Default = Template.bind({})
import { Tab } from "@headlessui/react";
import type { VFC } from "react";
import { Fragment } from "react";
type Props = {
items: { label: string; content: JSX.Element }[];
};
export const HorizontalTab: VFC<Props> = (props) => {
return (
@lightsound
lightsound / study-reduce.ts
Last active February 11, 2022 04:36
Reduce関数ライブ講座で使用したコード
// 一番シンプルな例
const input = [1, 2, 3, 4];
const output = input.reduce((prev, current) => {
return prev + current;
});
console.log(output); // 10