Skip to content

Instantly share code, notes, and snippets.

View TokenChingy's full-sized avatar

Jason Lei TokenChingy

  • HBF
  • Perth, Western Australia
  • 07:26 (UTC +08:00)
View GitHub Profile
@TokenChingy
TokenChingy / template.js
Last active September 11, 2019 06:49
A lightweight component template engine.
(async () => {
const head = document.querySelector('head');
const body = document.querySelector('body');
const includes = document.querySelectorAll('include');
const parser = new DOMParser();
const templates = {
styles: [],
scripts: [],
}
@TokenChingy
TokenChingy / seededRandomColor.js
Created March 22, 2019 05:24
Seeded random color generator in Javascript.
function seededRandomColor(seed) {
function LCG(s) {
return (Math.imul(741103597, s) >>> 0) / 2 ** 32;
}
const symbols = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {