Skip to content

Instantly share code, notes, and snippets.

View caracal7's full-sized avatar

Dmitrii Vasilev caracal7

  • This planet
View GitHub Profile
@caracal7
caracal7 / gist:e30c206724674bd11fa8b735df4efd5d
Created January 26, 2018 21:50 — forked from ThaisRobba/gist:3210b2840a540debad47
Tiny component & entities module
var componentsList = {};
function Component(name, func) {
componentsList[name] = func;
}
//Components are created like this:
Component('flying', function(o) {
o.flying = true;
});
@caracal7
caracal7 / geotic.js
Created January 26, 2018 21:44 — forked from ddmills/geotic.js
Component-Entity-System
let _id;
const id = () => {
let now = Date.now();
if (now <= _id) now++;
_id = now;
return now;
}
const hash = (n) => n.sort((a, b) => a > b).join('$');
const remove = (a, v) => a.splice(a.indexOf(v), 1);
@caracal7
caracal7 / README.md
Created January 26, 2018 21:15 — forked from williammalo/README.md
The cleanest, easiest dom api ever! It will change your life!

I always thought there was a better way to access the dom. This is a tool that allows you to use extremely simple syntax to access dom elements. It makes an object with the name of your choice (I chose "$") that contains a reference to all elements that have an id.

example:

<script> $.foo.innerHTML = "Hello world" </script>

You can even choose to use an object that already exists (I chose "document" because it makes sense)

@caracal7
caracal7 / LICENSE.txt
Created January 26, 2018 21:05
This is a basic, cross-platform, valid Node.js EventEmitter.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Vitron Prince
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE