Refresh node.js script! - macos

I am running a script with node.js from the terminal (mac) and when I change my script I want to be able to rerun it without having to close and reopen terminal, Im a noob to mac and not sure how to do this?
Thanks

How are you starting Node? You should never have to close your terminal window. At the very least, you should be able to type ctrlC to stop it, then press the up arrow to bring the node command back from your command history, or type the command !!, which means “the last command line I ran”, and hit the return key.
Or, use node-dev. It automatically restarts node when files change in the same directory as your node script. You can install it with npm. Then, run node-dev instead of node:
node-dev script.js

This script is what I use. It works great!

There are several modules for this that you can install using npm, including:
nodemon
nolife
restartr

Related

How to check vscode commands that are invoked when I use a keybinding?

I have a problem with doublepasting values into vscode's console, I would like to check what commands are run to find out what's causing the problem and I wasn't able to find out how to do it, I remember launching a command in Sublime Text that logged every command ran to editor's console and I don't know how to enable such mode in vscode.

adb: command not found after restarting OS X

I'm a bit of a noob at this, but every time I restart my machine and update OS X, I lose adb commands in terminal. I'm not sure how or why this happens or how to get them back aside from reinstalling adb tools, but I'm assuming there's a better way.
The adb tools need to be added to the paths so terminal searches the directory the tools are in.
Assuming you are using a bash terminal you edit or create .bash_profile-file that defines the paths to search, in the example below using the nano-editor:
nano ~/.bash_profile
Enter the path to the adb tools as follows:
export PATH=$PATH:/path/to/the/adb/tools
Save the file (CTRL-X, choose Yes on Save), close the terminal window and open up a new one to load the .bash_profile. This should solve your problem.

How to run this Terminal line in Automator's Run Shell Script?

I am a Terminal newbie and installed aria2 on my Mac. When I need to use aria2, I open up Terminal and enter "aria2c" without touching anything else, it works great.
Then I want to create an application to run this line with Automator so I can just drop it to the dock and click to start aria2. I tried but no luck, any help please!
Fixed it with the following:
/usr/local/aria2/bin/aria2c

After I set Compass to start watching a folder, what key(s) do I then hit to return to the command line?

After I set Compass to start watching a folder, what key(s) do I then hit to return to the command line? I'm using a Windows PC. Thanks.
Just spawn another command window...this one needs to stay up while the folder is being watched. Here's a good strategy for you :: run compass watch terminal command upon opening the folder with textmate

how to make my console in python not to close?

I'm making a application in python from Windows. When I run it in the console, it stops, shows an error, and closes. I can't see the error becase its too fast, and I can't read it. I'm editing the code with IDLE (the program that came with python when I instaled it), and when I run it with the python shell, there are no errors. I would run it from IDLE, but when I use the console, it has more features.
I don't know why this is happening. I need your help.
Run the program from an already-open terminal. Open a command prompt and type:
python myscript.py
For that to work you need the python executable in your path. Just check on how to edit environment variables on windows, and add C:\PYTHON26 (or whatever directory you installed python to).When the program ends, it'll drop you back to the CMD windows prompt instead of closing the window.Add code to wait at the end of your script. Adding ...
raw_input()
... at the end of the script makes it wait for the ENTER key. That method is annoying because you have to modify the script, and have to remember removing it when you're done.
Run your program from a Windows command prompt. That will not automatically close when the program finishes.
If you run your program by double-clicking on the .py file icon, then Windows will close the window when your program finishes (whether it was successful or not).
Create a text file in the program directory i.e. wherever your script is located. Change the extension to .bat for example text.bat. Then edit the text file and write:
python main.exe
pause
Now you can run the program without typing into the command console by double clicking the bat file, and the console window will not close.

Resources