Skip to content

Instantly share code, notes, and snippets.

@nksaraf
nksaraf / index.d.ts
Last active December 14, 2020 05:51
magiql-ide
interface Options {
uri: string;
cdn?: string;
version?: string;
}
export declare function renderGraphiQL(props: Options): string;
export default function renderGraphiQL(props: Options): string;
@nksaraf
nksaraf / index.esm.js
Last active December 14, 2020 00:36
preact-react
export { default } from 'preact/compat'
export * from 'preact/compat'
@nksaraf
nksaraf / atomic-recoil.tsx
Last active January 12, 2021 15:34
jotai-like API for recoil
import {
selector,
atom as recoilAtom,
useRecoilState,
useSetRecoilState,
AtomEffect,
RecoilState,
} from "recoil";
import type {
@nksaraf
nksaraf / graphiql.html
Last active December 10, 2020 01:02
GraphiQL with Explorer for servers
<!DOCTYPE html>
<html>
<head>
<style>
body {
height: 100vh;
margin: 0;
width: 100vw;
overflow: hidden;
}
@nksaraf
nksaraf / rollup-typescript.md
Created August 7, 2020 17:54 — forked from aleclarson/rollup-typescript.md
The best Rollup config for TypeScript libraries

Features

🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
.d.ts bundle
🧐 Source maps

Install

// AUTO-GENERATED
import {
NameNode,
DocumentNode,
OperationDefinitionNode,
VariableDefinitionNode,
VariableNode,
SelectionSetNode,
FieldNode,
@nksaraf
nksaraf / graphql-fetch.ts
Last active October 3, 2022 20:08
React Query with GraphQL
// Taken mostly from prisma-labs/graphql-request
import "isomorphic-unfetch";
import { print } from "graphql/language/printer";
import { DocumentNode } from "graphql";
export type Variables = { [key: string]: any };
export interface Headers {
[key: string]: string;
}