Skip to content

Instantly share code, notes, and snippets.

View y-a-v-a's full-sized avatar
🕳️

Vincent Bruijn y-a-v-a

🕳️
View GitHub Profile
@y-a-v-a
y-a-v-a / checkCssHas.js
Created September 9, 2022 12:11
Simple feature detection for CSS :has()
(function() {
const s = document.createElement('style');
s.textContent = `.supportsHas:has(p):after {content: "hasHas";}`;
document.head.appendChild(s);
const supportsHas = document.createElement('div');
supportsHas.classList.add('supportsHas');
const p = document.createElement('p');
supportsHas.appendChild(p);
document.body.appendChild(supportsHas);
@ericelliott
ericelliott / essential-javascript-links.md
Last active July 18, 2024 15:03
Essential JavaScript Links
@banksean
banksean / mersenne-twister.js
Created February 10, 2010 16:24
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();