Skip to content

Instantly share code, notes, and snippets.

View timsuchanek's full-sized avatar
🐋

Tim Suchanek timsuchanek

🐋
View GitHub Profile
import Layout from '../../components/layout'
import { getAllPostIds, getPostData } from '../../lib/posts'
import Head from 'next/head'
import Date from '../../components/date'
import utilStyles from '../../styles/utils.module.css'
/**
* @param {import('next').InferGetStaticPropsType<typeof getStaticProps> } props
*/
export default function Post(props) {
type Middleware = (
query: any,
next: (query: any) => Promise<any>,
) => Promise<any>
class Client {
middlewares: Middleware[] = []
async query(query) {
return this.buildQuery(query, this.middlewares.slice())
}
@timsuchanek
timsuchanek / isGraphQLStack.ts
Created January 7, 2020 14:35
Are we called within a graphql-js resolver?
import callsite from 'callsite'
export function isGraphQLStack() {
const stack = callsite()
const functions = stack.map(s => s.getFunctionName())
return (
functions.includes('resolveFieldsValueOrError') &&
functions.includes('resolveField') &&
functions.includes('executeFields')
import { GraphQLSchema } from 'graphql'
import polka from 'polka'
import { json } from 'body-parser'
import send from '@polka/send-type'
import { renderPlaygroundPage } from 'graphql-playground-html'
import { graphql } from 'graphql'
import { Server } from 'http'
export function serveGraphql(schema: GraphQLSchema): Server {
const { PORT = 4000 } = process.env
select emn.aar as year, emn.terminkode as term, count(*) as evaluted_courses, emn_total.total_courses
      from emne_liste emn,
        (select str.kode, CAST(LEFT(rap.filnavn, 4) as INTEGER) year
        from rapport rap, struktur str
        where rap.struktur_id = str.struktur_id) eval,
        (select aar, terminkode, count(*) as total_courses
         from emne_liste
         GROUP BY aar, terminkode) emn_total
 where emn.emnekode = eval.kode
{
"datamodel": {
"enums": [],
"models": [
{
"name": "User",
"isEmbedded": false,
"dbName": null,
"fields": [
{

Dump

--
-- PostgreSQL database dump
--

-- Dumped from database version 11.1 (Debian 11.1-1.pgdg90+1)
-- Dumped by pg_dump version 11.0

SET statement_timeout = 0;
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -sa terminal-overrides ",*:dim=\\E[2m"
set -g default-terminal "screen-256color"
# Keep your finger on ctrl, or don't
bind ^D detach-client
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -sa terminal-overrides ",*:dim=\\E[2m"
set -g default-terminal "screen-256color"
# Keep your finger on ctrl, or don't
bind ^D detach-client
#!/bin/bash
#
# Prisma Node.JS packages publish script
#
# Build Order
# prisma-client-lib
# prisma-generate-schema
# prisma-db-introspection