Skip to content

Instantly share code, notes, and snippets.

@HalCanary
HalCanary / slog_Lshortfile_example.go
Last active May 8, 2024 15:48
log/slog Lshortfile replacement example.
package main
import (
"os"
)
import (
"io"
"log/slog"
"path/filepath"
@gskema
gskema / color-gradient.js
Last active March 2, 2024 22:14
Generate gradient color from 2 or 3 colors using JavaScript. Example: https://jsfiddle.net/e18g5f3L/
/**
* You may use this function with both 2 or 3 interval colors for your gradient.
* For example, you want to have a gradient between Bootstrap's danger-warning-success colors.
*/
function colorGradient(fadeFraction, rgbColor1, rgbColor2, rgbColor3) {
var color1 = rgbColor1;
var color2 = rgbColor2;
var fade = fadeFraction;
// Do we have 3 colors for the gradient? Need to adjust the params.