Skip to content

Instantly share code, notes, and snippets.

View danstarns's full-sized avatar
🤟

Daniel Starns danstarns

🤟
View GitHub Profile
@danstarns
danstarns / usdt-gbp.js
Created November 29, 2023 16:16
USDT/GBP
// Run this in node 18 and up
(async () => {
const API_KEY = `KEY`;
const url = `https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=USDT&CMC_PRO_API_KEY=${API_KEY}&convert=GBP`;
const response = await fetch(url, {
method: "GET",
headers: {
Accept: "application/json",
},
@danstarns
danstarns / mock.ts
Last active February 2, 2023 13:05
mocking-gql-api
import express from "express"
import { createYoga } from "graphql-yoga";
import { makeExecutableSchema } from "graphql-tools";
const app = express();
// GraphQL Schema
const schema = makeExecutableSchema({
typeDefs,
resolvers,
@danstarns
danstarns / graphql-otel-photos.md
Last active October 12, 2022 18:53
graphql-otel-photos

Screenshot 2022-10-12 at 20 50 52

# Screenshots

Screenshot 2022-10-12 at 16 46 49

@danstarns
danstarns / cricket-club-js.js
Created September 27, 2022 14:55
cricket-club-js
const nameInputs = document.querySelectorAll("input[type=text]");
const firstName = nameInputs[0];
const secondName = nameInputs[1];
firstName.value = "Daniel";
secondName.value = "Starns";
const checkboxes = document.querySelectorAll("input[type=checkbox]");
const sixPM = checkboxes[0];
@danstarns
danstarns / img-Looking ahead with GraphQL.md
Created July 16, 2022 19:07
img-Looking ahead with GraphQL.md

IMG

Looking ahead with GraphQL

@danstarns
danstarns / create-movies-example-gql.gql
Created April 10, 2022 18:09
create-movies-example-gql
mutation {
createPeople(
input: [
{
name: "Tom Hanks"
movies: {
create: [
{
node: {
name: "Forrest Gump"
@danstarns
danstarns / read-movies-example-response.json
Created April 10, 2022 18:07
read-movies-example-response
{
"people": [
{
"name": "Tom Hanks",
"movies": [
{
"title": "Forrest Gump",
"genres": [{ "name": "Drama" }, { "name": "Romance" }]
}
]
@danstarns
danstarns / read-movies-example-gql.gql
Created April 10, 2022 18:07
read-movies-example-gql
query {
people(where: { name: "Tom Hanks" }) {
name
movies {
title
genres {
name
}
}
}
@danstarns
danstarns / example-neo4j-graphql.js
Created April 10, 2022 17:52
example-neo4j-graphql
import { Neo4jGraphQL } from "@neo4j/graphql";
import * as neo4j from "neo4j-driver";
import { ApolloServer } from "apollo-server";
const typeDefs = `
type Movie {
title: String!
actors: [Person!]! @relationship(type: "ACTED_IN", direction: IN)
genres: [Genre!]! @relationship(type: "In_GENRE", direction: OUT)
}
@danstarns
danstarns / movies-gql.gql
Created April 10, 2022 17:48
movies-gql
type Movie {
title: String!
actors: [Person] @relationship(type: "ACTED_IN", direction: IN)
genres: [Genre] @relationship(type: "In_GENRE", direction: OUT)
}
type Person {
name: String!
movies: [Movie] @relationship(type: "ACTED_IN", direction: OUT)
}