Skip to content

Instantly share code, notes, and snippets.

View esatterwhite's full-sized avatar
:octocat:

Eric Satterwhite esatterwhite

:octocat:
View GitHub Profile
@esatterwhite
esatterwhite / subclass.js
Last active September 30, 2023 03:13
Classes stop being classes
'use strict';
function typeOf( item ){
if(item === null) {
return 'null';
} else if(item === undefined) {
return 'undefined';
}
if( typeof item.$family == 'function' ){
@esatterwhite
esatterwhite / inputs.js
Last active October 1, 2023 03:21
possible input / output jsonb aggregate
// inputs
{
"a" : {
@esatterwhite
esatterwhite / zdb-agg.sql
Last active October 1, 2023 03:23
zdb spotlite search query example
WITH results AS (
select
JSONB_ARRAY_ELEMENTS(
zdb.extract_the_agg_data(
index => 'spotlite_zdx'
, field => 'organization_id'
, response => arbitrary_agg::JSONB
) -> 'buckets'
) AS bucket
FROM zdb.arbitrary_agg(
@esatterwhite
esatterwhite / fastify-registered-schemas.js
Last active October 1, 2023 03:21
Wonky fastify schema validation handling
'use strict'
const fastify = require('fastify')
const fluent = require('fluent-json-schema')
const WhizBang = fluent
.object()
.additionalProperties(false)
.id('whizbang')
.title('WhizBang')
.prop(
@esatterwhite
esatterwhite / pgquery.js
Created March 19, 2024 17:43
a valiant effort at a simple query builder for postgres
'use strict'
const kClause = Symbol('kQueryClause')
const kPosition = Symbol('kQueryPosition')
const kWhere = Symbol('kQueryWhere')
const AND_BREAK = '\nAND '
const ISNULL_EXP = /true|1/
const SELECT_EXP = /^SELECT/i
const SELECT_REPLACEMENT = 'SELECT 1::SMALLINT as __id, '
@esatterwhite
esatterwhite / esatterwhite.posh.json
Created October 7, 2025 01:04
oh-my-posh theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"properties": {
"cache_duration": "none",
@esatterwhite
esatterwhite / .vimspector.json
Created March 8, 2026 08:35
vimspector for node
{
"configurations": {
"debug": {
"adapter": "js-debug",
"default": true,
"filetypes": ["javascript", "typescript"],
"configuration": {
"request": "launch",
"program": "${file}",
"cwd": "${workspaceRoot}",