Skip to content

Instantly share code, notes, and snippets.

View ajskateboarder's full-sized avatar

Aditya J ajskateboarder

View GitHub Profile
@FedericoPonzi
FedericoPonzi / CI.yml
Last active May 4, 2024 07:19
Ready to use Github workflow for cross-compiling a rust binary to many Linux architectures.
# Instruction + template repo: https://github.com/FedericoPonzi/rust-ci
# Search and replace <YOUR_BINARY_NAME> with your binary name.
name: CI
on:
pull_request:
push:
branches:
- master
tags:
@dbisso
dbisso / state.js
Last active May 6, 2024 03:06
Simple state management in vanilla JS
function State() {
this.actions = {};
this.subscriptions = [];
this.history = [];
}
State.prototype.subscribe = function(element, action, callback) {
this.subscriptions[action] = this.subscriptions[action] || [];
this.subscriptions[action].push(function(data) {
callback.apply(element, data);
@mjackson
mjackson / color-conversion-algorithms.js
Last active April 14, 2024 08:46
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation