Skip to content

Instantly share code, notes, and snippets.

@konijn
konijn / index.html
Last active October 30, 2019 11:41 — forked from RomanPerekhrest/index.html
test_cycle #jsbench #jsperf (http://jsbench.github.io/#11a2b8507a7f9290c6ef6cda596f8179) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>test_cycle #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@konijn
konijn / gist:6636750
Created September 20, 2013 12:30 — forked from shamansir/gist:3007244
Overlapping squares in js
// Excerpt from: https://github.com/Animatron/player/blob/master/anm.collisions.js
function edgeTest(p1, p2, p3, r2) {
var rot = [ -(p2[1] - p1[1]),
p2[0] - p1[0] ];
var ref = (rot[0] * (p3[0] - p1[0]) +
rot[1] * (p3[1] - p1[1])) >= 0;
for (var i = 0, il = r2.length; i < il; i+=2) {