Skip to content

Instantly share code, notes, and snippets.

View dfrtz's full-sized avatar

David dfrtz

View GitHub Profile
@dfrtz
dfrtz / pandas.mjs
Created January 11, 2025 22:45
Use Pandas to filter Javascript arrays
/**
* @file Utilities for running Pandas queries against a Javascript dataset.
*
* @summary Pandas query utilities.
*
* @version 1.0.0
*
* @author David Fritz
* @copyright 2025 David Fritz
* @license MIT
@dfrtz
dfrtz / python-worker.mjs
Last active January 12, 2025 16:12
Run Python in the browser via WebAssembly
/**
* @file Utilities for running Python in a background browser thread using Pyodide (WebAssembly).
*
* @summary Python WebWorker runner utilities.
*
* @version 1.0.0
*
* @author David Fritz
* @copyright 2025 David Fritz
* @license MIT
@dfrtz
dfrtz / dashx-duckdb.mjs
Created January 8, 2025 00:45
Use DuckDB to filter Javascript arrays
/**
* @file Utilities for running DuckDB queries against a Javascript dataset.
*
* @summary DuckDB query utilities.
*
* @version 1.0.0
*
* @author David Fritz
* @copyright 2025 David Fritz
* @license MIT

Plotly Dash Custom Table

100% JS alternative to Plotly Dash DataTable, with full control over filtering and formatting.

Uses standard HTML component trees, MATCH based callbacks, and dash_clientside to perform the same behaviors (and more) without any Typescript or custom React components. The tree can be created in Python or Javascript, as long as the required components are added.

Also provides a general example for other custom "State" type classes that can be used to make Javascript based components without an NPM setup.

@dfrtz
dfrtz / Plotly Dash Clientside Components.md
Last active January 15, 2025 15:49
Plotly Dash Clientside Components

Plotly Dash Clientside Components

Basic library and example of how to create Plotly Dash components in clientside operations.

How To

  1. Save the dashx.js file to assets/dashx.js, or a custom asset location.
  2. Return components from JS calls similar to Python components. e.g. Dash.html.Div({children: "Hello World!"})

Full example

@dfrtz
dfrtz / jspython.js
Last active January 15, 2025 18:31
Lightweigtht code snippets to replicate python in javascript.
/**
* @file A collection of global library functions used for similar functionality across JS and Python.
*
* @summary Javascript helpers for common Python actions.
*
* @author David Fritz
* @version 1.0.0
*
* @copyright 2024 David Fritz
* @license MIT
@dfrtz
dfrtz / save-cloud-configs.sh
Created June 2, 2024 14:02
Load configuration files from cloud secrets, such as AWS and GCP
#!/bin/bash
# Load configuration files from cloud services, such as AWS and GCP.
# Available config ENV variables:
# AWS_SECRETS_TO_CONFIGS
# GCP_SECRETS_TO_CONFIGS
#
# Set secrets to load as configs with the following format:
# <ENV key>="<secret1>:<file1>,<secret2>:<file2>,..."