Skip to content

Instantly share code, notes, and snippets.

View chentsulin's full-sized avatar
🕶️
Keep learning

C. T. Lin chentsulin

🕶️
Keep learning
View GitHub Profile
@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

@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active February 24, 2024 04:41
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.

@tlrobinson
tlrobinson / redux-devtools-separate-window.js
Last active August 20, 2019 23:54
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
// give it a name so it reuses the same window
var win = window.open(null, "redux-devtools", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no");
// reload in case it's reusing the same window with the old content
win.location.reload();
// wait a little bit for it to reload, then render
setTimeout(function() {
React.render(
<DebugPanel top right bottom left >
@gaearon
gaearon / ReduxUndoExample.js
Created July 30, 2015 14:46
Redux undo reducer factory example by @iclanzan
// Written by @iclanzan
// All credit goes to him!
// You create the reducer like this:
// var reducer = createTimelineReducer('someName', someReducer, ['foo', 'bar']);
// And then whenever an action of type `foo` or `bar` happens it calls `someReducer` and adds the result to the timeline.
// Then to undo/redo you trigger an action of type `someNameUndo`/`someNameRedo`.
var defaults = require('lodash/object/defaults');
var capitalize = require('lodash/string/capitalize');
@beaugunderson
beaugunderson / cool-modules.md
Last active February 2, 2023 19:58
cool modules from nodeconf

from streams session

  • end-of-stream - specify a callback to be called when a stream ends (which is surpsingly hard to get right)
  • duplexify - compose a Duplex stream from a Readable and a Writable stream
  • pump - pipe streams together and close all of them if one of them closes
  • pumpify - combine an array of streams into a single duplex stream using pump and duplexify
  • through2 - tools for making Transform streams
  • from2 - tools for making Readable streams

from "participatory modules" session

@ohanhi
ohanhi / frp.md
Last active December 23, 2022 13:06
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@goodjob1114
goodjob1114 / hhvm-nginx-mariadb-installMemoOnUbuntu14.04.md
Last active July 5, 2019 16:27
hhvm, nginx, php, mariadb -> [laravel] install memo used on Ubuntu 14.04

ubuntu 14.04

sysv-rc-conf (service control tool)

sudo apt-get install -y sysv-rc-conf

nginx

sudo add-apt-repository -y ppa:nginx/stable 
@jlongster
jlongster / forms-with-react.js
Last active May 8, 2017 14:15
higher-order form components w/react
// Simple wrapper to use bootstrap's grid system to position elements side-by-side
var VerticalFieldsElement = React.createClass({
render: function() {
return dom.div(
{ className: 'clearfix' },
React.Children.map(this.props.children, function(child) {
if(!child) {
return child;
}
@prestonparris
prestonparris / reactjs-conf-2015-notes.md
Last active April 6, 2017 21:32
Notes from the 2015 React.js Conference

Reactjs conf 2015 Notes

  • react native announced

    • Allows you to use react style javascript to target native ios and android, native views, live reloading
    • intro pt1
    • intro pt2
    • facebook groups app uses react native with graphql and relay
  • realtime page tweaking

    • rethink best practices and workflows
  • inmutability is a good idea