git submodule add https://github.com/janjarfalk/canvasrunner.git components/canvasrunner/
git submodule foreach git pull origin master
cd ..
git commit . -m "Updated submodules"
// http://toddmotto.com/mastering-svg-use-for-a-retina-web-fallbacks-with-png-script/ | |
function supportsSVG() { | |
return !! document.createElementNS && !! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect; | |
} | |
if (!supportsSVG()) { | |
var imgs = document.getElementsByTagName('img'); | |
var dotSVG = /.*\.svg$/; | |
for (var i = 0; i != imgs.length; ++i) { | |
if(imgs[i].src.match(dotSVG)) { |
<html> | |
<head></head> | |
<body style='height: 600px; background-color: #fafafa;'> | |
<div>IFRAME</div> | |
<script> | |
var setHeight = function() { | |
parent.postMessage({iframeHeight: document.documentElement.clientHeight}, '*'); | |
}; | |
window.onresize = function() { | |
setHeight(); |
/* | |
Returns a random point of a sphere, evenly distributed over the sphere. | |
The sphere is centered at (x0,y0,z0) with the passed in radius. | |
The returned point is returned as a three element array [x,y,z]. | |
*/ | |
function randomSpherePoint(x0,y0,z0,radius){ | |
var u = Math.random(); | |
var v = Math.random(); | |
var theta = 2 * Math.PI * u; | |
var phi = Math.acos(2 * v - 1); |
const exportCanvasAsPNG = (canvasElement, fileName) => { | |
var MIME_TYPE = "image/png"; | |
var imgURL = canvasElement.toDataURL(MIME_TYPE); | |
var dlLink = document.createElement('a'); | |
dlLink.download = fileName; | |
dlLink.href = imgURL; | |
dlLink.dataset.downloadurl = [MIME_TYPE, dlLink.download, dlLink.href].join(':'); |
G21 | |
G0 X-2 Y0 | |
M3 | |
G1 X-1 Y0 | |
G1 X-1 Y1 | |
G1 X0 Y0 | |
G1 X0 Y1 | |
G1 X1 Y0 | |
G1 X2 Y0 | |
M5 |
function NormSInv(p) { | |
var a1 = -39.6968302866538, a2 = 220.946098424521, a3 = -275.928510446969; | |
var a4 = 138.357751867269, a5 = -30.6647980661472, a6 = 2.50662827745924; | |
var b1 = -54.4760987982241, b2 = 161.585836858041, b3 = -155.698979859887; | |
var b4 = 66.8013118877197, b5 = -13.2806815528857, c1 = -7.78489400243029E-03; | |
var c2 = -0.322396458041136, c3 = -2.40075827716184, c4 = -2.54973253934373; | |
var c5 = 4.37466414146497, c6 = 2.93816398269878, d1 = 7.78469570904146E-03; | |
var d2 = 0.32246712907004, d3 = 2.445134137143, d4 = 3.75440866190742; | |
var p_low = 0.02425, p_high = 1 - p_low; | |
var q, r; |
let triple = (target) => | |
for (a in 1 to target / 3) { | |
for (b in a + 1 to target / 2) { | |
let c = target - a - b; | |
if (a * a + b * b === c * c) { | |
Js.log(a * b * c) | |
} | |
} | |
}; |
let triplet target = | |
let rec next a b = | |
let c = target - a - b in | |
match (a * a + b * b == c * c) with | |
| true -> a * b * c | |
| false when b < target / 2 -> next a (b + 1) | |
| false when a < target / 3 -> next (a + 1) (a + 2) | |
| _ -> 0 in | |
next 1 2 |