Skip to content

Instantly share code, notes, and snippets.

View chr33s's full-sized avatar

chris chr33s

View GitHub Profile
@chr33s
chr33s / index.js
Created August 29, 2025 08:21 — forked from AndreaMorone/index.js
Calculate Shopify Function Query Cost
const { parse } = require('graphql/language');
/**
* Calculates the cost of a GraphQL query based on its structure.
*
* @param {string} query - The GraphQL query to calculate the cost for.
* @param {boolean} [debug=false] - If true, additional debug information will be logged.
* @return {number} The total cost of the query.
*/
function calculateQueryCost(query, debug = true) {
@chr33s
chr33s / business-models.md
Created February 14, 2016 19:30 — forked from ndarville/business-models.md
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@chr33s
chr33s / gist:c26e11949b7cc4af6237
Created February 3, 2016 13:57
how I write modules
My thoughts on writing tiny reusable modules that each do just one
thing. These notes were adapted from an email I recently sent.
***
If some component is reusable enough to be a module then the
maintenance gains are really worth the overhead of making a new
project with separate tests and docs. Splitting out a reusable
component might take 5 or 10 minutes to set up all the package
overhead but it's much easier to test and document a piece that is