Skip to content

Instantly share code, notes, and snippets.

View danstarns's full-sized avatar
🤟

Daniel Starns danstarns

🤟
View GitHub Profile
@litewarp
litewarp / wrapper.ts
Last active July 4, 2021 19:27
Neo4j Work-Around for Apollo Argument Name Constraints
// temporary fix for https://github.com/neo4j/graphql/issues/292
import { wrapSchema, RenameInputObjectFields } from '@graphql-tools/wrap'
import { Neo4jGraphQL } from '@neo4j/graphql'
import { typeDefs } from './typeDefs'
// renames all InputObjectFields matching 'skip'
// see https://www.graphql-tools.com/docs/schema-wrapping#renaming
const renamingFn = (typeName: string, fieldName: string): string => {
@praveenweb
praveenweb / AuthorSubscriptions.svelte
Created May 23, 2019 12:04
GraphQL Subscriptions using Svelte
<script context="module">
import gql from 'graphql-tag';
import { client } from './apollo';
import { subscribe } from 'svelte-apollo';
const AUTHOR_LIST = gql`
subscription {
author(order_by: [{name: asc}]) {
name
@langpavel
langpavel / mergeExtensionsIntoAST.js
Last active December 4, 2020 15:37
GraphQL: Merge Extensions Into AST
const invariant = require('invariant');
const { Kind } = require('graphql');
const byKindGetInfo = {
// SchemaDefinition
[Kind.SCHEMA_DEFINITION]: def => ({
isExtension: false,
type: 'schema',
typeName: 'schema',
}),
@MagRelo
MagRelo / index.js
Last active February 28, 2023 14:03
local websocket connection to ganache-cli
const Web3 = require('web3')
// *WRONG*
// const localProviderUrl = 'wss://localhost:8545'
// Result:
//
// connection not open on send()
// Error in subscription wss://localhost:8545
// Error: connection not open
@iisaint
iisaint / index.js
Last active December 10, 2021 01:20
Using node.js to deploy a smart contract
const Web3 = require('web3');
const fs = require('fs');
const solc = require('solc');
/*
* connect to ethereum node
*/
const ethereumUri = 'http://localhost:8540';
const address = '0x004ec07d2329997267Ec62b4166639513386F32E'; // user
digraph architecture {
rankdir=LR;
// Storage - #303F9F (dark blue)
node[fillcolor="#303F9F" style="filled" fontcolor="white"];
database[label="DB"]; cache[label="Redis"];
// Client-side Apps - #FFEB3B (yellow)
node[fillcolor="#FFEB3B" style="filled" fontcolor="black"];
front_end[label="Front-end App"]; extension[label="Browser Extension"];
@citrusui
citrusui / dropdown.md
Last active April 21, 2024 18:44
"Dropdowns" in Markdown
How do I dropdown?
This is how you dropdown.

<details>
<summary>How do I dropdown?</summary>
<br>
This is how you dropdown.
@stubailo
stubailo / graphql-subscriptions.js
Last active October 12, 2020 22:40
A very basic demo of GraphQL subscriptions with the graphql-subscriptions package
// npm install graphql graphql-tools graphql-subscriptions
const { PubSub, SubscriptionManager } = require('graphql-subscriptions');
const { makeExecutableSchema } = require('graphql-tools');
// Our "database"
const messages = [];
// Minimal schema
const typeDefs = `
type Query {