Skip to content

Instantly share code, notes, and snippets.

View darbicus's full-sized avatar

Darby Rathbone darbicus

  • Texas
View GitHub Profile
@darbicus
darbicus / docCookies.js
Created April 17, 2014 15:47
A complete cookies reader/writer framework with full unicode support.
/*\
|*|
|*| :: cookies.js ::
|*|
|*| A complete cookies reader/writer framework with full unicode support.
|*|
|*| https://developer.mozilla.org/en-US/docs/DOM/document.cookie
|*|
|*| This framework is released under the GNU Public License, version 3 or later.
|*| http://www.gnu.org/licenses/gpl-3.0-standalone.html
@darbicus
darbicus / duplicate remover
Created April 11, 2014 15:09
filter out objects that have the same id
var array = [{
'id': 1
}, {
'id': 2
}, {
'id': 2
}, {
'id': 2
}];
@darbicus
darbicus / bb.js
Last active August 29, 2015 13:57
bb.js
"use strict";
(function () {
function toArray(list) {
return Array.prototype.slice.call(list);
}
var list = {}, replacements = {},
re = /(\{\{)(\w+)(\}\})/gi;
document.body.innerHTML = document.body.innerHTML.replace(re, function (b, a, c) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html>
@darbicus
darbicus / clock.js
Created February 27, 2014 03:35
clock.js
onmessage = function (event) {
var context = new CanvasRenderingContext2D();
event.data.setContext(context); // event.data is the CanvasProxy object
setInterval(function () {
context.clearRect(0, 0, context.width, context.height);
context.fillText(new Date(), 0, 100);
context.commit();
}, 1000);
};
@darbicus
darbicus / icosahedron.js
Last active September 26, 2022 08:28
3d icosahedron on a 2d canvas
function Point3d(a, c, b) {
this.x = (a === undefined) ? 0 : a;
this.y = (c === undefined) ? 0 : c;
this.z = (b === undefined) ? 0 : b;
this.fl = 400;
this.vpX = 0;
this.vpY = 0;
this.cX = 0;
this.cY = 0;
this.cZ = 0
@darbicus
darbicus / index.html
Created January 1, 2014 18:30
A Pen by Darby Rathbone.
<script type="text/js-worker">
</script>
<textarea rows="20" cols="100" id='workersrc'>onmessage = function (e) {
if(e.data == "draw") w.getPoints();
var d = JSON.parse(e.data);
if(JSON.parse(e.data).action == "add") w.addBall(parseFloat(d.x), parseFloat(d.y), 0, 0, parseFloat(d.r))
};
Number.prototype.add = function (b) {
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="puzzle v3.0 rotate and bezier curves to make shapes of pieces." />
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<img hidden=true id="image" style="position:absolute;visibility:hidden;" src="http://www.prlog.org/11949574-hot-girl.jpg"></img>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>