Tag: JavaScript

What is semantic versioning?

Have you seen how a project like Angular is versioned? You have maybe noticed when a brand-new release of that framework is created they release  it with three numbers, e. g. Angular 5.0.0, now the question is: what those three digits mean? The answer is simple: they are using a system called Semantic Versioning or mostly […]

Read More

How to get the keyboard key value with jQuery and run a custom action

This is probably the simplest way to capture the key that the user pressed and execute an action (in this case just a simple console.info). (function() { function customAction() { console.info(“You have pressed an ‘a’ in your keyboard”); } $(window).on(‘keypress’, function(event) { console.log(event.keyCode); // keyCode te da el código de la tecla que presiones if (event.keyCode […]

Read More

Remove special characters using a Regex in JavaScript

Imagine you have some strings and as a requirement of one your clients, you need to clean the strings by deleting all the special characters, so here are two regular expressions that could help you to start your cleaning, of course, the second one is more personalizable, but, be my guest and choose the one […]

Read More

How to know the Dojo version loaded in a web portal

When you work with Dojo in a portal that is already in production mode, one of the first question you want to answer yourself is: what is the version of Dojo do I have available for using? Well, to answer that, just open you web browser console and run this small JavaScript code: var v = […]

Read More

How to get same results when sorting JavaScript arrays in all browsers

The problem: 1) Imagine you have following array in JSON var data = [ { “title”: “Fine Fillers Treatment and Clay De-Activation Agents”, “topic”: “PHP”, “date” : “2014-01-25T01:32:21.170Z”, “url”: “http://www.alex-arriaga.com/session-1-cakephp-framework-for-beginners-in-spanish/” }, { “title”: “How to configure session factory to connect to a DB2 datasource with Hibernate”, “topic”: “Java”, “date” : “2014-02-12T01:32:21.171Z”, “url”: “http://www.alex-arriaga.com/how-to-configure-session-factory-to-connect-to-a-db2-datasource-with-hibernate/” }, { […]

Read More

How to know jQuery version using Firebug console

This is a little tip for today: sometimes, you don’t have access to know what version of jQuery is loaded in a website or web application, so you can use the Firebug console to know what version is actually loaded. Just, type one of the next lines and you will obtain that data. Both major […]

Read More