dungeon-of-the-day/examples
lee2sman 796652028f add pick-music-track.js 2021-04-08 02:12:05 -04:00
..
README.md update example descrip of pick-music-track 2021-04-08 02:11:56 -04:00
create-graves.js add example and minimal tests of blessed project-name generator, charlatan libraries 2021-03-27 22:37:31 -04:00
create-town.js add example and minimal tests of blessed project-name generator, charlatan libraries 2021-03-27 22:37:31 -04:00
example-blessed.js add example and minimal tests of blessed project-name generator, charlatan libraries 2021-03-27 22:37:31 -04:00
example-charlatan.js add example and minimal tests of blessed project-name generator, charlatan libraries 2021-03-27 22:37:31 -04:00
generate-book-title.js add example and minimal tests of blessed project-name generator, charlatan libraries 2021-03-27 22:37:31 -04:00
keypress-blessed.js update keypress-blessed.js 2021-03-27 23:02:56 -04:00
pick-music-track.js add pick-music-track.js 2021-04-08 02:12:05 -04:00
troubadour-play-loop.js add troubadour-play-loop.js 2021-04-04 18:23:47 -04:00
troubadour-play-two.js add troubadour-play-two.js example 2021-04-04 18:55:44 -04:00

README.md

Example tests

To use these examples you'll need to install the node.js libraries they rely on: blessed, charlatan and project-name-generator

Usage:

node keypress-blessed

Blessed screen drawing library

keypress-blessed.js - This is a minimal (or as minimal as I could wrangle) example of using the blessed library for terminal screen drawing. It is capable of detecting keypresses, then redrawing over the entire screen and printing out whether you pressed any arrow key or directional vim-key. Or press 'q' to quit. And that's it!

example-blessed.js - This is the example program for Blessed. copyright 2013, Christopher Jeffrey (MIT License).

Charlatan to generate names

create-graves.js - Charlatan is a node.js library for text generation with a focus on generating fake user data. create-graves.js is a minimal example of generating an epitaph, using node.js's built-in fs filesystem to ingest a hidden text file of verbs and Charlatan to generate a name, and then some simple madlibs-style parsing to generate the epitaph.

example-charlatan.js is the 'hello world' of using the charlatan library.

project-name-generator to generate some random words for a title

createtown.js. - project-name-generator is a node.js library for generator heroku-style project names (a number of words in a row, separated by spaces, hyphens or a comma-separated list). In create-town.js I generate 3 to 6 example tiny village names, with an additional function to capitalize words.

generate-book-title.js - This is a minimal example to generate a book title. It doesn't have capitalization, but that could be added (see createtown.js).

Play audio with troubadour

troubadour-play-loop.js - a small program to test playing audio in a loop. Troubadour works with (and requires) at least one commandline audio player, that must be specified. Can use sox, mplayer, mpg123, or vlc.

troubadour-play-two.js - is similar to above but allows simultaneously looping playback of 2 loops, of different lengths

Pick Music Track

pick-music-track.js - overly verbose program to find total number of directories in a folder, pick one randomly, then pick a random numbered (and named) mp3 track from that folder.