Skip to content

Instantly share code, notes, and snippets.

View globalpolicy's full-sized avatar
💭
Bored

Global Policy globalpolicy

💭
Bored
View GitHub Profile
@globalpolicy
globalpolicy / index.html
Created July 7, 2020 09:01
Large matrix multiplication with GPU.js
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/gpu.js@latest/dist/gpu-browser.min.js"></script>
</head>
<body>
<script src="main.js"></script>
</body>
</html>
@globalpolicy
globalpolicy / index.html
Last active March 27, 2020 13:56
Covid19 simulation using realtime (daily) data - SIR model
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.min.js"></script>
<style>
#overlay {
position: fixed;
/* Sit on top of the page content */
display: block;
/* Hidden by default */
width: 100%;
/* Full width (cover the whole page) */
@globalpolicy
globalpolicy / index.html
Created March 25, 2020 18:17
SIR model in JavaScript
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.min.js"></script>
<div id="chartDiv">
<canvas id="chart" width="1200" height="600" style="border:1px solid">
</canvas>
</div>
<div>
<label for="beta">beta</label>
<input type="range" min="0" max="10" step=0.1 id="beta" class="inputs" value=3 title="Infection constant">
<span id="betaText">3</span>
@globalpolicy
globalpolicy / code.js
Last active March 7, 2020 15:13
MacCormack scheme for riverbed variation model
let chart, worker;
let Z0, Q, B, n, s0, porosity, a, b, reachLength, simulationTime, delX, delT, delayMs, qsInjected;
let calculatedProfiles;
function updateGraph() {
if (worker != undefined) {
worker.terminate();
}
worker = new Worker('worker.js');
@globalpolicy
globalpolicy / index.html
Created August 22, 2019 17:49
Convex hull with JavaScript and p5.js
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/p5.js"></script>
<script src="sketch.js"></script>
</head>
<body>
<div id="canvas"></div>
<input type="button" id="btnGo" value="Go" onclick="btnGoClicked()">
</body>
</html>