VS Code alias auto-completion

All credits go to jgoux ; this post is a post-it to his explanation on Github: https://github.com/tleunen/babel-plugin-module-resolver/issues/92#issuecomment-285755384

1. Teach VS Code’s Intellisense where to look at

So you can jump to the definition and have autocompletion. sparkles

To do that, create a jsconfig.json file at the root of your project :

  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "~/*": [
  "exclude": [

2. Teach VS Code to autocomplete your paths

Install the extension Path Intellisense

This extension allows the autocompletion of the custom paths.

Configure the extension in your project’s settings under .vscode/settings.json :

  "path-intellisense.mappings": {
    "~": "${workspaceRoot}/src"

3. Teach Babel how to resolve your custom paths

The last step is to install and configure babel-plugin-module-resolver so the code compile!

Here is my .babelrc :

  "plugins": [
        "alias": {
          "~": "./src"

AWS CloudFront S3, Basic HTTP authentication – password protection

This is a post it to this article explaining how to use a Lambda function to protect a CloudFront-S3 distribution using Basic HTTP Authentication.

Some additional notes:

  • The Lambda Function must be in the region us-east-1 (US East N. Virginia)
  • You must create a new version of the Lambda function
  • The ARN of the Lambda function you provide to CloudFront must inlude the lambda version
  • The Lambda function’s role must have the following Trust Policy

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "lambda.amazonaws.com", "edgelambda.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }

Docker – boot2docker -Share folder

To share another folder than the default one (C:\Users)

First, add the folder to share in VirtualBox


Than, connect to the docker VM by running

docker-machine ssh

There you need to run

sudo mkdir --parents //d/tangu
sudo mount -t vboxsf tangu //d/tangu

The first command create the folder where the shared drive will be mounted and the second command actually mount the shared drive.

Of course you’ll need to adapt the paths I used here to match yours.
Note that the mount command takes as arguments

  • -t specifies the filesystem. Here its the one from virtualbox
  • tangu is the named of the shared folder defined in virtual box
  • //d/tangu is the destination of the mount shared drive that was created by the first command

You don’t want to type those commands everytime

Add those lines between the step STEP=”Checking status on $VM” and the step STEP=”Setting env” :

STEP="Mounting web directory"
"${DOCKER_MACHINE}" ssh default 'sudo mkdir --parents //d/tangu'
"${DOCKER_MACHINE}" ssh default 'sudo mount -t vboxsf tangu //d/tangu'

To the file start.sh located where you installed Docker Toolbox

Now everytime you will start boot2docker, it will auto mount this shared folder.

Credits : https://github.com/docker/machine/issues/1814#issuecomment-239957893


Docker – boot2docker – Create a new docker virtual machine to a specific location

Yesterday I told about moving the exisitng default boot2docker machine to my secondary hard drive.

Today, I wanted to create a new docker virtual machine directly to a specific location.

docker-machine -s "D:\softwares\Docker Toolbox\docker-vm" create --driver virtualbox machineName

Set as default location

Finally, I want to always use this new location so as mentionned here I created the variable environnement MACHINE_STORAGE_PATH with the path = D:\softwares\Docker Toolbox\docker-vm

Liferay -Include portlet without border in FTL template

Using Liferay 6.2, I needed to dynamically include a portlet in a FTL template using

${theme.runtime(portletId, "", "")}
But I wanted it to have no border.

The doc points to this link but this is valid only for Velocity templates.

Here is the code I used

<#assign portletId= "my_portlet_id" />
<#assign PortletPreferencesFactoryUtil = staticUtil["com.liferay.portlet.PortletPreferencesFactoryUtil"] />
<#assign portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, portletId) />
<#assign temp = portletSetup.setValue("portletSetupShowBorders", "false") />
<#assign temp = portletSetup.store() />
${theme.runtime(portletId, "", "")}

That comes from that Gist.