- A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
- lengths are in any unit (ex: pixels)
- code snippets are in JavaScript
angleRad = angleDeg * Math.PI / 180;
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
<style> | |
body { | |
margin: 0px; | |
overflow: hidden; | |
} |
#!/usr/bin/env python3 | |
import os | |
import sys | |
import time | |
import zipfile | |
startingdir = os.getcwd() | |
if (len(sys.argv) == 1): | |
print("Usage: " + os.path.basename(sys.argv[0]) + " path/to/application.app [path/to/output.zip]") |
<body style=margin:0> | |
<canvas id=a> | |
<script> | |
// initialize 2D canvas (c) | |
// initialize game state (s) | |
// initialize keys states (u,r,d,l for directions, k for all the keyboard) | |
c=a.getContext`2d`,k=[u=r=d=l=s=0] | |
// (initialize your global variables here) |
Copy-paste this into your address bar:
data:text/html,<title>code</title><link rel=icon href='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 99 99"><text y="1em" font-size="72">&%23128187;</text></svg>'><textarea id=d spellcheck=false onkeypress=e=event;k=e.keyCode;(e.ctrlKey&&k==13)||k==10?f.srcdoc=d.value:0 style=resize:none;filter:invert(><p id=o></p>%0d<script>%0do.innerHTML = 0;%0d</script></textarea><iframe id=f></iframe><p id=p style=position:fixed;bottom:1;color:white;background:black></p><script>D=null,d.onkeyup=d.onclick=n=>{clearTimeout(D),D=setTimeout(n=>{A=d.selectionStart,B=d.selectionEnd,V=d.value,E=V.substr(0,B).split`\n`,p.innerHTML=`Ln:${E.length}, Col:${E.pop().length+1}, ${A==B?"Pos:"+B:"Sel:"+(B-A)}, Len:${V.length}`},99)}</script><style>*{box-sizing:border-box;margin:0}textarea,iframe{width:50%;height:100%;vertical-align:top}
In the latest iteration my code editor, I've made big practical improvements