brianmmaina 1.1.10 ā 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +190 -177
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -56,31 +56,36 @@ const questions = [
|
|
|
56
56
|
name: "action",
|
|
57
57
|
message: "What would you like to explore?",
|
|
58
58
|
choices: [
|
|
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
|
-
|
|
59
|
+
{ name: `š View Resume`, value: 'resume' },
|
|
60
|
+
{ name: `š View GitHub`, value: 'github' },
|
|
61
|
+
{ name: `šµ Play Song with Dance`, value: 'song' },
|
|
62
|
+
{ name: `š Play Ping Pong`, value: 'pingpong' },
|
|
63
|
+
{ name: `š¼ View Skills & Portfolio`, value: 'portfolio' },
|
|
64
|
+
{ name: `š Contact Info`, value: 'contact' },
|
|
65
|
+
{ name: `šŖ Exit`, value: 'exit' }
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const handleResume = async () => {
|
|
71
|
+
const spinner = createSpinner('Opening resume...').start();
|
|
72
|
+
await sleep(1000);
|
|
73
|
+
await open(resumeUrl);
|
|
74
|
+
spinner.success({ text: 'Resume opened in browser!' });
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const handleGitHub = async () => {
|
|
78
|
+
const spinner = createSpinner('Opening GitHub...').start();
|
|
79
|
+
await sleep(1000);
|
|
80
|
+
await open(githubUrl);
|
|
81
|
+
spinner.success({ text: 'GitHub opened in browser!' });
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const handleSong = async () => {
|
|
85
|
+
console.log(gradient.fruit('šµ Now playing: "Your Favorite Song" šµ\n'));
|
|
86
|
+
|
|
87
|
+
const frames = [
|
|
88
|
+
`
|
|
84
89
|
šø
|
|
85
90
|
/|\\
|
|
86
91
|
/ | \\
|
|
@@ -90,7 +95,7 @@ const questions = [
|
|
|
90
95
|
/ | \\
|
|
91
96
|
/ | \\
|
|
92
97
|
`,
|
|
93
|
-
|
|
98
|
+
`
|
|
94
99
|
šø
|
|
95
100
|
/|\\
|
|
96
101
|
/ | \\
|
|
@@ -103,7 +108,7 @@ const questions = [
|
|
|
103
108
|
/ \\
|
|
104
109
|
/ \\
|
|
105
110
|
`,
|
|
106
|
-
|
|
111
|
+
`
|
|
107
112
|
šø
|
|
108
113
|
/|\\
|
|
109
114
|
/ | \\
|
|
@@ -118,7 +123,7 @@ const questions = [
|
|
|
118
123
|
\\ /
|
|
119
124
|
\\___/
|
|
120
125
|
`,
|
|
121
|
-
|
|
126
|
+
`
|
|
122
127
|
šø
|
|
123
128
|
/|\\
|
|
124
129
|
/ | \\
|
|
@@ -135,156 +140,139 @@ const questions = [
|
|
|
135
140
|
| |
|
|
136
141
|
| |
|
|
137
142
|
`
|
|
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
|
-
} else {
|
|
191
|
-
line += ' ';
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
console.log(line);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const gameLoop = setInterval(() => {
|
|
199
|
-
ballX += ballDirX;
|
|
200
|
-
ballY += ballDirY;
|
|
201
|
-
|
|
202
|
-
if (ballX <= 1 || ballX >= width - 2) ballDirX *= -1;
|
|
203
|
-
if (ballY <= 1) ballDirY *= -1;
|
|
204
|
-
if (ballY >= height - 2 && ballX >= paddlePos && ballX < paddlePos + 8) {
|
|
205
|
-
ballDirY *= -1;
|
|
206
|
-
score++;
|
|
207
|
-
}
|
|
208
|
-
if (ballY >= height - 1) {
|
|
209
|
-
console.log(gradient.pastel(`\nGame Over! Final Score: ${score}`));
|
|
210
|
-
clearInterval(gameLoop);
|
|
211
|
-
process.stdin.setRawMode(false);
|
|
212
|
-
process.stdin.pause();
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
render();
|
|
217
|
-
}, 150);
|
|
218
|
-
|
|
219
|
-
process.stdin.on('data', (key) => {
|
|
220
|
-
if (key[0] === 97) { // 'a'
|
|
221
|
-
paddlePos = Math.max(1, paddlePos - 2);
|
|
222
|
-
} else if (key[0] === 100) { // 'd'
|
|
223
|
-
paddlePos = Math.min(width - 9, paddlePos + 2);
|
|
224
|
-
} else if (key[0] === 113) { // 'q'
|
|
225
|
-
clearInterval(gameLoop);
|
|
226
|
-
process.stdin.setRawMode(false);
|
|
227
|
-
process.stdin.pause();
|
|
228
|
-
console.log(gradient.pastel('\nGame quit!'));
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
name: `š¼ View Skills & Portfolio`,
|
|
235
|
-
value: async () => {
|
|
236
|
-
console.log(gradient.fruit('š¼ My Skills & Portfolio š¼\n'));
|
|
237
|
-
|
|
238
|
-
const table = new Table({
|
|
239
|
-
head: [gradient.cristal('Skill'), gradient.cristal('Level')],
|
|
240
|
-
colWidths: [20, 20],
|
|
241
|
-
style: { head: [], border: [] }
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
table.push(
|
|
245
|
-
['JavaScript', 'āāāāā'],
|
|
246
|
-
['Node.js', 'āāāāā'],
|
|
247
|
-
['React', 'āāāā'],
|
|
248
|
-
['Python', 'āāāā'],
|
|
249
|
-
['Terminal Magic', 'āāāāā']
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
console.log(table.toString());
|
|
253
|
-
|
|
254
|
-
console.log('\n' + gradient.pastel('Projects:'));
|
|
255
|
-
console.log('⢠Terminal Business Card (You\'re using it!)');
|
|
256
|
-
console.log('⢠Awesome CLI Tools');
|
|
257
|
-
console.log('⢠Web Applications');
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
name: `š Contact Info`,
|
|
262
|
-
value: async () => {
|
|
263
|
-
console.log(gradient.fruit('š Contact Information š\n'));
|
|
264
|
-
|
|
265
|
-
const contactTable = new Table({
|
|
266
|
-
style: { head: [], border: [] }
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
contactTable.push(
|
|
270
|
-
{ 'Email': 'brian@example.com' },
|
|
271
|
-
{ 'LinkedIn': 'linkedin.com/in/brianmaina' },
|
|
272
|
-
{ 'Twitter': 'twitter.com/brianmaina' }
|
|
273
|
-
);
|
|
274
|
-
|
|
275
|
-
console.log(contactTable.toString());
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
name: `šŖ Exit`,
|
|
280
|
-
value: () => {
|
|
281
|
-
console.log(gradient.pastel("Have a nice day!\n"));
|
|
282
|
-
process.exit();
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
let frame = 0;
|
|
146
|
+
const lyrics = [
|
|
147
|
+
"āŖ La la la la āŖ",
|
|
148
|
+
"āŖ Your favorite tune āŖ",
|
|
149
|
+
"āŖ Dancing in the terminal āŖ",
|
|
150
|
+
"āŖ So much fun! āŖ"
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
const interval = setInterval(() => {
|
|
154
|
+
console.clear();
|
|
155
|
+
console.log(gradient.fruit(frames[frame]));
|
|
156
|
+
console.log(gradient.pastel(lyrics[frame % lyrics.length]));
|
|
157
|
+
frame = (frame + 1) % frames.length;
|
|
158
|
+
}, 800);
|
|
159
|
+
|
|
160
|
+
await sleep(10000);
|
|
161
|
+
clearInterval(interval);
|
|
162
|
+
console.log(gradient.cristal('\nš Song ended! Hope you enjoyed the dance! š'));
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const handlePingPong = async () => {
|
|
166
|
+
console.log(gradient.fruit('š Ping Pong Championship! š\n'));
|
|
167
|
+
console.log('Controls: A/D to move paddle, Q to quit\n');
|
|
168
|
+
|
|
169
|
+
let paddlePos = 15;
|
|
170
|
+
let ballX = 20;
|
|
171
|
+
let ballY = 10;
|
|
172
|
+
let ballDirX = 1;
|
|
173
|
+
let ballDirY = 1;
|
|
174
|
+
const width = 40;
|
|
175
|
+
const height = 20;
|
|
176
|
+
let score = 0;
|
|
177
|
+
|
|
178
|
+
process.stdin.setRawMode(true);
|
|
179
|
+
process.stdin.resume();
|
|
180
|
+
|
|
181
|
+
const render = () => {
|
|
182
|
+
console.clear();
|
|
183
|
+
console.log(gradient.fruit(`Score: ${score}`));
|
|
184
|
+
for (let y = 0; y < height; y++) {
|
|
185
|
+
let line = '';
|
|
186
|
+
for (let x = 0; x < width; x++) {
|
|
187
|
+
if (y === ballY && x === ballX) {
|
|
188
|
+
line += gradient.fruit('ā');
|
|
189
|
+
} else if (y === height - 1 && x >= paddlePos && x < paddlePos + 8) {
|
|
190
|
+
line += gradient.cristal('ā');
|
|
191
|
+
} else if (y === 0 || y === height - 1 || x === 0 || x === width - 1) {
|
|
192
|
+
line += 'ā';
|
|
193
|
+
} else {
|
|
194
|
+
line += ' ';
|
|
283
195
|
}
|
|
284
196
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
197
|
+
console.log(line);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const gameLoop = setInterval(() => {
|
|
202
|
+
ballX += ballDirX;
|
|
203
|
+
ballY += ballDirY;
|
|
204
|
+
|
|
205
|
+
if (ballX <= 1 || ballX >= width - 2) ballDirX *= -1;
|
|
206
|
+
if (ballY <= 1) ballDirY *= -1;
|
|
207
|
+
if (ballY >= height - 2 && ballX >= paddlePos && ballX < paddlePos + 8) {
|
|
208
|
+
ballDirY *= -1;
|
|
209
|
+
score++;
|
|
210
|
+
}
|
|
211
|
+
if (ballY >= height - 1) {
|
|
212
|
+
console.log(gradient.pastel(`\nGame Over! Final Score: ${score}`));
|
|
213
|
+
clearInterval(gameLoop);
|
|
214
|
+
process.stdin.setRawMode(false);
|
|
215
|
+
process.stdin.pause();
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
render();
|
|
220
|
+
}, 150);
|
|
221
|
+
|
|
222
|
+
process.stdin.on('data', (key) => {
|
|
223
|
+
if (key[0] === 97) { // 'a'
|
|
224
|
+
paddlePos = Math.max(1, paddlePos - 2);
|
|
225
|
+
} else if (key[0] === 100) { // 'd'
|
|
226
|
+
paddlePos = Math.min(width - 9, paddlePos + 2);
|
|
227
|
+
} else if (key[0] === 113) { // 'q'
|
|
228
|
+
clearInterval(gameLoop);
|
|
229
|
+
process.stdin.setRawMode(false);
|
|
230
|
+
process.stdin.pause();
|
|
231
|
+
console.log(gradient.pastel('\nGame quit!'));
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const handlePortfolio = async () => {
|
|
237
|
+
console.log(gradient.fruit('š¼ My Skills & Portfolio š¼\n'));
|
|
238
|
+
|
|
239
|
+
const table = new Table({
|
|
240
|
+
head: [gradient.cristal('Skill'), gradient.cristal('Level')],
|
|
241
|
+
colWidths: [20, 20],
|
|
242
|
+
style: { head: [], border: [] }
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
table.push(
|
|
246
|
+
['JavaScript', 'āāāāā'],
|
|
247
|
+
['Node.js', 'āāāāā'],
|
|
248
|
+
['React', 'āāāā'],
|
|
249
|
+
['Python', 'āāāā'],
|
|
250
|
+
['Terminal Magic', 'āāāāā']
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
console.log(table.toString());
|
|
254
|
+
|
|
255
|
+
console.log('\n' + gradient.pastel('Projects:'));
|
|
256
|
+
console.log('⢠Terminal Business Card (You\'re using it!)');
|
|
257
|
+
console.log('⢠Awesome CLI Tools');
|
|
258
|
+
console.log('⢠Web Applications');
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const handleContact = async () => {
|
|
262
|
+
console.log(gradient.fruit('š Contact Information š\n'));
|
|
263
|
+
|
|
264
|
+
const contactTable = new Table({
|
|
265
|
+
style: { head: [], border: [] }
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
contactTable.push(
|
|
269
|
+
{ 'Email': 'brian@example.com' },
|
|
270
|
+
{ 'LinkedIn': 'linkedin.com/in/brianmaina' },
|
|
271
|
+
{ 'Twitter': 'twitter.com/brianmaina' }
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
console.log(contactTable.toString());
|
|
275
|
+
};
|
|
288
276
|
|
|
289
277
|
const prompt = inquirer.createPromptModule();
|
|
290
278
|
|
|
@@ -302,7 +290,32 @@ const followup = [
|
|
|
302
290
|
async function init() {
|
|
303
291
|
clear();
|
|
304
292
|
console.log(card);
|
|
305
|
-
await prompt(questions).then(answer =>
|
|
293
|
+
await prompt(questions).then(async answer => {
|
|
294
|
+
switch(answer.action) {
|
|
295
|
+
case 'resume':
|
|
296
|
+
await handleResume();
|
|
297
|
+
break;
|
|
298
|
+
case 'github':
|
|
299
|
+
await handleGitHub();
|
|
300
|
+
break;
|
|
301
|
+
case 'song':
|
|
302
|
+
await handleSong();
|
|
303
|
+
break;
|
|
304
|
+
case 'pingpong':
|
|
305
|
+
await handlePingPong();
|
|
306
|
+
break;
|
|
307
|
+
case 'portfolio':
|
|
308
|
+
await handlePortfolio();
|
|
309
|
+
break;
|
|
310
|
+
case 'contact':
|
|
311
|
+
await handleContact();
|
|
312
|
+
break;
|
|
313
|
+
case 'exit':
|
|
314
|
+
console.log(gradient.pastel("Have a nice day!\n"));
|
|
315
|
+
process.exit();
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
|
|
306
319
|
await Enquirer.prompt(followup).then(answer => {
|
|
307
320
|
if (!answer.exit) {
|
|
308
321
|
init();
|