Readline is a more robust REPL.
readline = require('readline')
repl = readline.createInterface(stdin, stdout, autocomplete)
repl.historyIndex = 0
repl.history = ['App.Post.all()']| module Jekyll | |
| module Convertible | |
| def write(dest) | |
| path = destination(dest) | |
| FileUtils.mkdir_p(File.dirname(path)) | |
| if File.extname(path).downcase == '.html' then | |
| self.output.strip! | |
| reg = /<\/?pre[^>]*>/i | |
| pres = self.output.scan(reg) | |
| tary = self.output.split(reg) |
| var readline = require('readline'), | |
| _ = require('lodash'), | |
| charm = require('charm')(process.stdout), | |
| rl = readline.createInterface(process.stdin, process.stdout); | |
| var selected = 0; | |
| var choices = [ | |
| "foo", | |
| "bar", | |
| "javascript", |
| var http = require('http'); | |
| var spawn = require('child_process').spawn; | |
| var child = spawn( | |
| 'CMD', [ | |
| '/S', | |
| '/C', | |
| 'node', | |
| './child.js' | |
| ] | |
| ); |
| var mkdir = function(dir) { | |
| // making directory without exception if exists | |
| try { | |
| fs.mkdirSync(dir, 0755); | |
| } catch(e) { | |
| if(e.code != "EEXIST") { | |
| throw e; | |
| } | |
| } | |
| }; |
| var crypto = require('crypto'); | |
| /** | |
| * Calculates the hash/checksum of a string. Default algorithm is MD5. | |
| * | |
| * @param {String} str | |
| * @param {String} algorithm | |
| * @return {String} checksum | |
| * @api public | |
| */ |
| var flattenObject = function(ob) { | |
| var toReturn = {}; | |
| for (var i in ob) { | |
| if (!ob.hasOwnProperty(i)) continue; | |
| if ((typeof ob[i]) == 'object') { | |
| var flatObject = flattenObject(ob[i]); | |
| for (var x in flatObject) { | |
| if (!flatObject.hasOwnProperty(x)) continue; |