Always Create 404 Pages in your Vue App
· ☕ 4 min read
I create 404 pages as a standard practice in my Vue applications. You need that to manage browser page refreshes and to serve direct URLs for all possible pages in your application. Vue app has two parts - backend API frontend routes (pages) Any and all requests to the server go through our Nginx web server.

Avoid Vuex Boilerplate Code using Pathify
· ☕ 4 min read
Vuex is a lot of boilerplate. Consider this user store - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 //store/user.

Vuex Helper Functions
· ☕ 2 min read
Use helper functions to access Vuex capabilities and greatly increase readability of your code. We will consider the following Vuex store for a quick demonstration - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // store/index.js import Vue from "vue"; import Vuex from "vuex"; import user from ".

Setup Modular Vuex
· ☕ 2 min read
Vuex is my preferred way to manage state within Vue. Vuex is better structured using modules to make your code more readable and maintainable. See why you should use Vuex in Vue. Create a Vue app as you will always do using vue create myApp. Do a cd myApp && vue add vuex if you have not selected Vuex at the very beginning.

For Loop Performance in Javascript
· ☕ 3 min read
There are many types of for loops for an array - which should you use? How will you balance performance vs. code readability? Is that even a valid question? Let’s see a few cases. We will be seeing these distinct for loops today - for for-in forEach Note that the performance can be safely ignored for one off loops that do not hold up the user.

Spin-up a quick web server in Javascript
· ☕ 2 min read
Use these two quick ways to get a webserver up and running from any folder. 1. Use http-server Install http-server. 1 npm install http-server -g Navigate to any folder where you need a quick web server and start server. 1 2 cd client/dist http-server You can even proxy requests to a back-end server where required.

Date Object in Javascript
· ☕ 2 min read
Let’s see a few points about when to use a date object, and why use this object vs. a date library? The simplest and quickest way to get date in Javascript - 1 console.log(Date.now()); // 1549025852124 Date.now() does not create an object, and is really fast. But, it is also useless if you want to do anything with the date.

Arguments Object in Javascript
· ☕ 2 min read
Arguments object enables you to treat function arguments with respect.. and the developers with compassion. How do you pass arguments to a function? In its most primitive form: 1 2 3 function getSum(a, b) { return a + b; } This is perfectly ok in an ideal world where Buddha walks the earth.

Non-enumerable Properties in Javascript
· ☕ 2 min read
When you define a prototype for an object you run the risk of counting that as an object property. Use non-enumerable to avoid doing that. Consider this - 1 2 3 4 5 6 7 8 9 Object.prototype.colors = () => { return; }; let fruits = ["apple", "orange"]; console.

Create static sites in Vue using Gridsome
· ☕ 3 min read
I love the simplicity, speed and awesomeness of static sites. I also happen to love Vue for its power, simplicity and its feature set that makes development that much easier. So, what will happen when Vue is combined with static sites? Awesome Gridsome - that’s what. Gridsome describes itself as a Vue-powered site generator.

Create your Own Javascript Playground
· ☕ 2 min read
I write quite a bit of Javascript on a day to day basis. But, I have a poor memory and keep forgetting things. Things like how I should be using a certain function the right way. This is where web applications like https://jscomplete.com/playground help. But it is not a pleasant experience to have blocks of incomplete code lying around in jscomplete, and keep executing few other parts of the program.

Context of This in Javascript
· ☕ 3 min read
I have often seen how people talk and write about this being all complex and such. But frankly, I don’t understand the pain. All it takes for me to understand is 4-5 iterations of using this in a different functions, classes, modules and so forth, messing up a bit - each time, and trying to do that over & over until I get the right context with the right this.

Spin up your own local GraphQL server within 15 min
· ☕ 3 min read
Create your own GraphQL APIs in 15 min flat using Postgres database and a bit of help from PostGraphile. No GraphQL server configuration needed. No frontend beginner developer ever said - “I want to play around with servers to understand their internals byheart before I venture forth with my beautiful Vue application”.