lee2sman 796652028f | ||
---|---|---|
.. | ||
README.md | ||
create-graves.js | ||
create-town.js | ||
example-blessed.js | ||
example-charlatan.js | ||
generate-book-title.js | ||
keypress-blessed.js | ||
pick-music-track.js | ||
troubadour-play-loop.js | ||
troubadour-play-two.js |
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.