-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
2002 lines (1747 loc) · 61.8 KB
/
script.js
File metadata and controls
2002 lines (1747 loc) · 61.8 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
class TerminalResume {
constructor() {
this.output = document.getElementById("output");
this.input = document.getElementById("command-input");
this.terminal = document.querySelector(".terminal");
this.terminalContainer = document.querySelector(".terminal-container");
this.contextMenu = document.querySelector(".context-menu");
this.terminals = [{ input: this.input, history: [], historyIndex: -1 }];
this.activeTerminal = 0;
this.activeTerminalContent = null;
this.resizing = null;
// New properties for themes and game
this.currentTheme = localStorage.getItem("theme") || "default";
this.projects = [];
this.skills = {};
this.fileSystem = {};
this.gameActive = false;
this.gameHandler = null;
// Initialize modals
this.themeModal = document.getElementById("theme-modal");
this.projectsModal = document.getElementById("projects-modal");
this.skillsModal = document.getElementById("skills-modal");
// Initialize theme selector
this.themeToggle = document.getElementById("theme-toggle");
this.setupEventListeners();
this.loadProjects();
this.loadSkills();
this.setupFileSystem();
this.init();
}
init() {
// Apply saved theme
this.handleThemeChange(this.currentTheme);
// Set up modal close buttons
document.querySelectorAll(".close-button").forEach((button) => {
button.addEventListener("click", () => {
this.closeModal(button.closest(".modal"));
});
});
// Theme toggle
this.themeToggle.addEventListener("click", () => {
this.showModal(this.themeModal);
});
// Hide language toggle since we're removing that feature
const languageToggle = document.getElementById("language-toggle");
if (languageToggle && languageToggle.parentElement) {
languageToggle.parentElement.style.display = "none";
}
// Theme selection
document.querySelectorAll(".theme-option").forEach((option) => {
option.addEventListener("click", () => {
this.handleThemeChange(option.dataset.theme);
});
});
this.printWelcomeMessage();
this.input.focus();
this.setupContextMenu();
}
setupContextMenu() {
// Handle right-click on terminal content
this.terminalContainer.addEventListener("contextmenu", (e) => {
e.preventDefault();
const terminalContent = e.target.closest(".terminal-content");
if (terminalContent) {
this.activeTerminalContent = terminalContent;
this.showContextMenu(e.clientX, e.clientY);
}
});
// Hide context menu on click outside
document.addEventListener("click", () => {
this.contextMenu.classList.remove("active");
});
// Handle menu item clicks
this.contextMenu.addEventListener("click", (e) => {
const action = e.target.dataset.action;
if (action) {
this.handleContextMenuAction(action);
}
});
}
showContextMenu(x, y) {
this.contextMenu.style.left = `${x}px`;
this.contextMenu.style.top = `${y}px`;
this.contextMenu.classList.add("active");
// Show/hide close option based on whether this terminal can be closed
const closeOption = this.contextMenu.querySelector(
'[data-action="close-split"]'
);
const isMainTerminal =
this.activeTerminalContent === this.terminalContainer.firstElementChild;
closeOption.style.display = isMainTerminal ? "none" : "block";
}
handleContextMenuAction(action) {
if (!this.activeTerminalContent) return;
switch (action) {
case "split-h":
this.splitTerminal("horizontal", this.activeTerminalContent);
break;
case "split-v":
this.splitTerminal("vertical", this.activeTerminalContent);
break;
case "close-split":
this.closeSplit(this.activeTerminalContent);
break;
}
this.contextMenu.classList.remove("active");
}
setupEventListeners() {
// Global click handler for terminal focus
this.terminalContainer.addEventListener("click", (e) => {
const terminalContent = e.target.closest(".terminal-content");
if (terminalContent) {
const input = terminalContent.querySelector("input");
if (input) {
input.focus();
this.activeTerminal = this.terminals.findIndex(
(t) => t.input === input
);
}
}
});
// Global keyboard shortcuts
document.addEventListener("keydown", (e) => {
// Ctrl + Shift + H for horizontal split
if (e.ctrlKey && e.shiftKey && e.key.toLowerCase() === "h") {
e.preventDefault();
const activeContent =
this.terminals[this.activeTerminal].input.closest(
".terminal-content"
);
if (activeContent) {
this.splitTerminal("horizontal", activeContent);
}
}
// Ctrl + Shift + V for vertical split
if (e.ctrlKey && e.shiftKey && e.key.toLowerCase() === "v") {
e.preventDefault();
const activeContent =
this.terminals[this.activeTerminal].input.closest(
".terminal-content"
);
if (activeContent) {
this.splitTerminal("vertical", activeContent);
}
}
});
// Setup initial input handlers
this.setupInputHandlers(this.input);
}
setupInputHandlers(inputElement) {
inputElement.addEventListener("keydown", (e) => {
const terminal = this.terminals.find((t) => t.input === inputElement);
if (!terminal) return;
if (e.key === "Enter") {
this.handleCommand(inputElement);
} else if (e.key === "ArrowUp") {
e.preventDefault();
this.navigateHistory("up", terminal);
} else if (e.key === "ArrowDown") {
e.preventDefault();
this.navigateHistory("down", terminal);
} else if (e.key === "l" && e.ctrlKey) {
// Handle Ctrl+L (clear screen)
e.preventDefault();
const outputElement = inputElement
.closest(".terminal-content")
.querySelector("[id^='output']");
outputElement.innerHTML = "";
this.printWelcomeMessage(outputElement);
} else if (e.key === "Tab") {
// Handle Tab completion
e.preventDefault();
this.handleTabCompletion(inputElement);
}
});
}
handleTabCompletion(inputElement) {
const currentInput = inputElement.value.toLowerCase().trim();
const commands = [
"help",
"about",
"skills",
"experience",
"education",
"contact",
"clear",
"projects",
"skills-visual",
"game",
"exit-game",
"matrix",
"stop-matrix",
"weather",
"calc",
"calculate",
"pdf",
];
// Find matching commands
const matches = commands.filter((cmd) => cmd.startsWith(currentInput));
if (matches.length === 1) {
// Single match - complete the command
inputElement.value = matches[0];
} else if (matches.length > 1 && currentInput) {
// Multiple matches - show possibilities
const outputElement = inputElement
.closest(".terminal-content")
.querySelector("[id^='output']");
const matchesText = `\nPossible commands:\n${matches.join(" ")}`;
this.printToOutput(outputElement, matchesText, "info");
}
}
navigateHistory(direction, terminal) {
if (
direction === "up" &&
terminal.historyIndex < terminal.history.length - 1
) {
terminal.historyIndex++;
} else if (direction === "down" && terminal.historyIndex > -1) {
terminal.historyIndex--;
}
if (
terminal.historyIndex >= 0 &&
terminal.historyIndex < terminal.history.length
) {
terminal.input.value =
terminal.history[terminal.history.length - 1 - terminal.historyIndex];
} else {
terminal.input.value = "";
}
}
splitTerminal(direction, sourceTerminal) {
const parentContainer = sourceTerminal.parentElement;
const isAlreadySplit = parentContainer.children.length > 1;
const splitClass = direction === "horizontal" ? "split-h" : "split-v";
// If parent is not split or split in different direction, create new container
if (!isAlreadySplit || !parentContainer.classList.contains(splitClass)) {
const newContainer = document.createElement("div");
newContainer.className = `terminal-container ${splitClass}`;
// Move source terminal to new container
sourceTerminal.parentElement.insertBefore(newContainer, sourceTerminal);
newContainer.appendChild(sourceTerminal);
// Create new terminal in the container
this.createNewTerminalContent(newContainer);
} else {
// Add new terminal to existing split container
this.createNewTerminalContent(parentContainer);
}
}
createNewTerminalContent(container) {
const newContent = document.createElement("div");
newContent.className = "terminal-content";
const timestamp = Date.now();
newContent.innerHTML = `
<div id="output-${timestamp}" class="terminal-output"></div>
<div class="input-line">
<span class="prompt">></span>
<input type="text" id="command-input-${timestamp}" class="command-input" />
</div>
`;
// Add resize handle if not the last element
if (container.children.length > 0) {
const handle = document.createElement("div");
handle.className = `resize-handle ${
container.classList.contains("split-h") ? "horizontal" : "vertical"
}`;
container.lastElementChild.appendChild(handle);
this.setupResizeHandle(handle);
}
container.appendChild(newContent);
// Setup new input
const newInput = newContent.querySelector(".command-input");
this.setupInputHandlers(newInput);
// Add to terminals array
this.terminals.push({
input: newInput,
history: [],
historyIndex: -1,
});
// Print welcome message in new terminal
const newOutput = newContent.querySelector(`#output-${timestamp}`);
this.printWelcomeMessage(newOutput);
// Focus new terminal
newInput.focus();
this.activeTerminal = this.terminals.length - 1;
}
setupResizeHandle(handle) {
const isHorizontal = handle.classList.contains("horizontal");
const startResize = (e) => {
e.preventDefault();
this.resizing = {
handle,
startX: e.clientX,
startY: e.clientY,
parentContainer: handle.closest(".terminal-container"),
element: handle.parentElement,
initialSize: isHorizontal
? handle.parentElement.offsetWidth
: handle.parentElement.offsetHeight,
};
document.addEventListener("mousemove", resize);
document.addEventListener("mouseup", stopResize);
};
const resize = (e) => {
if (!this.resizing) return;
const { parentContainer, element, startX, startY, initialSize } =
this.resizing;
const containerRect = parentContainer.getBoundingClientRect();
if (isHorizontal) {
const deltaX = e.clientX - startX;
const newWidth = initialSize + deltaX;
const maxWidth = containerRect.width - 150; // Leave space for other splits
if (newWidth >= 150 && newWidth <= maxWidth) {
const percentage = (newWidth / containerRect.width) * 100;
element.style.flex = "none";
element.style.width = `${percentage}%`;
}
} else {
const deltaY = e.clientY - startY;
const newHeight = initialSize + deltaY;
const maxHeight = containerRect.height - 100;
if (newHeight >= 100 && newHeight <= maxHeight) {
const percentage = (newHeight / containerRect.height) * 100;
element.style.flex = "none";
element.style.height = `${percentage}%`;
}
}
};
const stopResize = () => {
this.resizing = null;
document.removeEventListener("mousemove", resize);
document.removeEventListener("mouseup", stopResize);
};
handle.addEventListener("mousedown", startResize);
}
printToOutput(outputElement, text, className = "", useTypewriter = false) {
if (!text) {
outputElement.innerHTML = "";
return Promise.resolve();
}
const line = document.createElement("div");
line.className = className;
// Ensure consistent text formatting
line.style.whiteSpace = "pre-wrap";
line.style.marginBottom = "0.5rem";
outputElement.appendChild(line);
// Force scroll to bottom
this.scrollToBottom(outputElement.closest(".terminal-content"));
if (useTypewriter && !text.includes("<")) {
// For plain text, use typewriter effect
return this.typeText(line, text, 20);
} else if (useTypewriter && text.includes("<")) {
// For HTML content, use HTML typewriter
return this.typeHTML(line, text, 20);
} else {
// No typewriter effect
line.textContent = text;
return Promise.resolve();
}
}
scrollToBottom(terminalContent) {
if (!terminalContent) return;
// Only scroll if content is actually overflowing
if (terminalContent.scrollHeight > terminalContent.clientHeight) {
const currentScrollTop = terminalContent.scrollTop;
const maxScroll =
terminalContent.scrollHeight - terminalContent.clientHeight;
// If we're not already at the bottom, scroll
if (currentScrollTop < maxScroll) {
terminalContent.scrollTop = maxScroll;
// Use requestAnimationFrame to ensure scroll happens after render
requestAnimationFrame(() => {
terminalContent.scrollTop = maxScroll;
});
}
}
}
handleCommand(inputElement) {
const terminal = this.terminals.find((t) => t.input === inputElement);
if (!terminal) return;
const command = inputElement.value.trim().toLowerCase();
const outputElement = inputElement
.closest(".terminal-content")
.querySelector("[id^='output']");
this.printToOutput(outputElement, `> ${command}`, "command");
terminal.history.push(command);
terminal.historyIndex = -1;
inputElement.value = "";
// Parse command and arguments
const [cmd, ...args] = command.split(" ");
// Execute command
switch (cmd) {
case "help":
this.showHelp(outputElement);
break;
case "about":
this.showAbout(outputElement);
break;
case "experience":
this.showExperience(outputElement);
break;
case "education":
this.showEducation(outputElement);
break;
case "skills":
this.showSkills(outputElement);
break;
case "contact":
this.showContact(outputElement);
break;
case "clear":
outputElement.innerHTML = "";
this.printWelcomeMessage(outputElement);
break;
case "projects":
this.showProjects();
break;
case "skills-visual":
this.showSkillsVisualization();
break;
case "game":
this.initGame();
break;
case "pdf":
this.generatePDF();
break;
case "linkedin-cover":
this.generateLinkedInCover(outputElement);
break;
case "exit-game":
this.endGame();
this.printToOutput(outputElement, "Game exited.", "info");
break;
case "matrix":
this.startMatrixEffect(outputElement);
break;
case "stop-matrix":
this.stopMatrixEffect();
this.printToOutput(outputElement, "Matrix effect stopped.", "info");
break;
case "weather":
this.showWeather(args.join(" "), outputElement);
break;
case "calc":
case "calculate":
this.calculate(args.join(" "), outputElement);
break;
case "":
break;
default:
this.printToOutput(
outputElement,
`Command not found: ${command}. Type 'help' for available commands.`,
"error"
);
}
this.scrollToBottom(outputElement.closest(".terminal-content"));
}
printWelcomeMessage(outputElement = this.output) {
const divider = "--------------------------------------------------";
const welcome =
this.wrapWithColor("SHNWAZ DEV\n", "#d4843e") +
this.wrapWithColor(divider + "\n", "#555555") +
this.wrapWithColor(
" Interactive Terminal Resume\n",
"#888888"
) +
this.wrapWithColor(
" Software Engineer - Cloud Architect - Tech Lead\n",
"#666666"
) +
this.wrapWithColor(divider + "\n\n", "#555555") +
this.wrapWithColor("Type ", "#666666") +
this.wrapWithColor("'help'", "#87af87") +
this.wrapWithColor(" to see available commands\n", "#666666") +
this.wrapWithColor("Press ", "#666666") +
this.wrapWithColor("'tab'", "#87af87") +
this.wrapWithColor(" to auto-complete commands", "#666666");
const helpDiv = document.createElement("div");
helpDiv.innerHTML = welcome;
outputElement.appendChild(helpDiv);
this.scrollToBottom(outputElement.closest(".terminal-content"));
}
showHelp(outputElement = this.output) {
const title = this.wrapWithColor("Available Commands\n\n", "#ffff00");
const mainCommands =
this.wrapWithColor("Main Commands:\n", "#00ffff") +
this.wrapWithColor("- help", "#98fb98") +
" " +
this.wrapWithColor("Show this help message\n", "#ffffff") +
this.wrapWithColor("- about", "#98fb98") +
" " +
this.wrapWithColor("Display my professional summary\n", "#ffffff") +
this.wrapWithColor("- skills", "#98fb98") +
" " +
this.wrapWithColor("View my technical expertise\n", "#ffffff") +
this.wrapWithColor("- experience", "#98fb98") +
" " +
this.wrapWithColor("Show my work history\n", "#ffffff") +
this.wrapWithColor("- education", "#98fb98") +
" " +
this.wrapWithColor("View my educational background\n", "#ffffff") +
this.wrapWithColor("- contact", "#98fb98") +
" " +
this.wrapWithColor("Get my contact information\n", "#ffffff") +
this.wrapWithColor("- clear", "#98fb98") +
" " +
this.wrapWithColor("Clear the terminal screen\n", "#ffffff");
const utilityCommands =
"\n" +
this.wrapWithColor("Utility Commands:\n", "#00ffff") +
this.wrapWithColor("- projects", "#98fb98") +
" " +
this.wrapWithColor("View my project showcase\n", "#ffffff") +
this.wrapWithColor("- skills-visual", "#98fb98") +
" " +
this.wrapWithColor("Show skills visualization\n", "#ffffff") +
this.wrapWithColor("- game", "#98fb98") +
" " +
this.wrapWithColor("Play a mini-game\n", "#ffffff") +
this.wrapWithColor("- matrix", "#98fb98") +
" " +
this.wrapWithColor("Start Matrix digital rain effect\n", "#ffffff") +
this.wrapWithColor("- weather", "#98fb98") +
" " +
this.wrapWithColor("Check weather for a location\n", "#ffffff") +
this.wrapWithColor("- calc", "#98fb98") +
" " +
this.wrapWithColor("Calculate mathematical expressions\n", "#ffffff") +
this.wrapWithColor("- pdf", "#98fb98") +
" " +
this.wrapWithColor("Download resume as PDF\n", "#ffffff") +
this.wrapWithColor("- linkedin-cover", "#98fb98") +
" " +
this.wrapWithColor("Generate LinkedIn cover image\n", "#ffffff");
const shortcuts =
"\n" +
this.wrapWithColor("Shortcuts:\n", "#666666") +
this.wrapWithColor("- ", "#666666") +
this.wrapWithColor("Up/Down", "#666666") +
" " +
this.wrapWithColor("Navigate command history\n", "#444444") +
this.wrapWithColor("- ", "#666666") +
this.wrapWithColor("Tab", "#666666") +
" " +
this.wrapWithColor("Auto-complete commands\n", "#444444") +
this.wrapWithColor("- ", "#666666") +
this.wrapWithColor("Ctrl+L", "#666666") +
" " +
this.wrapWithColor("Clear the screen\n", "#444444") +
this.wrapWithColor("- ", "#666666") +
this.wrapWithColor("Ctrl+Shift+H", "#666666") +
" " +
this.wrapWithColor("Split horizontally\n", "#444444") +
this.wrapWithColor("- ", "#666666") +
this.wrapWithColor("Ctrl+Shift+V", "#666666") +
" " +
this.wrapWithColor("Split vertically", "#444444");
const help = title + mainCommands + utilityCommands + shortcuts;
const helpDiv = document.createElement("div");
helpDiv.innerHTML = help;
outputElement.appendChild(helpDiv);
this.scrollToBottom(outputElement.closest(".terminal-content"));
}
showAbout(outputElement = this.output) {
const about = `<span style="color: #ff8c00; font-weight: bold;">About Me</span>
${this.wrapWithColor(
"Based in Bihar and originally from Muzaffarpur, Bihar, I am shnwaz dev.",
"#ffffff"
)}
${this.wrapWithColor(
"I am a Senior Software Engineer, Website Developer, and UI/UX Designer focused on distributed systems, data pipelines, and cloud technologies.",
"#ffffff"
)}
${this.wrapWithColor("* Experience", "#ff8c00")}
${this.wrapWithColor(
" Building scalable and efficient software solutions using",
"#ffffff"
)}
${this.wrapWithColor(" React, JavaScript, and Google Cloud", "#ff8c00")}
${this.wrapWithColor("* Passion", "#ff8c00")}
${this.wrapWithColor(
" Transforming innovative ideas into high-quality applications",
"#ffffff"
)}
${this.wrapWithColor(
" with elegant and efficient implementations",
"#ffffff"
)}
${this.wrapWithColor("* Strengths", "#ff8c00")}
${this.wrapWithColor(
" Strong team player with expertise in designing robust,",
"#ffffff"
)}
${this.wrapWithColor(" high-performance systems", "#ffffff")}
${this.wrapWithColor(
"--------------------------------------------------",
"#ff8c00"
)}
${this.wrapWithColor("Ready to bring your innovative ideas to life!", "#ffffff")}
${this.wrapWithColor(
"--------------------------------------------------",
"#ff8c00"
)}`;
const aboutDiv = document.createElement("div");
aboutDiv.innerHTML = about;
outputElement.appendChild(aboutDiv);
this.scrollToBottom(outputElement.closest(".terminal-content"));
}
// Helper method to wrap text with color
wrapWithColor(text, color) {
return `<span style="color: ${color}">${text}</span>`;
}
// Typewriter effect for terminal outputs
typeText(element, text, speed = 30) {
if (!element || !text) return Promise.resolve();
return new Promise((resolve) => {
let index = 0;
element.textContent = "";
element.style.display = "inline-block";
const interval = setInterval(() => {
if (index < text.length) {
element.textContent += text.charAt(index);
index++;
} else {
clearInterval(interval);
resolve();
}
}, speed);
});
}
// Apply typewriter effect to HTML content
async typeHTML(element, html, speed = 30) {
if (!element || !html) return Promise.resolve();
// Create a temporary div to hold the HTML
const temp = document.createElement("div");
temp.innerHTML = html;
// Get text nodes and elements in order
const walker = document.createTreeWalker(
temp,
NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT,
null,
false
);
const nodes = [];
let currentNode;
while ((currentNode = walker.nextNode())) {
nodes.push(currentNode);
}
// Clear the target element
element.innerHTML = "";
// Process each node
for (const node of nodes) {
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) {
const span = document.createElement("span");
element.appendChild(span);
await this.typeText(span, node.textContent, speed);
} else if (node.nodeType === Node.ELEMENT_NODE) {
const clone = node.cloneNode(false);
element.appendChild(clone);
// If this is a style or has no children, just add it as is
if (node.tagName === "STYLE" || !node.hasChildNodes()) {
clone.innerHTML = node.innerHTML;
}
}
}
return Promise.resolve();
}
showExperience(outputElement = this.output) {
const experience = `<span style="color: #ffff00; font-weight: bold;">Professional Experience</span>
<span style="color: #00ffff;">SHNWAZ DEV | Senior Software Engineer</span>
${this.wrapWithColor("Current | Muzaffarpur, Bihar", "#ffffff")}
${this.wrapWithColor(
"Visionary, AI-powered Media & Data Intelligence Solutions",
"#98fb98"
)}
- ${this.wrapWithColor("Part of Core team", "#ffa07a")} - ${this.wrapWithColor(
"Architect and part of every decision.",
"#ffffff"
)}
- ${this.wrapWithColor(
"Microservices engineer",
"#ffa07a"
)} - ${this.wrapWithColor(
"Designed and build services for distributed system",
"#ffffff"
)}
- ${this.wrapWithColor("Pipeline engineer", "#ffa07a")} - ${this.wrapWithColor(
"Google cloud engineer for data pipeline",
"#ffffff"
)}
- ${this.wrapWithColor("Fullstack engineer", "#ffa07a")} - ${this.wrapWithColor(
"Wrote and reviewed code for front/back/cloud.",
"#ffffff"
)}
${this.wrapWithColor("Technologies used:", "#00ffff")} ${this.wrapWithColor(
"Typescript, React, NodeJs, Poetry, PyTest, ReactJS, Jest, Cypress, ES6, ElasticSearch, Google Cloud, JIRA, Firebase, Kubernetes, Data Flow",
"#87cefa"
)}
<span style="color: #00ffff;">SHNWAZ DEV | Senior Software Engineer</span>
${this.wrapWithColor(
"Journey Stage | Patna, Bihar",
"#ffffff"
)}
- ${this.wrapWithColor("Part of Core team", "#ffa07a")} - ${this.wrapWithColor(
"Team that leads company tech decisions",
"#ffffff"
)}
- ${this.wrapWithColor("Tech interviewer", "#ffa07a")} - ${this.wrapWithColor(
"Interview potential candidates.",
"#ffffff"
)}
- ${this.wrapWithColor("Microsoft project", "#ffa07a")} - ${this.wrapWithColor(
"IOT marketing project in every Microsoft store.",
"#ffffff"
)}
- ${this.wrapWithColor("Fullstack engineer", "#ffa07a")} - ${this.wrapWithColor(
"Wrote and reviewed code for big projects.",
"#ffffff"
)}
- ${this.wrapWithColor(
"AppriseMobile Tech Lead",
"#ffa07a"
)} - ${this.wrapWithColor(
"CRM for Toyota and corporates in USA",
"#ffffff"
)}
${this.wrapWithColor("Technologies used:", "#00ffff")} ${this.wrapWithColor(
"JavaScript, Python, pandas, NodeJs, ReactJS, Chai, Sinon, Mocha, ES6, ElasticSearch, Redis, Nginx, Gulp, JIRA, Docker, Azure, AWS, MongoDB",
"#87cefa"
)}
<span style="color: #00ffff;">SHNWAZ DEV | Software Engineering</span>
${this.wrapWithColor(
"Journey Stage | Darbhanga, Bihar",
"#ffffff"
)}
- ${this.wrapWithColor(
"Fullstack developer",
"#ffa07a"
)} - ${this.wrapWithColor(
"Frontend and backend (real-time publisher platform) used by National Geographics, IUBH, Fujitsu",
"#ffffff"
)}
- ${this.wrapWithColor("MEFIO developer", "#ffa07a")} - ${this.wrapWithColor(
"Highly available publisher platform",
"#ffffff"
)}
- ${this.wrapWithColor(
"Webreader developer",
"#ffa07a"
)} - ${this.wrapWithColor(
"reader platform, e-Learning platform",
"#ffffff"
)}
- ${this.wrapWithColor("SaaS developer", "#ffa07a")} - ${this.wrapWithColor(
"Integrated strategy to migrate from manual sales to SaaS",
"#ffffff"
)}
${this.wrapWithColor("Technologies used:", "#00ffff")} ${this.wrapWithColor(
"Python, ES6, ElasticSearch, Redis, Nginx, npm, Gulp, JIRA, Docker, AWS S3, RethinkDB, ReactJS, NodeJS, AngularJS, JavaScript",
"#87cefa"
)}
<span style="color: #00ffff;">SHNWAZ DEV | Software Engineer</span>
${this.wrapWithColor(
"Early Journey | Muzaffarpur, Bihar",
"#ffffff"
)}
- ${this.wrapWithColor("Software developer", "#ffa07a")} - ${this.wrapWithColor(
"Developed web and native projects",
"#ffffff"
)}
- ${this.wrapWithColor("Bar management app", "#ffa07a")} - ${this.wrapWithColor(
"Developed app for bar/restaurant management.",
"#ffffff"
)}
- ${this.wrapWithColor(
"Bank system optimisation",
"#ffa07a"
)} - ${this.wrapWithColor(
"Optimised aggregation from 11h to 1h",
"#ffffff"
)}
- ${this.wrapWithColor("UKD developer", "#ffa07a")} - ${this.wrapWithColor(
"Built practical local-business and portfolio solutions",
"#ffffff"
)}
${this.wrapWithColor("Technologies used:", "#00ffff")} ${this.wrapWithColor(
"Typescript, Python, Gulp, Docker, MongoDB, ReactJS, NodeJs, AngularJS, JavaScript, Java",
"#87cefa"
)}`;
const experienceDiv = document.createElement("div");
experienceDiv.innerHTML = experience;
outputElement.appendChild(experienceDiv);
this.scrollToBottom(outputElement.closest(".terminal-content"));
}
showEducation(outputElement = this.output) {
const education = `<span style="color: #ff8c00; font-weight: bold;">Education</span>
${this.wrapWithColor("Degree: Bachelor of Computer Science", "#ffffff")}
${this.wrapWithColor("Institution:", "#ff8c00")} ${this.wrapWithColor(
"Self-learning and project-based growth",
"#ffffff"
)}
${this.wrapWithColor("Duration:", "#ff8c00")} ${this.wrapWithColor(
"2013 - 2016",
"#ffffff"
)}
${this.wrapWithColor("Location:", "#ff8c00")} ${this.wrapWithColor(
"Muzaffarpur, Bihar, India",
"#ffffff"
)}
${this.wrapWithColor(
"--------------------------------------------------",
"#ff8c00"
)}
${this.wrapWithColor("Foundation of my software engineering journey.", "#ffffff")}
${this.wrapWithColor(
"--------------------------------------------------",
"#ff8c00"
)}`;
const educationDiv = document.createElement("div");
educationDiv.innerHTML = education;
outputElement.appendChild(educationDiv);
this.scrollToBottom(outputElement.closest(".terminal-content"));
}
showSkills(outputElement = this.output) {
const skills = `<span style="color: #ffff00; font-weight: bold;">PROGRAMMING</span>
- ${this.wrapWithColor("Typescript", "#ffffff")}
- ${this.wrapWithColor("Python", "#ffffff")}
- ${this.wrapWithColor("Javascript", "#ffffff")}
- ${this.wrapWithColor("Node", "#ffffff")}
- ${this.wrapWithColor("React", "#ffffff")}
- ${this.wrapWithColor("Angular", "#ffffff")}
- ${this.wrapWithColor("Google Cloud", "#ffffff")}
- ${this.wrapWithColor("AWS", "#ffffff")}
- ${this.wrapWithColor("Azure", "#ffffff")}
- ${this.wrapWithColor("Docker", "#ffffff")}
- ${this.wrapWithColor("Terraform", "#ffffff")}
- ${this.wrapWithColor("Kubernetes", "#ffffff")}
- ${this.wrapWithColor("Java", "#ffffff")}
- ${this.wrapWithColor("Kotlin", "#ffffff")}
- ${this.wrapWithColor("MongoDB", "#ffffff")}
- ${this.wrapWithColor("RethinkDB", "#ffffff")}
- ${this.wrapWithColor("Jest", "#ffffff")}
- ${this.wrapWithColor("ElasticSearch", "#ffffff")}
- ${this.wrapWithColor("GraphQL", "#ffffff")}
- ${this.wrapWithColor("Express", "#ffffff")}
- ${this.wrapWithColor("Redis", "#ffffff")}
- ${this.wrapWithColor("SQL", "#ffffff")}
- ${this.wrapWithColor("HTML", "#ffffff")}
- ${this.wrapWithColor("CSS", "#ffffff")}`;
const skillsDiv = document.createElement("div");
skillsDiv.innerHTML = skills;
outputElement.appendChild(skillsDiv);
this.scrollToBottom(outputElement.closest(".terminal-content"));
}
showContact(outputElement = this.output) {
const contact = `<span style="color: #ff8c00; font-weight: bold;">Contact Information</span>
${this.wrapWithColor("Let's connect and create something great!", "#ffffff")}
${this.wrapWithColor("Email:", "#ff8c00")} ${this.wrapWithColor(
'<a href="mailto:shnwazdeveloper@users.noreply.github.com" style="color: #ffffff; text-decoration: none;">shnwazdeveloper@users.noreply.github.com</a>',
"#ffffff"
)}
${this.wrapWithColor("Website:", "#ff8c00")} ${this.wrapWithColor(
'<a href="https://shnwazdeveloper.github.io/" target="_blank" style="color: #ffffff; text-decoration: none;">shnwazdeveloper.github.io</a>',
"#ffffff"
)}
${this.wrapWithColor("GitHub:", "#ff8c00")} ${this.wrapWithColor(
'<a href="https://github.com/shnwazdeveloper" target="_blank" style="color: #ffffff; text-decoration: none;">github.com/shnwazdeveloper</a>',
"#ffffff"
)}
${this.wrapWithColor("LinkedIn:", "#ff8c00")} ${this.wrapWithColor(
'<a href="https://www.linkedin.com/in/shnwazdev/" target="_blank" style="color: #ffffff; text-decoration: none;">linkedin.com/in/shnwazdev</a>',
"#ffffff"
)}
${this.wrapWithColor("--------------------------------------------------", "#ff8c00")}
${this.wrapWithColor("Feel free to reach out for opportunities!", "#ffffff")}
${this.wrapWithColor("--------------------------------------------------", "#ff8c00")}`;
const contactDiv = document.createElement("div");