Skip to content

Instantly share code, notes, and snippets.

@Eunomiac
Eunomiac / ai-conversation-few-shot-prompting.markdown
Created April 30, 2024 07:49
Ai Conversation: Few-Shot Prompting
@Eunomiac
Eunomiac / realTypeOf.js
Created February 22, 2024 19:11
realTypeOf() --- Enhanced JavaScript type checker extending typeof with precise definitions for numbers, objects, functions, and more.
/**
* @module realTypeOf
* @version 1.0.0
* @date 2024-02-22
* @author Ryan West ("Eunomiac")
* @discord Eunomiac#8172
* @github https://github.com/Eunomiac
* @codepen https://codepen.io/eunomiac
*
* @description This module provides enhanced type determination functionalities for JavaScript values.
@Eunomiac
Eunomiac / arraySupport.js
Last active January 2, 2021 09:25
Adding support for array indices in Foundry dot notation, both Javascript and Handlebars syntax (i.e. "array[0]" and "array.[0]")
// ***************************************
// *** CHANGED FUNCTIONS *****************
// *** (test cases at bottom) ************
// ***************************************
/**
* Flatten a possibly multi-dimensional object to a one-dimensional one by converting all nested keys to dot notation.
* Array indices will be converted to javascript-standard syntax, e.g. "data.object.array[1].object.key"
* @param {Object|Array} obj The object or array to flatten
* @param {Number} _d Recursion depth, to prevent overflow
@Eunomiac
Eunomiac / mixins.js
Last active November 16, 2022 13:23
A fully modular method of applying seamless Mixins to Javascript classes, intended for Foundry VTT development.
/* MIXINS GUIDE
A "mixin" is a block of code that can be injected into any class, without regard to the standard chain of inheritance.
This allows code to be written once, as a mixin, and then applied to any number of classes regardless of whether they
inherit from each other.
In the context of Foundry, this is especially helpful for code that is shared between the Actor and Item classes (or
subclasses thereof), which would normally have to be duplicated within each.
It also provides a new means of sharing code, since integrating a mixin into an existing class is seamless, requiring
@Eunomiac
Eunomiac / AirbagStart.js
Last active July 5, 2021 03:51 — forked from VoltCruelerz/AirbagStart.js
Airbag - Roll20 API Crash Handler
/* eslint-disable */
let MarkStart = () => true;
let MarkStop = () => true;
let airIndex = new Error();
/* TO TEMPORARILY DISABLE AIRBAG:
//
// * - Disable the 'AirbagSTOP.js' script in your game's API Scripts page.
// * - Comment out everything below by deleting this end comment marker ⇒ */
// - To reactivate, reverse the above steps.