Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Damnhorns nodkz

View GitHub Profile
@wegorich
wegorich / index.ts
Last active Mar 5, 2020
how work with localmock client
View index.ts
import { from, ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
import { errorLink } from './error.link';
import * as tags from './posts.resolvers';
const typeDefs = [tags.typeDefs];
const resolvers = [tags.resolvers];
const gqlClient = new ApolloClient({
cache: new InMemoryCache(),
typeDefs,
@sibelius
sibelius / MutationUtils.js
Created Mar 19, 2018
Helper methods for Relay Modern updater
View MutationUtils.js
// @flow
import { ConnectionHandler } from 'relay-runtime';
import { isObject, isArray } from 'lodash/fp';
export function listRecordRemoveUpdater({ parentId, itemId, parentFieldName, store }) {
const parentProxy = store.get(parentId);
const items = parentProxy.getLinkedRecords(parentFieldName);
parentProxy.setLinkedRecords(items.filter(record => record._dataID !== itemId), parentFieldName);
}
@Lendar
Lendar / App.js
Last active Dec 24, 2015
Using FontFaceObserver for React app loader
View App.js
import React from 'react'
import 'fontfaceobserver'
import IndexPage from './IndexPage'
import Loader from './Loader'
import { fetchUser } from '../apiclient'
import 'font-awesome-webpack'
import './Lato-font.css'
import './Roboto-font.css'
View Container.js
import React from 'react';
import { container } from 'redux-relay';
@container({
variablesFromState: (state) => ({myVariable: state.myState})
fragments: {
Relay.QL`
viewer {
@kekekeks
kekekeks / ru_en_analyzer
Last active Dec 19, 2020
russian + english analyzer for elasticsearch русский + английский
View ru_en_analyzer
{
"settings": {
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
},
"english_stemmer": {
"type": "stemmer",