Simple helper to run asynchronous functions and wait for them to finish before calling a callback function.
Callback use the node.js format:
cb = function(err, result...){...}| #!/bin/bash | |
| # File that contains the tasks | |
| DATA=$HOME/.config/todo.lst | |
| touch $DATA | |
| esc=$(printf '\033') | |
| tab=$'\t' | |
| # Highlight search term. |
| 'REV4 | |
| 'MEMORY MAPPING | |
| '$A000..$AFFF LOADED CHARA FROM FILE | |
| '$B000..$DFFF LOADED BG FROM FILE | |
| 'CELL 8X8 TOUCH COORDS | |
| GLOBAL CX,CY | |
| 'WHICH CORNER WAS TAPPED TO GO TO BGEDITOR, WHICH CORNER TO TAP TO GO BACK |
| local glyphsMesh | |
| local fontSelected=1 | |
| local fontData={ | |
| {row=0,col=0,space=5,spaces={ | |
| [32]=3, | |
| [33]=2,[34]=7,[35]=6,[36]=6,[37]=6,[39]=2,[40]=3,[41]=3,[42]=6,[43]=6,[44]=3,[45]=4,[46]=2,[47]=4,[48]=4, | |
| [49]=3,[50]=4,[51]=4,[52]=4,[53]=4,[54]=4,[55]=4,[56]=4,[57]=4,[58]=2,[59]=3,[60]=4,[61]=4,[62]=4,[64]=7, | |
| [73]=4,[74]=4,[75]=6,[76]=4,[77]=6, | |
| [84]=6,[87]=6,[89]=6,[91]=3,[92]=4,[93]=3,[94]=4,[96]=7, |
| <?php | |
| // Need: https://github.com/nrk/phpiredis | |
| class ErrorRespond extends Exception {} | |
| class ErrorConnection extends Exception {} | |
| class ErrorProtocol extends Exception {} | |
| class Client |
| <?php | |
| /** | |
| * Parse the command line and fill variables. | |
| * Params: | |
| * array $opts = An associated array. Keys are the option names. | |
| * Values are the references to variables that receive the values from the command lines. | |
| * Nothing is returned but when values of the array $opts are passed by reference, they will contain the | |
| * values extracted from the command line. | |
| * Keys must be string. |