Fabien Huet

Fabien
Huet

Web ninja //
CTO on demand

Home Github About me

☄ 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

📅 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

🖥️ 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

👾 How and why the hoisting works in JavaScript

in JavaScript

Most of the decent fronts-end developers I met knew the basic principles of hoisting. How variables declarations are handled by JavaScript engines and why you may encounter what could appear as a quirk for a non JS developer. But fewer knew why it works that way and what happen under the hood. So I’ll try a basic explanation for these elements.

Continue reading

How to « find deep » and « get parent » in JavaScript nested objects with recursive functions and the reference concept (level beginner)

in JavaScript

Working with nested objects is frequent in JavaScript ; so I made this screen cast around this question. But the goal here is to help JavaScript beginners to understand how to build a simple recursive function and to get a better intuition about the reference system in JavaScript. The full text contents is in the post and you have also a fiddle to play with the code and see it in action.

Continue reading