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 / LICENSE.txt
Created March 8, 2018 12:28 — forked from jed/LICENSE.txt
write contextual templates
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
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
@caracal7
caracal7 / LICENSE.txt
Created March 8, 2018 04:49 — forked from nrkn/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
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
@caracal7
caracal7 / astar.js
Created February 3, 2018 14:34 — forked from bellbind/astar.js
[nodejs][javascript]A* with Jump Point Search
// A* with Jump Point Search on JavaScript
// - python A*: https://gist.github.com/bellbind/147645
// utility: Priority Queue
var PQ = function PQ() {
return Object.create(PQ.prototype, {
array: {value: []},
});
};
PQ.prototype.empty = function () {
@caracal7
caracal7 / LICENSE.txt
Created February 1, 2018 22:13 — forked from thingsinjars/LICENSE.txt
Chainable property setting
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Simon Madine <http://thingsinjars.com>
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
@caracal7
caracal7 / LICENSE.txt
Created February 1, 2018 20:21 — forked from podefr/LICENSE.txt
Finite State Machine
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Olivier Scherrer
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
@caracal7
caracal7 / proxy-reflect.js
Created January 28, 2018 12:11 — forked from scottshane/proxy-reflect.js
Proxy / Reflect Experiment
var targetObject = {
sayHi(){ return `returning show: ${p.show}` },
show: 'family guy',
characters: {
dad: 'peter',
mom: 'lois',
daughter: 'meg',
son: 'chris',
baby: 'stewie',
dog: 'brian'
@caracal7
caracal7 / actor.js
Created January 27, 2018 09:16 — forked from CrowdHailer/actor.js
Implementing actors in JavaScript.
// Turns out this was not too difficult.
// By using the event loop as a global mail box ordering is even guaranteed for messages between only two actors.
// TODO would like to try and put one actor in a web worker to get some real parallism
// TODO would like to handle errors and have the concept of a deceased actor while a reference to an actor still exists. Probably involves creating an actor system like in Scala. Eurgh.
var actor = {
send: function(message) {
var self = this;
console.log("sending to:", self);
setTimeout(function(){
@caracal7
caracal7 / ECSExampleInES6.js
Created January 27, 2018 09:06 — forked from TheSeamau5/ECSExampleInES6.js
ECS Example in Javascript / ES6
// HELPER FUNCTIONS
const has = (entity, components) => {
const exists = (x) => typeof x !== "undefined";
return components.map((component) => exists(entity[component]))
.reduce((x,y) => x && y);
};
const clone = (object) => {
if (object === null || typeof object !== 'object'){
return object;
@caracal7
caracal7 / demo.js
Created January 27, 2018 08:55 — forked from ooflorent/demo.js
Basic ECS
// Components
// ----------
function KeyboardController() {}
function AIController() {}
function Position(x, y) {
this.x = x || 0;
this.y = y || 0;
}
@caracal7
caracal7 / LICENSE.txt
Created January 27, 2018 00:29 — forked from Downchuck/LICENSE.txt
DOM micro-DSL
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Charles Pritchard <chuck@jumis.com>
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