This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Lightweight AJAX library for single get, multiple get, and full REST | |
queries. Will eventually be porting this to modern "fetch() => then...", if | |
we can map the same (very useful) API. NOT cross-platform (e.g., IE is | |
explicitly not supported, which makes things VERY simple). | |
*/ | |
define(function (require, exports, module) { | |
exports.get = function (url, callback) { | |
let xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Attaches pub/sub behavior to the given object. Returns a function that | |
attaches pub/sub behavior, including an *eventListeners* property, to the | |
given object or prototype function. Usage is simple; assume TestObj is a | |
constructor: | |
> pubsub(TestObj); | |
> var to = new TestObj(); | |
> to.subscribe('trigger', function(eventObj) { | |
console.log(this); | |
console.log(eventObj); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* JavaScript Type Extensions (jtx) provides useful methods associated with | |
specific JavaScript datatypes, but (unlike previous implementations) without | |
monkey patching. | |
*/ | |
define(function(require, exports, module) { | |
exports.String = {}; | |
exports.Array = {}; | |
exports.Object = {}; | |
exports.Date = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Object-based for DOM animation management of style properties. | |
*/ | |
define(function(require, exports, module) { | |
function Animaniac() { | |
/* Initializes animation object with default parameters. Users will | |
typically assign the following properties before calling "start()": | |
* element (the relevant DOM element) | |
* properties (style property keys with 2-element initial/final values Array) | |
* callback (what to invoke when the transition has finished) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* https://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot | |
Once figure/axis handle is initialized, the dependency tree for new series | |
and handle property modifications is, order of update required: | |
#. <svg/> dimensions | |
#. margin | |
#. title, xlabel, ylabel positions | |
#. x/y scales | |
#. x/y axes | |
#. point positions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Collection of useful utilities for processing and transforming color values. | |
*/ | |
define(function(require, exports, module) { | |
let THREE = require("lib/three-v0.115.0"); | |
exports.hsv2rgb = function(hsv) { | |
/* Useful HSV-to-RGB conversion | |
*/ | |
let hue = hsv[0] * 360; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Useful collection of numerical methods | |
*/ | |
define(function(require, exports, module) { | |
function quadratic(a, b, c) { | |
/* Returns a two-element Array of root solutions to the quadratic | |
defined by the coefficients a, b, and c. Depending on the solution, | |
one or both elements may be NaN. | |
*/ | |
let b2 = Math.pow(b, 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Basic reusable server base, using Flask-based WSGI application served | |
asynchronously with gevent.pywsgi; provides a nice template / starting point | |
that I've reused several dozen times. | |
""" | |
import os | |
import flask | |
from gevent import pywsgi | |
MOD_PATH, _ = os.path.split(os.path.abspath(__file__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Single-file JavaScript module that defines a developer-friendly interface | |
for adapting, and using, AMD-compatible modules in a threaded manner using | |
WebWorkers. There are two components: | |
1. The first ("if") block is evaluated by the WebWorker, which should | |
include the following line at the beginning of the file: | |
> importScripts("WebThread.js"); | |
The module in question, which should be single-file (dependency-free), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*/ | |
define(function(require, exports, module) { | |
let D2R = Math.PI / 180; | |
let sum = function(series) { return series.reduce(function(a=0, b) { return a + b; } ) }; | |
/** | |
* Returns a unit vector (3-element Array) for the given phi and theta | |
* values. |
OlderNewer