Category Archives: JavaScript

What is X-WSSE Token Authentication and how does it work

Learn the basics of X-WSSE Token Authentication and how to authorize requests using X-WSSE header authentication. X-WSSE Token Authentication can be used to authenticate backend-to-backend integrations using client_id and client_secret properties. The main benefit of this type of authentication is that the client_secret value never leaves the backend of the integrating client, and that each Continue Reading »

Convert seconds to Days, Hours, Minutes, Seconds

Learn how to convert number of seconds into days, minutes, hours and seconds. That’s it. You can now create a countdown timer, display the difference between two dates or just print  the time until something great happens. You now have 4 variables with values as follows: Bonus! Learn how to pad the values with 0 Continue Reading »

Google Ads placement In WordPress Sidebar

Writing articles and maintaining a website takes some time and is not exactly free. If you want to start monetizing your WordPress website you could use Google AdSense and place Google Ads in your website or mobile app. There are a few steps until you can manage to show ads on your websites. Let’s get Continue Reading »

Vue Observer Pattern Implementation

Learn how to implement Vue Observer Pattern in your web app. Probably one of my favorite design patterns is the Observer Pattern. This design pattern allows you to subscribe and emit events from components of your app.   Different web frameworks offer different implementation of the Observer app. Lucky me, implementing Observer in VueJS is Continue Reading »

Socket.IO AngularJS Wrapper

I’ve been playing around with Socket.IO and AngularJS. To make things easier I created this service which can be used for transferring data between the client (which could be a web page) and a NodeJS server. The app is served by NodeJS so the Socket.IO server is listening on same location. ‘use strict’; angular .module(‘APP’) Continue Reading »

Google Maps JavaScript Wrapper

Some of the projects I’ve implemented required some dynamic or static maps. Of course most powerful maps library at that time was Google Maps. The wrapper allows the insertion of markers with custom icon, circles, polylines and setting the center and zoom of the map. Here’s one version of the JavaScript Google Maps Wrapper that Continue Reading »

Senior JavaScript Interview Test

A few weeks ago a team that I collaborated with asked me to create a JavaScript Interview Test for seniors. The third part of the interview test also contains answers. My opinion is that if you ever use this test and the candidate can answer correctly to  1/3 of the questions, well you should definitely Continue Reading »

JavaScript Prototypal Inheritance Pattern

This is pretty basic stuff but I’ll just place it here in case someone searches for a way to achieve inheritance in JavaScript.   // JavaScript doesn’t have classes but same behavior can be easily obtained using functions // Let’s consider a class Person function Person() { = ”; this.birth = { ‘year’: -1, Continue Reading »

AngularJS Input Max Length Directive

In case you need to set a max length to a model binded input, well check this directive: ‘use strict’; angular .module(‘APP’) .directive(‘uiMaxlength’, function() { return { require: ‘ngModel’, link: function(scope, el, attrs, model) { var max_length = parseInt(attrs.uiMaxlength, 10); var input_value_parser = function(value) { if(value.length > max_length) { value = value.substring(0, max_length); model.$setViewValue(value); model.$render(); Continue Reading »