Skip to content

Commit 0769af1

Browse files
authored
Merge pull request #3948 from pavelmachek/m_50_elite
elite: add elite clock
2 parents 2ee0547 + 2e95f12 commit 0769af1

File tree

8 files changed

+108
-2
lines changed

8 files changed

+108
-2
lines changed

apps/eliteclock/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.01: initial import

apps/eliteclock/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Elite clock ![](app.png)
2+
3+
Simple binary clock for leet haxorz.
4+
5+
Written by: [Pavel Machek](https://github.com/pavelmachek)

apps/eliteclock/app-icon.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require("heatshrink").decompress(atob("mEwgIspiEPgEeAoU/4F/wGAiEAsEA4AFImAHBAolj/gRD4YFEC4UPwEfgAFC4EfF5IpHAp4dC4EQv/A/+AHYJlDnjY/AH4AJ"))

apps/eliteclock/app.png

9.63 KB
Loading

apps/eliteclock/eliteclock.app.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Bangle.js 2 - Binary Leet ClockZ
2+
/*
3+
4+
bangle.js2: create binary 'leet clock' where the time is shown as text
5+
"leet clockz" with binary 0 being normal character and binary one
6+
being leet translation. Be careful to only update time on minute
7+
boundaries.
8+
9+
So yeah — 1337 c10ckZ = certified leetspeak 😎
10+
11+
ChatGPT said:
12+
Alright, here’s a hardcore hacker variant of elite clock in full-on aggressive leetspeak:
13+
14+
£|173 ¢|_0¢|<Z
15+
16+
Breakdown:
17+
18+
E → £ or 3
19+
L → | or £
20+
I → 1 or !
21+
T → 7 or +
22+
C → ¢ or (
23+
O → 0
24+
K → |< or X
25+
26+
Other extreme variants:
27+
3|173 (|_0(<Z
28+
€|!73 ©|0xX
29+
3L1+3 (L0XXZ
30+
31+
*/
32+
33+
const TEXT = "leet\nclockz";
34+
const LEET = {
35+
"l": "1",
36+
"e": "3",
37+
"t": "7",
38+
" ": " ",
39+
"c": "(",
40+
"o": "0",
41+
"k": "X",
42+
"z": "2"
43+
};
44+
45+
// Convert hour (12h) and minute to binary mask
46+
function getBinaryFromTime(d) {
47+
let h = d.getHours() % 12;
48+
if (h === 0) h = 12; // 12-hour format: 0 becomes 12
49+
const m = d.getMinutes();
50+
const bin = ((h << 7) | m).toString(2).padStart(11, '0');
51+
return bin;
52+
}
53+
54+
// Map normal characters to leet if binary mask says so
55+
function getDisplayText(binMask) {
56+
return TEXT.split("").map((ch, i) =>
57+
binMask[i] === '1' ? (LEET[ch] || ch) : ch
58+
).join("");
59+
}
60+
61+
function draw() {
62+
g.reset().clear();
63+
const now = new Date();
64+
const bin = getBinaryFromTime(now);
65+
const txt = getDisplayText(bin);
66+
67+
const w = 0;
68+
g.setFont("Vector", 47).setFontAlign(0,0);
69+
70+
g.drawString(txt, (g.getWidth() - w) / 2, (g.getHeight() - 0) / 2);
71+
}
72+
73+
function scheduleNextDraw() {
74+
const now = new Date();
75+
const msToNextMin = 60000 - (now.getSeconds() * 1000 + now.getMilliseconds());
76+
setTimeout(() => {
77+
draw();
78+
scheduleNextDraw();
79+
}, msToNextMin);
80+
}
81+
82+
// Init
83+
draw();
84+
scheduleNextDraw();
85+
//Bangle.loadWidgets();
86+
//Bangle.drawWidgets();

apps/eliteclock/metadata.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{ "id": "eliteclock",
2+
"name": "Elite clock",
3+
"version": "0.01",
4+
"description": "Simple binary clock for leet haxorz",
5+
"icon": "app.png",
6+
"readme": "README.md",
7+
"supports" : ["BANGLEJS2"],
8+
"type": "clock",
9+
"tags": "clock",
10+
"storage": [
11+
{"name":"eliteclock.app.js","url":"eliteclock.app.js"},
12+
{"name":"eliteclock.img","url":"app-icon.js","evaluate":true}
13+
]
14+
}

apps/iconbits/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ It is also possible to load existing icon into editor, using
1616
"load_icon("");" command. At the end of iconbits.app.js file there are
1717
more utility functions.
1818

19-
20-
19+
Create 48x48 icon in gimp.

apps/iconbits/icon.png

9.63 KB
Loading

0 commit comments

Comments
 (0)