Skip to content

Instantly share code, notes, and snippets.

@nikolay-govorov
nikolay-govorov / fonts.py
Created May 5, 2021 04:26
Generate woff and woff2 fromt TTF
# pip install brotli fonttools
from os import listdir
from os.path import isfile, join
from fontTools.ttLib import TTFont
path_fonts = './static/fonts/alegreya-sans'
path_ttf = f'{path_fonts}/ttf'
path_woff = f'{path_fonts}/woff'
@Ravaelles
Ravaelles / numberToColor
Created April 16, 2018 09:51
PHP function that converts number from given range into a color from given gradient of multiple colors
// See example: https://image.prntscr.com/image/cTIv8JkLR7yWEQxVev9SyA.jpeg
function numberToColor($value, $min, $max, $gradientColors = null)
{
// Ensure value is in range
if ($value < $min) {
$value = $min;
}
if ($value > $max) {
$value = $max;