This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { sqrt, sin, cos, sinh, cosh, tanh, sign, round, PI, abs } = Math; | |
const pi = PI; | |
/** Solves the wave equation for a beam | |
* | |
* @param {number} N Number of modes | |
* @param {number} L Length | |
* @param {number} W Width | |
* @param {number} H Height | |
* @param {number} M Mass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
</head> | |
<body> | |
<input type="file" id="fileinput"></input> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(window); | |
console.log(this); | |
console.log(globalThis); | |
console.log([ | |
[ | |
"Object", | |
"Function", | |
"Array", | |
"Number", | |
"parseFloat", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const diff = (A,B) => [A,B].map((x,i,a)=>x.filter(y=>!a[(i+1)%2].includes(y))); | |
const unique = (A,B) => [...new Set([...A, ...B])]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"Object", | |
"Function", | |
"Array", | |
"Number", | |
"parseFloat", | |
"parseInt", | |
"Infinity", | |
"NaN", | |
"undefined", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = { | |
name: "obj", | |
userData: { | |
position: { | |
x: 3, | |
y: 4, | |
z: 10 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a tagged template function for using inline glsl in javascript. | |
* Also helpful for inline html, css, etc. | |
* | |
* @param x this is the template literal split up by the arguments | |
* @param args the arguments passed in ${like.this} | |
* @returns {string} the joined string | |
* | |
* @example | |
* const frag = glsl` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function base_10_to_base_n(v: number,b: number,r:number[]=[]): number[]{ | |
if(b==0) return; | |
if (Math.floor(v) != v || Math.floor(b) != b) return; | |
const div = Math.floor(v / b); | |
const rem = v - div * b | |
r.push(rem); | |
return div == 0 ? r.reverse() : base_10_to_base_n(div, b, r); | |
} | |
function base_n_to_base_10(val: number[], base: number) { | |
if (base == 0) return; |