Skip to content

Instantly share code, notes, and snippets.

@nameofname
nameofname / dataloader.js
Last active November 18, 2019 23:09
Testing out batch functionality with dataloader
const DataLoader = require('dataloader');
const data = [
{id: 1},
{id: 2},
{id: 3},
];
const myLoader = new DataLoader(keys => {
const results = keys.map(key => data[key - 1]);
@nameofname
nameofname / paramsAndRange.js
Last active September 27, 2017 19:36
Params and range params
// GraphQL Schema with regards to applied filters :
// appliedFilters{
// name
// rank
// values{
// displayName
// urlLabel
// code
// count
// }
@nameofname
nameofname / filtersVsFacets.js
Created July 31, 2017 18:13
Filters and Facets
// sample graphQl Query
// for our use case, we can ignore facets
/**
filters{
name
values{
urlLabel
displayName
count
}
@nameofname
nameofname / filterDataStructures.js
Created July 19, 2017 17:24
Different data structures for filters - eg. structures I could use in my redux store to represent filter state
// concepts :
// a filterName is the name of the filter, like color or category
// the filter values each have a name, value, and priority
// name = a display name for the filter option
// value = uid or other identifyer for filter option
// priority = the order in which the filter option was applied, since filters applied first have a different impact on the URL and other SEO related features
// SOLUTION 1 :
// this structure supports the idea that grouping by filter (ie. category 1 or color) is more important than grouping by filter priority
@nameofname
nameofname / image-contracts-v3.json
Last active September 15, 2015 19:19
New Image Contract idea
// NOTE* The notations below assume that there is only 1 size per image, ie. new dynamically sized images are already working :
// POST a new image :
// soa/inventory-3/2/image
// payload : multi part form-data
// return value :
{
id : '123',
original : '/path/to/original.jpeg',
master : '/path/to/master.jpeg',