Skip to content

Instantly share code, notes, and snippets.

View hyochan's full-sized avatar
🎯
Focusing

Hyo hyochan

🎯
Focusing
View GitHub Profile
@hyochan
hyochan / SearchUser.tsx
Created August 31, 2020 09:14
react native relay pagination
import { Animated, FlatList } from 'react-native';
import React, { FC, Suspense, useState } from 'react';
import type {
SearchUsersPaginationQuery,
SearchUsersPaginationQueryResponse,
SearchUsersPaginationQueryVariables,
} from '../../__generated__/SearchUsersPaginationQuery.graphql';
import {
graphql,
useLazyLoadQuery,
@hyochan
hyochan / coc-settings.json
Last active October 13, 2020 18:34
neovim config
{
"coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "ts", "tsx", "js", "jsx"],
"prettier.eslintIntegration": true
}
@hyochan
hyochan / RelayEnvironment.ts
Created June 21, 2020 09:46
relay/RelayEnvironment.ts
import {
CacheConfig,
Environment,
GraphQLResponse,
Network,
RecordSource,
RequestParameters,
Store,
Variables,
} from 'relay-runtime';
@hyochan
hyochan / fetch.ts
Created June 21, 2020 09:45
relay/fetch.ts
import { CacheConfig, GraphQLResponse, RequestParameters, Variables } from 'relay-runtime';
const FETCH_URL = 'https://hackatalk.azurewebsites.net/graphql';
export type FetchArgProps = {
request: RequestParameters;
variables: Variables;
cacheConfig: CacheConfig;
token?: string | null;
};
@hyochan
hyochan / test_data.ts
Created February 18, 2020 06:38
Sample test data for table
const data = [
{
date: '2019-12-13',
group: 'person',
type: 'domain',
visitors: 48,
appearanceTimeInSecs: 986,
},
{
date: '2019-12-13',
@hyochan
hyochan / PinchZoomView.tsx
Last active February 3, 2020 11:18
React Native PinchZoomView
import {
PanGestureHandler,
PanGestureHandlerGestureEvent,
PinchGestureHandler,
PinchGestureHandlerStateChangeEvent,
State,
} from 'react-native-gesture-handler';
import React, { ReactChildren, ReactElement } from 'react';
import { Animated } from 'react-native';
@hyochan
hyochan / apolloServer.ts
Last active February 1, 2020 15:10
Example for using apollo server
import models, { ModelType } from './models';
import { ApolloServer } from 'apollo-server-express';
import { Http2Server } from 'http2';
import { JwtUser } from './utils/auth';
import { PubSub } from 'graphql-subscriptions';
import { User } from './models/User';
import { allResolvers } from './resolvers';
import { createApp } from './app';
import { createServer as createHttpServer } from 'http';
@hyochan
hyochan / Client.ts
Created January 27, 2020 03:23
Grpahql apollo client for react-native
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache } from 'apollo-boost';
import { AsyncStorage } from 'react-native';
import { GRAPHQL_URL } from '../../config';
import { WebSocketLink } from 'apollo-link-ws';
import { getMainDefinition } from 'apollo-utilities';
import { onError } from 'apollo-link-error';
import { setContext } from 'apollo-link-context';
import { split } from 'apollo-link';
@hyochan
hyochan / flow.sh
Created December 25, 2019 16:12
Find all typescript definition files and generate flow types with flowgen
for i in $(find lib -type f -name "*.d.ts");
do sh -c "flowgen $i -o ${i%.*.*}.js.flow";
done;
server {
listen 80;
listen 443 ssl;
server_name dooboo.dev;
ssl_certificate /root/cert/certificate.crt;
ssl_certificate_key /root/cert/private.key;
location / {