Skip to content

Instantly share code, notes, and snippets.

View joocer's full-sized avatar

Justin Joyce joocer

View GitHub Profile
@joocer
joocer / color-gradient.js
Last active January 26, 2022 17:43 — forked from gskema/color-gradient.js
Generate gradient color from an arbitrary number of colors
function colorGradient(colors, fadeFraction) {
if (fadeFraction >= 1) {
return colors[colors.length - 1]
} else if (fadeFraction <= 0) {
return colors[0]
}
let fade = fadeFraction * (colors.length - 1);
let interval = Math.trunc(fade);
fade = fade - interval
@joocer
joocer / boolparser.py
Last active August 2, 2021 13:40 — forked from leehsueh/boolparser.py
Python Boolean Expression Parser/Evaluator
"""
Grammar:
========
Expression --> AndTerm { OR AndTerm}+
AndTerm --> Condition { AND Condition}+
Condition --> Terminal (>,<,>=,<=,==) Terminal | (Expression)
Terminal --> Number or String or Variable
Usage:
======
@joocer
joocer / bplustree.py
Last active April 25, 2021 19:34 — forked from savarin/bplustree.py
Python implementation of a B+ tree
"""
B+Tree Code Adapted From:
https://gist.github.com/savarin/69acd246302567395f65ad6b97ee503d
No explicit license when accessed on 2nd March 2020.
Other code:
(C) 2021 Justin Joyce.