What to do with that code that you use in every projects?

Nguyễn Việt Hưng
The happy lone guy
Published in
3 min readJun 9, 2018

We all have a small robust piece of code that we use in almost all of our project. However, you may wonder, what is the right thing to do with it other than saving it into a .txt file and re-use it in the next project? Well here are some ways that you can do with it.

Create a library with it

If you use a piece of code frequently, there is no better way than create a library out of it. For example, if you work with form validation every day and every projec then beside of saving it into a file. You can create a whole library using that piece of code so that next time you can use a package manager to pull that library to the project therefor speed up your development process.

Personally, I used to work with push notification a lot, so I created a library called NoticeZ containing my code and now it has 3 stars on github :’) But basically this help boost up my development a lot as now with just a simple npm command, I can use a library that I can deeply understand and have more trust on.

Store it on gist

Another way to keep your code to re-use in other projects is to store it on gist. This is also a very effective way to keep your code for later use as gist is free and it’s on the internet therefor it can be access anywhere that has an internet connection. However, while this method seem to be easy and convenient, you can’t fully customize how you use gist and the security issue is going to make your eyes red if the code you uploaded is a billion-worth code snippet.

Store it locally

“Nowhere like home” what is the better way to keep a secret code other than in your own secure hard drive. However, as easy as it seem, knowing how to store your snippets is also a tough challenge. Fortunately, there’re some snippet management app out there for you to use. However, some of them require a “small” amount of money and you don’t even know if they going to worth your money or not.

In conclusion

While each method has their own advantage, their drawbacks is also exist, thus, choose wisely on how you want to store your snippets.

Here are list of free snippet management app that I recommend to try:

  • SnippetStore

I actually the creator of this app :)

SnippetStore is a snippet management app for developers. It basically designed on how I feel that it’s easy to use. I currently still working on some cool feature for this and I recommend this app if you’re a busy developer who need to get things done in 1 click without bothering the small details.

  • Lepton

Lepton is a gist based snippet management app. When using this app you basically use the 2th method that I introduced above which means they also have their own pros and cons.

  • Boostnote

Boostnote isn’t exactly the snippet management app. It actually a markdown note app, but it also have a snippet note type which I found pretty convenient to use and also, it’s free!

--

--

Nguyễn Việt Hưng
The happy lone guy

A web developer who love to create everything using web technology