Skip to content

Instantly share code, notes, and snippets.

View danstarns's full-sized avatar
🤟

Daniel Starns danstarns

🤟
View GitHub Profile
@danstarns
danstarns / cypher-graphql-subqueries-response.json
Created April 10, 2022 16:19
cypher-graphql-subqueries-response
{
"actor": {
"name": "Tom Hanks",
"movies": [
{
"title": "Forrest Gump",
"genres": [{ "name": "Drama" }, { "name": "Romance" }]
}
]
}
@danstarns
danstarns / cypher-graphql-subqueries.gql
Last active April 10, 2022 16:16
cypher-graphql-subqueries
MATCH (actor:Person {name: "Tom Hanks"})
CALL {
WITH actor
MATCH (actor)-[:ACTED_IN]->(movie:Movie)
CALL {
WITH movie
MATCH (movie)-[:IN_GENRE]->(g:Genre)
RETURN g {.*} AS genres
}
RETURN movie {.*, genres: genres} AS movies
@danstarns
danstarns / cypher-coactors-coactors.gql
Last active April 10, 2022 16:10
cypher-coactors-coactors
MATCH (tom:Person {name: 'Tom Hanks'})
MATCH (tom)-[:ACTED_IN]->(:Movie)<-[:ACTED_IN]-(:Person)-[:ACTED_IN]->(:Movie)<-[:ACTED_IN]-(coCoActor:Person)
WHERE
tom <> coCoActor AND
NOT (tom)-[:ACTED_IN]->(:Movie)<-[:ACTED_IN]-(coCoActor)
RETURN coCoActor.name
@danstarns
danstarns / cypher-co-actors.gql
Last active April 10, 2022 16:08
cypher-co-actors
MATCH (p:Person {name: 'Tom Hanks'})
MATCH (p)-[:ACTED_IN]->(:Movie)<-[:ACTED_IN]-(coActor:Person)
RETURN coActor.name
@danstarns
danstarns / read-movies-json.json
Last active April 8, 2022 14:19
read-movies-json
{
"title": "Forrest Gump",
"actors": [{ "name": "Tom Hanks" }],
"genres": [{ "name": "Drama" }, { "name": "Romance" }]
}
@danstarns
danstarns / read-movies-cypher.gql
Created April 8, 2022 14:16
read-movies-cypher
MATCH (m:Movie {title: "Forrest Gump"})
MATCH (m)<-[:ACTED_IN]-(actors:Person)
MATCH (m)-[:IN_GENRE]->(genres:Genre)
RETURN m {.title, actors: collect(actors), genres: collect(genres)}
@danstarns
danstarns / create-movie-graphql-cypher.gql
Created April 8, 2022 14:01
create-movie-graphql-cypher
CREATE (m:Movie {title: "Forrest Gump"})<-[:ACTED_IN]-(:Person {name: "Tom Hanks})
CREATE (m)-[:IN_GENRE]->(:Genre {name: "Drama"})
CREATE (m)-[:IN_GENRE]->(:Genre {name: "Romance"})
@danstarns
danstarns / Neo4j GraphQL Auth.md
Last active January 13, 2022 08:47
Neo4j GraphQL Auth

Neo4j GraphQL Plugins

TL;DR

  • Extract the JWT decode functionality into a new library: @neo4j/graphql-plugins
  • Expose an extended AuthPlugin class that has a decodeJWT method on it. The class extends a ‘core’ abstract class called Neo4jGraphQLAuthPlugin exported directly from @neo4j/graphql.
  • Expose ability for users to specify plugins in Neo4jGraphQL constructor
  • Call a given plugin

Background

@danstarns
danstarns / neo4j-chainlink-query.gql
Created January 9, 2022 09:25
neo4j-chainlink-query.gql
@danstarns
danstarns / through.sol
Created January 8, 2022 21:22
example-contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
contract ExampleContract is ChainlinkClient {
using Chainlink for Chainlink.Request;
bytes32 public longestMovieTitle;