Extract translations from your Aurelia app

Posted on 2019-08-03 in Aurelia • Tagged with JavaScript, TypeScript, Aurelia, i18N

If you use Aurelia with the i18n plugin, you will have to maintain JSON files that will map a translation key to an actual translation. Manually editing the file to add/remove keys can be tedious.

Luckily, keys can be extracted automatically thanks to i18next-scanner. It can extract translation keys …


Continue reading

JavaScript tips

Posted on 2018-03-07 in Trucs et astuces • Tagged with JavaScript

Normalize an UTF-8 string

Rely on String.prototype.normalize().

const str = "Crème Brulée"
str.normalize('NFD').replace(/[\u0300-\u036f]/g, "")
> 'Creme Brulee'

Source: https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463


Utiliser istanbul pour voir le code coverage de tests lancés avec protractor

Posted on 2015-09-25 in Programmation • Tagged with istanbul, javascript, protractor, AngularJS, code coverage

Récemment j'ai eu besoin d'avoir du code coverage (assuré par istanbul) pour des tests d'intégration d'une application AngularJS. Ces tests sont lancés avec protractor et ce n'est pas aussi simple qu'il n'y parait. L'idée de base est :

  • D'associer une fonction à la clé onPrepare dans la configuration de protractor. Dans …

Continue reading

AngularJS tips

Posted on 2015-04-26 in Programmation • Tagged with JavaScript, AngularJS

This page lists all the angularjs tips I have collected.

Disable HTTP request caching

This is mostly useful on Internet Explorer: every HTTP requests made with the $http service …


Continue reading

Utiliser AngularJS et Django pour faire des requêtes AJAX

Posted on 2014-10-25 in Programmation • Tagged with Django, JavaScript, AJAX, AngularJS

Dans ce petit tuto, je vais vous expliquer comment faire pour poster un formulaire Django via une requête AJAX en utilisant le framework JavaScript AngularJS. Tout d'abord, il faut un peu de préparation. Voici le modèle que nous allons utiliser (les imports ne sont pas précisés et je suppose que …


Continue reading

Installer des paquets npm sans les droits root

Posted on 2014-10-24 in Programmation • Tagged with JavaScript, npm

npm peut soit installer un paquet dans le dossier du projet courant soit de façon globale pour tous les projets avec l'option -g. Par défaut dans ce mode, npm installe les paquets dans /usr/lib/node_module ce qui nécessite les droits root. En dehors du désagrément que cela procure, cela …


Continue reading