Fabien Huet

Fabien
Huet

Web ninja //
CTO on demand

Home Github About me

Authentication, ditch the username and go passwordless

in Web

Classic authentication processes with a username and a password are great except for two things: the username and the password. Here is my rant about how we can do better.

Continue reading

Webpack, loaders, Babel, sourcemaps, React, Hot Module Reload, TypeScript, modules, code splitting and lazy loading full tutorial to transpile and bundle your code

in React, JavaScript, Webpack

So many keywords in this title… The ecosystem of web development today appears complicated, and you may feel overwhelmed. So let me take you in a step-by-step tutorial to learn about each of those words and the related technologies. This article is mainly about how to use webpack to bundle your code into static assets.

TL;DR: here is the Github repo with the result. You can clone it and use it as a starter kit for single page applications with Webpack, Babel, React, TypeScript, HMR and code-splitting.

Continue reading

Complex batch updates or migration on your distant MongoDB base with a script and mongo shell

in MongoDB

If you work with a hosted MongoDB database on a DAAS (Database As A Service) like MongoDB Atlas, mLab or Compose, you often need scripting for complex operations. Like when you need to update one field in all the documents of a collection with a transformation from other fields in this document or even from different documents in other collections. A simple update is not enough.

Continue reading

☄ Redirect non-www to www in a meteor app deployed on Galaxy with SSL

in JavaScript, Meteor

You cannot have both www and non-www version because they would be considered two different sites. I root for the www version. See the yes-www arguments for this. Without https, the redirection is super easy to setup; you use URL forwarding at the DNS level. But with https this is not possible. Let’s see how to fix that.

Continue reading

🔥 Make your meteor site load FAST!

in JavaScript, Meteor

Meteor does not shine when it is serving static pages. And often, you switch to another solution. Check out their documentation , it is generated with hexo . Hexo is great, good choice. But when you are building “the fastest way to build JavaScript apps” with an amazing build tool and that you end up using another generator to build your documentation, there is room for improvement !

Continue reading

Hey Adobe! Please make Illustrator Assets Export for SVGs cleaner. (I still love you)

in SVG

The Assets Export panel in Illustrator is great. It did improve my workflow a lot for PNGs. But sadly, I still have to clean up Illustrator SVGs.

Continue reading

Format a Date in JavaScript

in JavaScript

[EDIT]:

Forget this article and use new Date().toLocaleDateString('fr', {day: 'numeric', weekday: 'long', month: 'long', year: 'numeric'}). The toLocaleDateString is perfect for most use.

My default choice for date formatting in JavaScript used to be Moment.js . It is a great library. A really complete solution to manage dates. I still use it server side. But 16.6k gziped, or 62.4 k with all the locales for one function ? That is way to much !

Continue reading

Formater une date en Javascript

in JavaScript fr

[EDIT 2018]:

Oubliez cet article et utilisez new Date().toLocaleDateString('fr', {day: 'numeric', weekday: 'long', month: 'long', year: 'numeric'}). L’API toLocaleDateString est parfaite pour la plupart des usages.

Mon choix par défaut pour formater des dates en JavaScript a longtemps été Moment.js . C’est une solution vraiment complète pour gérer les dates ; et je l’utilise encore côté serveur. Mais 16.6k gzipé, ou 62.4 k avec toutes les locales pour une seule fonctionnalité ? C’est trop pour moi.

Continue reading

An alternative to if/else and switch in JavaScript

in JavaScript

I don’t intend to replace them for all their use case. It would be dumb. The alternative won’t change the way it works and its purpose is mostly code aesthetic.

Continue reading

Working in the DevTools, you don't use the console enough

in JavaScript

As front end developers, the browser console panel and the console API should be one of our primary tools. We all use the console.log() or console.dir() methods, but too few of us master the trace, time, profile and other magic methods that the console API provides. I will assume that you work with chrome and know how to access your console. I won’t write about the other pannels (Elements, Network…) but they are, of course, mandatory to master.

Continue reading