Powerful Web Development Tips and Tricks

Rajesh/ October 12, 2020/ web/ 0 comments

We learn a lot of new things every day. Here I add some of the tips and tricks that I myself use on a regular basis.

GIT

Edit your last commit:

Use git commit --amend to edit your last comment. It opens your last commit in a text editor in the console itself. You can edit the comment and save.

Terminal

How to use autocomplete in a terminal?

Your terminal already have an autocomplete feature. You can get autocomplete suggestions for commands, folder/file names. etc.

Start typing initial characters for your command and then press tab, If there are multiple options available, your terminal will give you multiple options to choose from. Or if there is only one option it will be chosen as default command.

If you press tab on an empty terminal, it will give you list of all the commands that you can run.

javascript

Replace all occurrences of a string

After learning how to replace all occurrences of a forward slash in javascript, I tried the same logic on simple strings. And I have found a better way to do that.

const str = 'let me find a and replace a with b' str1.replace(/a/g, 'b')
// "let me find b bnd replbce b with b"

Share this Post

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*