Valuable Site of the Month (Oct '19) - Online HTML Editor
· ☕ 2 min read
We back with a valuable site of the month after a not-so-brief hiatus. Here’s presenting this month’s pick - an online HTML editor. No.. Not another editor HTML editors are aplenty. Anyone and everyone can whip up a quick site using TinyMCE, CKEditor and the like, provide a preview and call it a day.

Email for NodeJS app using separate server on CPanel
· ☕ 3 min read
Configure email server on a third party host using CPanel, while continuing your app server on your favourite VPS. Background Typically I configure email server to be on the same server as my NodeJS / PHP app. Bad practice? Sure. But, it works just fine for the kind of applications that I write.

Reusable debounce function for Vue
· ☕ 5 min read
Debounce operations in Vue using this 10 line script. Avoid loadash and friends. What is debounce? Delay and throttle operations to wait and collect user input before doing something with the input. The “something” can be updating another field, doing an API call, or starting a timer to self-destruct. Did you not debounce earlier?

Centralized alert for Vuetify
· ☕ 4 min read
Centralize all error, warning and info alerts in one place. I like v-alert and tend to over-use it. It enables us to show detailed notifications (error or otherwise) - without significantly causing user inconvenience. I find v-alert more suitable in my apps than using, say, popup alerts that interrupt users, or “toast” notifications which I find unsuitable for detailed messages.

Include full content in site feed in Hugo
· ☕ 2 min read
Include all content of your posts in your site feed when using Hugo static site generator. By default Hugo will include only summary in your website feed (e.g. in /index.xml). Your theme may already provide a way to provide full content instead of just the summary. If it doesn’t, you can make those simple changes yourself.

Pass all scoped slots b/w components
· ☕ 1 min read
A nice way to pass along all scoped slots to a component. We can pass all props from the source component to target using this code - 1 2 3 4 5 6 7 <wrapper> <b-table v-bind="$attrs" v-on="$listeners"> <template v-for="(_, slot) of $scopedSlots" v-slot:[slot]="scope" ><slot :name="slot" v-bind="scope" /></template> </b-table> </wrapper> Found this in this StackOverflow post.

Asserts are not just for testing
· ☕ 2 min read
Assert is a general-purpose validator and should not be used in the context of testing alone. An assert in Javascript simply checks for truthy values and produces an error otherwise. We use it quite a bit in automated testing when checking for correctness of output for pre-defined inputs. We use asserts like so -

unknown vs. any in Typescript
· ☕ 1 min read
Why use unknown when we have any in Typescript? Type inferences are powerful and allows us to do magic when we don’t know types. 1 2 3 const i: any = 1; console.log(i); // 1 unknown seems to do the same thing. 1 2 let x: unknown = 1; console.

Interfaces as function types in Typescript
· ☕ 2 min read
Let’s get to know interfaces for functions - yes, that’s a thing. We have seen interfaces used as types and interfaces as array types. Since function is an object and interfaces are supported on other objects, they should be supported on functions also. Right? You betcha. What is this blog if we can’t write about all the stuff that no one care’s about?

Modules in Typescript
· ☕ 3 min read
It’s not the why, but more on what of ‘modules’. No Javascript is an island. It was an island about two decades back but Javascript has done some pretty good land reclaimation to form large continents now. So it goes without saying that these are not the days of writing Javascript or Typescript in <script> tag in a single HTML.

Extend interfaces in Typescript
· ☕ 2 min read
Interface an interface. If that doesn’t excite you, I don’t know what will. We have seen interfaces used as types before. But as our God Goop says - “abstract; (while && when) you can;”. So, we are here to know about interfaces for interfaces. Consider this simple example - 1 2 3 interface Borg { name: string; } Now, any class implementing the interface Borg will have a name attribute.

Interfaces for Arrays in Typescript
· ☕ 2 min read
What exactly are interfaces for arrays? Previously we have seen interfaces as types. Interfaces provide useful abstraction on class and can be useful in tricky situations with complex types. But, what about interfaces for array? It turns out interfaces can be as easily applied for array types as well. They are just super useful as interfaces that define complex types and make arrays type-safe - nothing more, nothing less.

Anonymous functions in Typescript
· ☕ 2 min read
Let’s talk anonymous functions and make them, well, “not anonymous”. Anonymous functions are just functions without names. If you have been following this blog, or have written some Javascript - you surely would have come across them. Anonymous functions are just function expressions. Let’s see a quick example. The following code block has a ‘named’ function.