Skip to content

Instantly share code, notes, and snippets.

View jorisvddonk's full-sized avatar

Joris van de Donk jorisvddonk

View GitHub Profile
@jorisvddonk
jorisvddonk / ApolloComplexityPlugin.ts
Last active October 9, 2022 23:01
ApolloComplexityPlugin
import { ApolloServerPlugin, GraphQLServiceContext } from "apollo-server-plugin-base";
import { GraphQLSchema, separateOperations } from "graphql";
import { fieldConfigEstimator, getComplexity, simpleEstimator } from "graphql-query-complexity";
export class ApolloComplexityPlugin implements ApolloServerPlugin {
private schema: GraphQLSchema;
constructor(private maxComplexity: number) { }
public serverWillStart(service: GraphQLServiceContext) {
@jorisvddonk
jorisvddonk / Dockerfile
Created April 1, 2023 19:28
Two-liner to install CMake 3.26.2 to /opt in Docker
RUN mkdir -p /opt/bin; mkdir -p /opt/doc; mkdir -p /opt/man; mkdir -p /opt/share; wget -O - https://github.com/Kitware/CMake/releases/download/v3.26.2/cmake-3.26.2-linux-x86_64.tar.gz | tar -xvzf - -C /opt --strip-components=1
ENV PATH=/opt/bin:${PATH}
RUN cmake --version