Should you build a SPA?

Posted on 2020-06-15 in Programmation • Tagged with JavaScript, Web, Django

This article is an update to a previous article why you want to build a SPA which I think was laking some nuance and precision. Reading this article is not required to read this one. I'm writing this update because SPAs are very popular and I recently though more about …


Continue reading

JavaScript fatigue

Posted on 2020-05-31 in Programmation • Tagged with JavaScript

Today, I'd like to dig into something that has been bothering me lately: why I often feel tired of JavaScript (and even sometimes programming in general). I'm not alone in this, there's even a name for this JavaScript fatigue. Here I'll give my personal thoughts on this (and probably rant …


Continue reading

PWAs and Django

Posted on 2020-02-29 in Programmation • Tagged with Python, Django, PWA, JavaScript

In this article, I'll guide you to create a PWA with the Django framework. All the code for this project is available under my gitlab account. You will find in each sections links to the relevant commits to help you follow. If something is not clear or if you have …


Continue reading

Why you probably want to make a SPA

Posted on 2020-01-12 in Programmation • Tagged with JavaScript, Web, Django

Important

I created an updated version of this article in should you build a SPA which provides a more complete and balanced view on this subject. Please read it instead of this current article.

I am currently working professionally on a website that is not a SPA. I'd like to …


Continue reading

Writing a PWA with Aurelia

Posted on 2019-09-01 in Aurelia • Tagged with JavaScript, TypeScript, Aurelia, Mobile, PWA

I feel like Progressive Web Application (PWA for short) are a more and more popular way to build mobile apps. That's understandable since you can use the same technology you use to build a SPA to build one! So …


Continue reading

Some thoughts on Aurelia Store

Posted on 2019-08-24 in Aurelia • Tagged with JavaScript, TypeScript, Aurelia, RxJS

On my spare time, I am developing a board game that uses the Aurelia framework. I currently manage the state in a service without any dedicated state management solutions (like RxJS, Aurelia store, Redux, …). And I feel I am reaching to the limit of what I can do with it …


Continue reading

Issues while writing tests for a component using i18n

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

Some time ago, I wanted to add some tests (behavior and render) on an Aurelia component that uses the i18n plugin and more precisely the df attribute in the view to display a localized date.

Since it was a while back (I wanted to write it earlier but couldn't), my …


Continue reading

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