Skip to content

Instantly share code, notes, and snippets.

View jameswyse's full-sized avatar
:octocat:
Codin'

James Wyse jameswyse

:octocat:
Codin'
View GitHub Profile
// Minimal middleware implementation
// Works in node and the browser
// Inspired by https://github.com/h2non/midware
// Usage examples are at the bottom...
function middleware(ctx) {
let calls = [];
let errorHandlers = [];
var ctx = ctx || null;
@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

@zbyte64
zbyte64 / async_app.py
Created May 26, 2016 20:47
Asyncio Views With Django
import asyncio
from django import http
from django.core.urlresolvers import set_script_prefix
from django.utils.encoding import force_str
from django.core.handlers.wsgi import get_script_name
from django_wsgi.handler import DjangoApplication
import logging
import logging
import sys
@bforchhammer
bforchhammer / lazy_batching.py
Last active February 18, 2017 08:56
Graphene lazy batched requests
from graphql.execution.executors.sync import SyncExecutor
"""
Usage example:
from functools import partial
class MyServiceCache(BulkRequestCache):
def __init__():
self.requested_values = set()
@helfer
helfer / apollo-1-migration.md
Last active May 31, 2017 01:09
Migrating from Apollo Client 0.x to 1.0

Migrating from Apollo Client 0.x to 1.0

Here are the main breaking changes between the 0.x and 1.0 versions of Apollo Client.

fetchMore

The structure of fetchMoreResult has been changed. Previously fetchMoreResult used to contain data and loading fields, now fetchMoreResult is what fetchMoreResult.data used to be. This means your updateQueries function has to change as follows:

updateQuery: (prev, { fetchMoreResult }) => {
@fritolays
fritolays / mover_tuning_exclusions.sh
Last active October 30, 2025 18:48
This script enables the Mover Tuning plugin for Unraid to be able to exclude files and/or folders.
#!/bin/bash
# (https://forums.unraid.net/topic/70783-plugin-mover-tuning/)
# This script enables the Mover Tuning plugin for Unraid to be able to exclude files and/or folders.
# Script activity can be viewed in Unraid's system log (Tools -> System Log).
# First, it reads lists of directories and files from provided text files.
# Then, it converts any Windows line endings to Unix line endings in these lists.
# Next, it checks if the paths listed in the files are valid directories or files.
# Finally, valid file and directory paths are compiled into a single output file for use by the Mover Tuning plugin.