Thursday, November 26, 2015

Remove Array Duplicates in ES6

We can use Set and spread operator to remove duplicates from an array.
[...new Set([1,2,3,1,2,3])];  // [1,2,3]
Array.from(new Set([1,2,3,1,2,3]));  // [1,2,3]

Thursday, May 14, 2015

Orientation Lock Cordova Plugin for Android

OrientationPlugin is a cordova plugin that allows to lock the app into portrait, landscape modes and is available from github.

Wednesday, February 4, 2015

jQuery Mobile Fixed Footer Jumps Up On Input Focus

In Android jQuery mobile's fixed footer goes up from bottom on input focus. The footer goes up when the virtual keyboard shows. The bug can be fixed by hiding the footer on input focus and displaying footer on focusout.
$(document).on('focus', 'input, textarea', function()  {
$.mobile.activePage.find("div[data-role='footer']").hide();
});
$(document).on('focusout', 'input, textarea', function() {
$.mobile.activePage.find("div[data-role='footer']").show();
});