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 / shopify.app.json
Created August 11, 2025 07:00
Shopify mcpdoc
[
{"name": "dev", "llms_txt": "https://shopify.dev/llms.txt"},
{"name": "api", "llms_txt": "https://shopify.dev/docs/api.txt"},
{"name": "api-admin", "llms_txt": "https://shopify.dev/docs/api/admin-graphql.txt"},
{"name": "api-customer", "llms_txt": "https://shopify.dev/docs/api/customer.txt"},
{"name": "api-storefront", "llms_txt": "https://shopify.dev/docs/api/storefront.txt"},
{"name": "app-bridge", "llms_txt": "https://shopify.dev/docs/api/app-bridge.txt"},
{"name": "cli", "llms_txt": "https://shopify.dev/docs/api/shopify-cli.txt"},
{"name": "polaris", "llms_txt": "https://shopify.dev/docs/beta/next-gen-dev-platform/polaris.txt"}
]
@chr33s
chr33s / react-native-version.sh
Last active May 22, 2019 05:33
automate [android,ios] build versions with package.json
#!/usr/bin/env bash -e
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
function android() {
MANIFEST_FILE="./android/app/build.gradle"
VERSION_NAME=$(grep versionName ${MANIFEST_FILE} | head -1 | sed 's/versionName //' | tr -d '[:space:]')
VERSION_CODE=$(grep versionCode ${MANIFEST_FILE} | head -1 | sed 's/versionCode //' | tr -d '[:space:]')

Keybase proof

I hereby claim:

  • I am chr33s on github.
  • I am chr33s (https://keybase.io/chr33s) on keybase.
  • I have a public key ASAj_bkYKn5P4If5qHUQDUwRnKM8_w35E6AvxrCpMEoAwgo

To claim this, I am signing this object:

@chr33s
chr33s / server.http.js
Last active January 17, 2017 19:26
server.http.js
'use strict'
const {contentType} = require('mime-types')
const {createServer} = require('http')
const {extname} = require('path')
const {readFile} = require('fs')
const server = createServer(function (req, res) {
if (req.method === 'HEAD' || req.method === 'GET') {
const file = req.url.substr(1) || 'index.html'
@chr33s
chr33s / minimal
Last active July 28, 2016 20:00
debian
su
apt-get install sudo
adduser chr33s sudo
exit
sudo vi /etc/apt/sources.list
>>>
deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free
@chr33s
chr33s / iptables
Created July 28, 2016 18:54
firewall
#!/bin/bash
# /etc/network/if-pre-up.d/iptables
iptables-restore < /etc/iptables/rules.v4
ip6tables-restore < /etc/iptables/rules.v6
@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
char *x; // x: a pointer to char
char x[3]; // x: an array[3] of char
char x(); // x: a function() returning char
char *x[3]; // x: an array[3] of pointer to char
char (*x)[3]; // x: a pointer to array[3] of char
char **x; // x: a pointer to pointer to char
char *x(); // x: a function() returning pointer to char
char *x()[3]; // x: a function() returning array[3] of pointer to char
char (*x[])(); // x: an array[] of pointer to function() returning char
char (*x())(); // x: a function() returning pointer to function() returning char