Skip to content

Instantly share code, notes, and snippets.

View dexta's full-sized avatar
😎
Change your world, use Open Source Software

Björn dexta

😎
Change your world, use Open Source Software
View GitHub Profile
@dexta
dexta / ogame.js
Created August 27, 2019 20:03
Calc the need of Ress to transport, and show the amount of Transporters
let M=0,K=0,D=0,HYT=10;
const needT = ()=> {
M=(M>0)?M:0;K=(K>0)?K:0;D=(D>0)?D:0;
let k=(M+K+D)/(5000+(HYT*(5000*.05)));
let g=(M+K+D)/(25000+(HYT*(25000*.05)));
return `GT: ${g.toFixed(2)} | KT: ${k.toFixed(2)} || M:${M} | K:${K} | D:${D}`;
};
const addRes = (m,k,d) => { M+=m||0;K+=k||0;D+=d||0 };
const subRes = (m,k,d) => { M-=m||0;K-=k||0;D-=d||0; };
const resetRes = ()=>{M=0;K=0;D=0};
@dexta
dexta / chaosgameV1.html
Created April 28, 2017 18:16
Chaos Game - inspired by Numberphile
<canvas id="canvas" width="800" height="600"></canvas>
<button onclick="randomStart();drawMassive(5000);">Random</button>
<button onclick="niceStart();drawMassive(50000);">Nice</button>
<script type="text/javascript">
const canvas = document.getElementById('canvas'),
ctx = canvas.getContext('2d');
const A=[0,0],B=[0,0],C=[0,0];
var S=[0,0];
function nextPoint() {
@dexta
dexta / gist:6073883
Last active December 20, 2015 04:49
count the lines of code separated by language [html,css,js,php,py,sh] raw console output with tab
#!/bin/sh
ALL=0;ALLF=0
JS=0;JSF=0
HTML=0;HTMLF=0
CSS=0:CSSF=0
PHP=0;PHPF=0
PY=0;PYF=0
SH=0;SHF=0
DOUT="h"