Skip to content

Instantly share code, notes, and snippets.

@teak1
teak1 / index.html
Created February 2, 2017 00:52 — forked from anonymous/index.html
JS Bin // source http://jsbin.com/zapubod
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
canvas{
border:0px solid black;
}
let a = document.querySelector("#id_miles");
let b=a.parentElement;
b.appendChild(data);
b.removeChild(a);
//tiled render code
//by glEnd2
/*
to use create a new Tilemap object with the path to your .json file exported from tiled.
will do the rest from there.
to get renderable canvas use Tilemap.getImage();
rendering is done at creation so that there is less overhead later on.
*/
@teak1
teak1 / html-addons.markdown
Created February 26, 2019 20:41
html addons
function isInt(number){
return number==(number|0);
}
import React, { Component } from 'react';
import Tilemap from "./Tilemap.jsx";
class ReadyEvent extends Event {
constructor(tilemap) {
super("ReadyEvent", {
Tiledap: tilemap,
map: tilemap.state.data
});
}
}
function createOffloadedFunction(...code) {//arg 0 is func and all aditional args are support and loaded in after.
window.URL = window.URL || window.webkitURL;
let func = code.shift();
var response = code.join("\n\n") + `\n\nconst func = ${func.toString()}\n\nself.onmessage=function(pack){self.postMessage({id:pack.data.id,data:func(...pack.data.data)})}\n\n`;
var blob;
try {
blob = new Blob([response], { type: 'application/javascript' });
} catch (e) {
window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;