Skip to content

Instantly share code, notes, and snippets.

View xuorig's full-sized avatar

Marc-Andre Giroux xuorig

View GitHub Profile
@RStankov
RStankov / decorators.tsx
Created October 22, 2020 19:02
Draft.js Markdown
import * as React from 'react';
const BOLD_REGEX = /(^|[^\w])\*\*[^\*]+\*\*($|[^\w])/gi;
const ITALIC_REGEX = /(^|[^\w])(^|[^\*])\*[^\*]+\*($|[^\w])/gi;
const UNDERLINE_REGEX = /(^|[^\w])(^|[^\~])\~[^\~]+\~($|[^\w])/gi;
const STIKE_REGEX = /(^|[^\w])\~\~[^\~]+\~\~($|[^\w])/gi;
function boldStrategy(contentBlock: any, callback: any, _contentState: any) {
findWithRegex(BOLD_REGEX, contentBlock, callback);
}
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@idibidiart
idibidiart / GraphQL-Architecture.md
Last active September 16, 2023 18:36
Building an Agile, Maintainable Architecture with GraphQL

Building a Maintainable, Agile Architecture for Realtime, Transactional Apps

A maintainable application architecture requires that the UI only contain the rendering logic and execute queries and mutations against the underlying data model on the server. A maintainable architecture must not contain any logic for composing "app state" on the client as that would necessarily embed business logic in the client. App state should be persisted to the database and the client projection of it should be composed in the mid tier, and refreshed as mutations occur on the server (and after network interruption) for a highly interactive, realtime UX.

With GraphQL we are able to define an easy-to-change application-level data schema on the server that captures the types and relationships in our data, and wiring it to data sources via resolvers that leverage our db's own query language (or data-oriented, uniform service APIs) to resolve client-specified "queries" and "mutations" against the schema.

We use GraphQL to dyn