Skip to content

Instantly share code, notes, and snippets.

View darbicus's full-sized avatar

Darby Rathbone darbicus

  • Texas
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
<!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>
@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) {
@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 / 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);
};
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html>
@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) {
@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 / 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 / Darbicus.js
Created April 30, 2014 12:24
Darbicus.js this is a library im working on that uses higher order functions to handle grabbing data from events and then for displaying the new values by adding the higher order functions to display them into an array and only iterate those arrays in the requestAnimationFunction loop.
window.onload=function(){
/*counter is a simple counter. it will add 1 to the count value every time count() is called. the display('querySelector string', 'attribute to assign the value') function returns a function that displays the count value on the element using a querySelector string and then assigns the count to the attribute name.
*/
var counter = function () {
var Counter = Object.create(null);
Counter.Count = 0;
Counter.count = function () {
Counter.Count++;