Repository navigation
Expand file tree
/
Copy pathMinoDevs-Scripts.js
More file actions
76 lines (58 loc) · 2.15 KB
/
Copy pathMinoDevs-Scripts.js
File metadata and controls
76 lines (58 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
function random(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
///////////////////////////////////////////////////////////////////////
function byte(text) {
const encoder = new TextEncoder();
const bytes = encoder.encode(text).length;
if (bytes === 0) return '0 Bytes';
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(1024));
const formattedValue = parseFloat((bytes / Math.pow(1024, i)).toFixed(2));
return `${formattedValue} ${sizes[i]}`;
}
///////////////////////////////////////////////////////////////////////
function connectHR(divA,divB){
const rectA = divA.getBoundingClientRect();
const rectB = divB.getBoundingClientRect();
const x1 = rectA.left + rectA.width / 2;
const y1 = rectA.top + rectA.height / 2;
const x2 = rectB.left + rectB.width / 2;
const y2 = rectB.top + rectB.height / 2;
const diffX = x2 - x1;
const diffY = y2 - y1;
const length = Math.sqrt(diffX * diffX + diffY * diffY);
const angle = Math.atan2(diffY, diffX) * 180 / Math.PI;
let line = document.querySelector('.dynamic-hr');
if (!line) {
line = document.createElement('hr');
line.classList.add('dynamic-hr');
line.style.position = 'absolute';
line.style.height = '2px';
line.style.border = 'none';
line.style.backgroundColor = '#000';
line.style.transformOrigin = '0 0';
line.style.margin = '0';
document.body.appendChild(line);
}
line.style.width = length + 'px';
line.style.left = x1 + 'px';
line.style.top = y1 + 'px';
line.style.transform = `rotate(${angle}deg)`;
}
// Props where props belong, this was thankfully made by Gemini (although it's looks like I'm a Vibe Coder, I'm not)
////////////////////////////////////////////////////////////
function fibonacci(limit) { // 5 f###### houres
let result = [];
let time = 0;
let a = 1;
let b = 0;
for(let f = 0; f <= limit; f++){
result.push(a);
a = a+b;
b = a-b;
}
return result;
}