This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var longestCommonPrefix = function(strs) { | |
| var common = ""; | |
| var index = 0; | |
| if(strs.length == 0 || strs == "null"){ | |
| return common; | |
| } | |
| // split the first string of strs | |
| var string = strs[0].split(""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const commands = require('./commands.js'); | |
| //prompt the user for input | |
| process.stdout.write('prompt > '); | |
| // the stdin 'data' event triggers after a user types in a line | |
| process.stdin.on('data', (userInput) => { | |
| userInput = userInput.toString().trim(); | |
| commands.evaluateCmd(userInput); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //import fs library | |
| const fs = require('fs'); | |
| //write out data | |
| function done(output) { | |
| process.stdout.write(output); | |
| process.stdout.write('\nprompt > '); | |
| } | |
| // where we will store our commands |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library=# SELECT * FROM books; | |
| id | title | author | |
| ------+------------------------------------------+--------------------- | |
| 1259 | Eloquent Ruby | Russell A. Olson | |
| 1593 | JavaScript: The Good Parts | Douglas Crockford | |
| 8982 | Designing Object-Oriented Software | Rebecca Wirfs-Brock | |
| 7265 | Practical Object-Oriented Design in Ruby | Sandi Metz |