Skip to content

Instantly share code, notes, and snippets.

View tatsushitoji's full-sized avatar
🤑

Tatsushi Toji tatsushitoji

🤑
View GitHub Profile
{
"version": 3,
"folders": [
{
"name": "PR badge",
"info": "markdown badge for PR",
"snippets": [
{
"name": "badge - must",
"shortcut": "/must",
const Conatiner = compose<InnerProps, OutterProps>(
connect(
mapStateToProps,
mapDispatchToProps,
),
getDerivedStateFromProps<Props>((nextProps, prevState) => {
// write somthing
return nextProps;
}),
)(LoginComponent);
@tatsushitoji
tatsushitoji / orderedStarredReposWithPagination.graphql
Created December 14, 2018 03:04
GitHub GraphQL API Ordered Starred Repositories Examples
query {
viewer {
login
name
starredRepositories(first: 5, orderBy: {field: STARRED_AT, direction: DESC }, after: "before_cursor" ) {
edges {
cursor
node {
id
name
@tatsushitoji
tatsushitoji / getDerivedStateFromProps.tsx
Last active December 27, 2018 23:27
static getDerivedStateFromProps HOCs with TypeScript
type DerivedStateFromPropsFunction<TProps, TState> = (
props: TProps,
state: TState,
) => TState | void;
const getDerivedStateFromProps = <T extends {}>(
f: DerivedStateFromPropsFunction<T, T | {}>,
) => (BaseComponent: React.ComponentType<T>) => {
class EnhancedComponent extends React.Component<T> {
state = {};
/* ***********************************
* easing
* ベジェの値を数値化した変数
*********************************** */
// Default
$linear : cubic-bezier(0.250, 0.250, 0.750, 0.750)
$ease : cubic-bezier(0.250, 0.100, 0.250, 1.000)
$ease-in : cubic-bezier(0.420, 0.000, 1.000, 1.000)
$ease-out : cubic-bezier(0.000, 0.000, 0.580, 1.000)
@tatsushitoji
tatsushitoji / fizzbuzz.js
Last active June 20, 2019 01:57
FizzBuzz
const fizzBuzz = x =>
x % (3 * 5) === 0 && 'fizzbuzz' || x % 5 === 0 && 'buzz' || x % 3 === 0 && 'fizz' || x;
Array.from([...Array(100).keys()], x => fizzBuzz(x + 1));