Skip to content

Instantly share code, notes, and snippets.

query {
mapleton: allFile(filter: { sourceInstanceName: { eq: "mapleton" } }) {
...FilesWithFluid
}
belair: allFile(filter: { sourceInstanceName: { eq: "belair" } }) {
...FilesWithFluid
}
robertsonTower: allFile(
filter: { sourceInstanceName: { eq: "robertson-tower" } }
) {
@vladar
vladar / gatsby-node.js
Created September 7, 2020 14:52
onPreInit bug
exports.onPreInit = (gatsbyApi, pluginOptions) => {}
exports.sourceNodes = async (gatsbyApi) => {
const {cache, reporter} = gatsbyApi
reporter.info('Testing cache');
reporter.info(await cache.get('test'));
reporter.info('Setting cache');
await cache.set('test', 'someValue');
reporter.info('Checking if set succesfully');
reporter.info(await cache.get('test'));
@vladar
vladar / example.js
Last active April 3, 2021 12:36
Dynamic nested connections in GraphQL
const query = graphql`
{
allFoo(filter: { foo: { eq: "foo" }}) {
nodes {
id
foo
fooBars @connect(field: "allBar", filter: { fooId: { eq: this__id } }) {
nodes {
bar
}
@vladar
vladar / gc-test.js
Last active April 28, 2021 21:44
Testing garbage collection with `lmdb-store` using `cache` option
// node --expose-gc gc-test.js
// CACHE=1 node --expose-gc gc-test.js
const { open } = require("lmdb-store")
const ptop = require("process-top")()
let rootDb
function getRootDb() {
if (!rootDb) {
rootDb = open({
name: `root`,
@vladar
vladar / bench.js
Created July 7, 2021 17:47
Sorting data with lmdb-store
console.time(`lmdb-init`)
const { open } = require("lmdb-store")
const store = open({
name: `store`,
path: process.cwd() + `/test`,
})
const db = store.openDB({
name: `db`,
})
@vladar
vladar / pr-22377.gql
Last active August 12, 2023 08:23
Medium Schema Customization
type MediumCollection implements Node @derivedTypes @dontInfer {
name: String
slug: String
tags: [String]
creatorId: String
description: String
shortDescription: String
image: MediumCollectionImage
metadata: MediumCollectionMetadata
virtuals: MediumCollectionVirtuals
@prop(
"user",
fragment on User {
id, firstName, lastName
comments: ...UserComments
}
)
function MyComponent({ user }) {
return <UserComments comments={user.comments}>