Skip to content

Instantly share code, notes, and snippets.

View matheuscorreia's full-sized avatar
🎬

Matheus Correia matheuscorreia

🎬
  • Stockholm, Sweden
View GitHub Profile
@sibelius
sibelius / DateRangeParamExample.tsx
Created January 23, 2020 21:40
getSchemaParam to build a complex querystring filter param to use use-query-params
const dateRangeDefinition = {
begin: MomentParam,
end: MomentParam,
};
const DateRangeParam = getSchemaParam(dateRangeDefinition);
const decoded = FilterParam.decode('begin-2019-05-19T03:00:00.000Z_end-2019-05-19T03:00:00.000Z');
const decoded = {
begin: moment('2019-05-19T03:00:00.000Z'),
@jgcmarins
jgcmarins / MyFunctionComponent.test.tsx
Last active May 15, 2019 20:56
Testing functions only called by useEffect
import React from 'react';
import { mount } from 'enzyme';
import formEventEmitter from '../formEventEmitter';
import MyFunctionComponent from '../MyFunctionComponent';
jest.mock('../formEventEmitter');
it('should check if preventCancel is being called', () => {
const dialog = { confirm: jest.fn() };
@sibelius
sibelius / MutationUtils.js
Created March 19, 2018 10:20
Helper methods for Relay Modern updater
// @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);
}
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active July 4, 2024 07:31
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@clemtibs
clemtibs / Commit Formatting.md
Last active February 13, 2025 03:36
Angular Commit Format Reference Sheet

Commit Message Format

This specification is inspired by and supersedes the [AngularJS commit message format][commit-message-format].

We have very precise rules over how our Git commit messages must be formatted. This format leads to easier to read commit history.

Each commit message consists of a header, a body, and a footer.