Category Archives: Uncategorized

Why you should reinvent the wheel, but shouldn’t use it

Why you should reinvent the wheel, but shouldn’t use it

I am a passionate developer. I didn’t choose this path because I wanted to make big money, or create the next Unicorn. I became a developer because I love code.

I started coding early, at about twelve. This was a time were the Internet was barely emerging. the access to information was scarce, but yet there. You had to know the right words to find what you needed. Thus, at the beginning, I was “reinveting the wheel”. A lot of times. And as a developer we are often told “Don’t reinvent the wheel”.

I strongly disagree with that. I really believe that every wheel I reinvented made me a better developer. What I believe is that you should reinvent the wheel, but you shouldn’t use it in the real world.

Let me illustrate this with a skill I got when I was in college : regular expressions.
I had this project that required to parse a human-readable file to a 3D scene. This was a pet project, I wanted to build everything by myself. So I decided to write my first parser (I didn’t know that was a parser at that time). And I got stuck on a problem : how do you parse the string lexeme ? This is not a keyword, this has arbitrary length, and sometimes you use the backslash to add special chars. So I invented my own syntax and an algorithm to parse lexemes. It took me about a week to make it work properly. It was very basic, but fitted my needs.

Then a friend told me “Do you know about regular expressions ?”. Of course I didn’t. So I started my 56k modem and typed “regular expressions” on Google. What I read got deeply written in my brain. That was exactly what I was trying to do. So I obviously started using them and dropped my home brewed syntax.

The fact that I got stuck on this for a week made me understand the challenges that regular expressions were solving, and the power of its syntax and simplicity. Now, I am pretty good at writing them. I often have a colleague coming to me when he is stuck on a tricky one.

But the most important thing this experience made me understand is : to become an expert in something, you have to dig into it, to try to solve it by yourself. The outcome won’t be very valuable or even usable, but you will learn at lot of things along the way.
And when you did that, you should drop it. Because others have already solved this problem, probably better than you did. But now you can see why this is better.

You really should reinvent the wheel as many times as you can. But don’t use it on a real world project.

Show card ID in Trello using GreaseMonkey

Show card ID in Trello using GreaseMonkey

This short snippet is a simple way to show the card numbers in Trello. Useful if you use it as a bug tracker, for example.

This is a GreaseMonkey user script, but it should be compatible with Chrome as well.

// ==UserScript==
// @name        Trello Cart ID
// @namespace   *
// @require
// @match*
// @version     1
// @grant       none
// ==/UserScript==

var update = function() {
	$('.list-card').each(function (e,item) {
		var $this = $(item);
		var $a = $this.find('a.list-card-title');

$(document).ready(function() {
  setInterval(update, 5000);
Stronger passwords with GreaseMonkey

Stronger passwords with GreaseMonkey

Using the same password on every website is dangerous. We all know it. But we couldn’t afford to think up a different one every time : it would be impossible to remember them all. The solution I present here is a good way to reuse your “main password” (we all have one :-)) with a better security level. I also propose a GreaseMonkey Javascript code that automatize the process.

I have read some month ago a very interesting post about it, but sadly I did’t find it back. However, the idea in the article is the following : keep your main password in every site, but add “salt” based on the domain name.

Let me show you an example : let’s say that your password is ‘ilovecats’, and you want to register at

  1. Take the five first letters of the website : “youtu”,
  2. make some permutations on them – for example, make them uppercase : ‘YOUTU’,
  3. prefix it to your main password.
    The password for becomes : ‘YOUTUilovecats’.

This idea is great ! With training, you won’t have to bother about remembering many different password. Also, you get a stronger password, since it is longer than your main password. The only thing you have to be sure is not to forget what permutations you did. Write it down somewhere maybe (this is anyway safer than writing all your passwords somewhere. If someone reads your permutations method, you don’t care : he still doesn’t know your main password ;-))


Going more geeky

I’m using this method since the day I learned it. But as my friends know, I’m a bit lazy : I don’t want to write my permutation every time I have to log in (beside, my permutation is quite complex to mentally process). So, I wrote a small piece of Javascript to use with GreaseMonkey. This script searches for every password field on a website, and adds the five first letters of its url, with a permutation. You can change it by yourself if you want.

The permutation used in the file is the following :

  1. Take the five first letters of the url (after the ‘www.’),
  2. add one to each letter, so that a become b, b becomes c, …, z becomes a,
  3. make the result uppercase,
  4. prefix it to your main password.

Again : don’t forget the permutation that you are using !! Remember that if you want to log in on a computer that is not your own, you will have to do the permutation by yourself !



  1. Firefox users : Download GreaseMonkey if you don’t have it yet :
  2. Download the Javascript file here; GreaseMonkey should ask you to install the file.
  3. Once installed, every time you will click on a password field, the five first letters of your password will show up; just add your main password. Congratulations, you have a stronger password with almost no effort.

Source code

// ==UserScript==
// @name           Stronger Passwords
// @namespace      *
// @description    Get the first five chars of the domain name and prepend it to every password field of the page, with a permutation
// ==/UserScript==

  //Extracting the first five letters
    var host = window.location.hostname;
    var domains = host.split('.');
    if (domains.length <= 2)
      host = domains[0];
      host = domains[1];

    host = host.substring(0,5).toLowerCase();
  //Extraction done

  //Building the 5 first chars
  // You can change the code here to use another permutation.
  // The five letters are stored in the variable host and the
  // code below must build a variable names prefix which
  // contains the permutated string
    var prefix = "";
    var acode = 'a'.charCodeAt();
    var zcode = 'z'.charCodeAt();
    for (var i=0; i!=5;++i)
      var c = host.charCodeAt(i);
      if (c >= acode && c <= zcode)
        c -= acode;
        c  = (c+1)%26;
        c += acode;
      prefix += String.fromCharCode(c);
    prefix = prefix.toUpperCase();
  //Chars built

  //Appends the five letters to every password field when you click them
    var inputs = document.getElementsByTagName('INPUT');

    for (var i=0; i!=inputs.length; ++i)
      if (inputs[i].type=="password")
        var input = inputs[i];

        input.addEventListener('focus', function(event)
        }, false);
 //Append done
}, 1000);