Exec : display stdout “live”

Don’t use exec. Use spawn which is an EventEmmiter object. Then you can listen to stdout/stderr events (spawn.stdout.on(‘data’,callback..)) as they happen. From NodeJS documentation: var spawn = require(‘child_process’).spawn, ls = spawn(‘ls’, [‘-lh’, ‘/usr’]); ls.stdout.on(‘data’, function (data) { console.log(‘stdout: ‘ + data.toString()); }); ls.stderr.on(‘data’, function (data) { console.log(‘stderr: ‘ + data.toString()); }); ls.on(‘exit’, function (code) { … Read more

How do I define global variables in CoffeeScript?

Since coffee script has no var statement it automatically inserts it for all variables in the coffee-script, that way it prevents the compiled JavaScript version from leaking everything into the global namespace. So since there’s no way to make something “leak” into the global namespace from the coffee-script side of things on purpose, you need … Read more

How to run Gulp tasks sequentially one after the other

By default, gulp runs tasks simultaneously, unless they have explicit dependencies. This isn’t very useful for tasks like clean, where you don’t want to depend, but you need them to run before everything else. I wrote the run-sequence plugin specifically to fix this issue with gulp. After you install it, use it like this: var … Read more

How to use executables from a package installed locally in node_modules?

UPDATE: As Seyeong Jeong points out in their answer below, since npm 5.2.0 you can use npx [command], which is more convenient. OLD ANSWER for versions before 5.2.0: The problem with putting ./node_modules/.bin into your PATH is that it only works when your current working directory is the root of your project directory structure (i.e. … Read more

How does Trello access the user’s clipboard?

Disclosure: I wrote the code that Trello uses; the code below is the actual source code Trello uses to accomplish the clipboard trick. We don’t actually “access the user’s clipboard”, instead we help the user out a bit by selecting something useful when they press Ctrl+C. Sounds like you’ve figured it out; we take advantage … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)