dot.dot.dot.exampol

This commit is contained in:
Captain Nick Lucifer* 2023-03-10 23:21:16 +05:45
commit a0bc2d79de
406 changed files with 34577 additions and 0 deletions

17
node_modules/charm/example/256.js generated vendored Normal file
View file

@ -0,0 +1,17 @@
var charm = require('../')(process);
function exit () {
charm.display('reset');
process.exit();
}
charm.on('^C', exit);
var ix = 0;
var iv = setInterval(function () {
charm.background(ix++).write(' ');
if (ix === 256) {
clearInterval(iv);
charm.write('\n');
exit();
}
}, 10);

11
node_modules/charm/example/column.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
var charm = require('../')();
charm.pipe(process.stdout);
charm
.column(16)
.write('beep')
.down()
.column(32)
.write('boop\n')
.end()
;

22
node_modules/charm/example/cursor.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
var charm = require('../')(process);
charm.position(5, 10);
charm.position(function (x, y) {
console.dir([ x, y ]);
charm.move(7,2);
charm.push();
process.stdout.write('lul');
charm.left(3).up(1).foreground('magenta');
process.stdout.write('v');
charm.left(1).up(1).display('reset');
process.stdout.write('|');
charm.down(3);
charm.pop().background('blue');
process.stdout.write('popped\npow');
charm.display('reset').erase('line');
charm.destroy();
});

36
node_modules/charm/example/http_spin.js generated vendored Normal file
View file

@ -0,0 +1,36 @@
var http = require('http');
var charmer = require('../');
http.createServer(function (req, res) {
res.setHeader('content-type', 'text/ansi');
var charm = charmer();
charm.pipe(res);
charm.reset();
var radius = 10;
var theta = 0;
var points = [];
var iv = setInterval(function () {
var x = 2 + (radius + Math.cos(theta) * radius) * 2;
var y = 2 + radius + Math.sin(theta) * radius;
points.unshift([ x, y ]);
var colors = [ 'red', 'yellow', 'green', 'cyan', 'blue', 'magenta' ];
points.forEach(function (p, i) {
charm.position(p[0], p[1]);
var c = colors[Math.floor(i / 12)];
charm.background(c).write(' ')
});
points = points.slice(0, 12 * colors.length - 1);
theta += Math.PI / 40;
}, 50);
req.connection.on('end', function () {
clearInterval(iv);
charm.end();
});
}).listen(8081);

24
node_modules/charm/example/lucky.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
var charm = require('../')();
charm.pipe(process.stdout);
charm.reset();
var colors = [ 'red', 'cyan', 'yellow', 'green', 'blue' ];
var text = 'Always after me lucky charms.';
var offset = 0;
var iv = setInterval(function () {
var y = 0, dy = 1;
for (var i = 0; i < 40; i++) {
var color = colors[(i + offset) % colors.length];
var c = text[(i + offset) % text.length];
charm
.move(1, dy)
.foreground(color)
.write(c)
;
y += dy;
if (y <= 0 || y >= 5) dy *= -1;
}
charm.position(0, 1);
offset ++;
}, 150);

7
node_modules/charm/example/position.js generated vendored Normal file
View file

@ -0,0 +1,7 @@
var charm = require('charm')(process);
charm.on('^C', process.exit);
charm.position(function (x, y) {
console.log('(%d, %d)', x, y);
});

18
node_modules/charm/example/progress.js generated vendored Normal file
View file

@ -0,0 +1,18 @@
var charm = require('../')();
charm.pipe(process.stdout);
charm.write('Progress: 0 %');
var i = 0;
var iv = setInterval(function () {
charm.left(i.toString().length + 2);
i ++;
charm.write(i + ' %');
if (i === 100) {
charm.end('\nDone!\n');
clearInterval(iv);
}
}, 25);
charm.on('^C',process.exit);

62
node_modules/charm/example/resize.js generated vendored Normal file
View file

@ -0,0 +1,62 @@
var c = require('../')();
c.pipe(process.stdout);
c.on('^C', process.exit);
var queue = (function () {
var tasks = [];
var pending = false;
return {
abort : function () {
tasks = [];
next();
},
push : function (t) {
tasks.push(t);
if (!pending) next();
}
};
function next () {
pending = true;
process.nextTick(function () {
if (tasks.length === 0) return;
var t = tasks.shift();
t();
pending = false;
next();
});
}
})();
process.stdout.on('resize', draw);
draw();
setInterval(function () {}, 1e8);
function draw () {
var cols = process.stdout.columns;
var rows = process.stdout.rows;
queue.abort();
queue.push(function () {
c.reset();
c.background('blue');
c.position(1, 1);
c.write(Array(cols + 1).join(' '));
});
for (var y = 1; y < rows; y++) {
queue.push(function () {
c.position(1, y);
c.write(' ');
c.position(cols, y);
c.write(' ');
});
}
queue.push(function () {
c.position(1, rows);
c.write(Array(cols + 1).join(' '));
c.display('reset');
});
}

23
node_modules/charm/example/spin.js generated vendored Normal file
View file

@ -0,0 +1,23 @@
var charm = require('../')(process);
charm.reset();
var radius = 10;
var theta = 0;
var points = [];
var iv = setInterval(function () {
var x = 2 + (radius + Math.cos(theta) * radius) * 2;
var y = 2 + radius + Math.sin(theta) * radius;
points.unshift([ x, y ]);
var colors = [ 'red', 'yellow', 'green', 'cyan', 'blue', 'magenta' ];
points.forEach(function (p, i) {
charm.position(p[0], p[1]);
var c = colors[Math.floor(i / 12)];
charm.background(c).write(' ')
});
points = points.slice(0, 12 * colors.length - 1);
theta += Math.PI / 40;
}, 50);