Skip to content

Instantly share code, notes, and snippets.

View schickling's full-sized avatar
Making the web better

Johannes Schickling schickling

Making the web better
View GitHub Profile
@schickling
schickling / _README.md
Last active January 4, 2024 09:37
Script to import and export docker-machine configurations to sync between hosts/collaborators

docker-machine import/export

Script to import and export docker-machine configurations to sync between hosts/collaborators

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
@schickling
schickling / request.graphql
Last active May 26, 2016 22:44
Connections, Edges & Nodes in Relay (Simple GraphQL Request + Response)
{
movie(title: "Inception") {
releaseDate
actors {
name
}
}
}
@schickling
schickling / request.graphql
Last active May 26, 2016 22:44
Connections, Edges & Nodes in Relay (Relay Request + Response)
{
movie(title: "Inception") {
releaseDate
actors(first: 10) {
edges {
node {
name
}
}
}
@schickling
schickling / bluebird-concurrency.js
Created December 23, 2016 17:54
Runs multiple GraphQL mutations concurrently with a maximum number of parallel promises
import * as Bluebird from 'bluebird'
const myMutations = [
'mutation1: createItem(title: "Node 1") { id }',
'mutation2: createItem(title: "Node 2") { id }',
// ...
]
const transport = new Transport('my-graphcool-api')
const crm = new Lokka({transport})
@schickling
schickling / NPM-best-practices.md
Created February 25, 2018 15:28
NPM Best Practices

NPM Best Practices

  • Use yarn instead of npm (at least for now)
  • Check yarn.lock into version control
  • yarn.lock file is automatically ignored from publishing

graphql related

  • Make graphql a peer dependency (+ dev dependency if needed) in libraries
import type { Context } from '../../';
type EditReleaseInput = {
data: {
releaseId: string,
title?: string,
},
};
export default async (
import type { Context } from '../../';
type EditReleaseInput = {
data: {
releaseId: string,
title?: string,
},
};
export default async (
@schickling
schickling / open-promise.ts
Created July 6, 2021 08:48
Pair of promise and resolve function
export const createOpenPromise = () => {
let resolve: () => void
return {
promise: new Promise((resolve_: any) => {
resolve = resolve_
}),
resolve: resolve!,
}
}
@schickling
schickling / default.nix
Created August 17, 2021 11:10
Prisma 2.29.1 nixos
with import <nixpkgs> {};
# prisma-bin.nix
let
prismaDrv = {stdenv,fetchurl,openssl,zlib,autoPatchelfHook,lib} :
let
hostname = "binaries.prisma.sh";
channel = "all_commits";
target = "debian-openssl-1.1.x";
baseUrl = "https://${hostname}/${channel}";
@schickling
schickling / main.ts
Created August 16, 2022 08:13
Effect Worker Pool
import { M, OT, pipe, T } from '@mytunes/utils/effect'
import { provideOtelTracer } from '../utils/tracer.js'
import { makeWorkerPool } from './worker-pool.js'
export const startWorkerPool = () =>
pipe(startWorkerPool_, OT.withSpan('worker-pool'), provideOtelTracer(), T.runPromise)
export const startWorkerPool_ = T.gen(function* ($) {