til.

Today I learned!

#5: How to make smerge available in your command line

smerge is a command line tools for Sublime Merge. To make this tools available in your command line, you have to symlink it. Here’s the command on how to do it for macOS:

1
 ln -s "/Applications/Sublime Merge.app/Contents/SharedSupport/bin/smerge" /usr/local/bin/smerge

That’s it. After this, you can easily browse your repo in Sublime Merge just by typing smerge in your CLI.

For Windows or Linux, you can check Sublime Merge’s docs.

#tools

#4: How to install latest node version with nvm

Today I learned how to install or update my Node.js version to the latest stable version with nvm.

To update to the latest stable version, simply run:

1
$~ nvm install stable

This will also set the installed node as the default. That’s it

#tools #node

#3: What is the difference between Docker container and Docker image?

Today I learned the difference between image and container in Docker. An image is a template that can be used to create a container while container is the instances of said Docker images. The container is the one that runs your application.

To explain it in cake term, image is the recipe of the cake and container is the cake itself. You can create multiple cakes based on the same recipe.

To see all the images available, you can run the following:

1
$~ docker images

and to see the container that’s currently running, you can run:

1
$~ docker ps

or if you want to see the list of available containers, run:

1
$~ docker ps -a

That’s it. 🎂

References: 1. https://stackoverflow.com/questions/23735149/what-is-the-difference-between-a-docker-image-and-a-container

#docker

#2: How to install latest stable ruby version with rbenv

Today I learned a simple solution to install the latest stable ruby version with rbenv. If you are using rbenv to maintain your ruby versions but you couldn’t be bothered to keep track of the releases and just want a stable version, you can use the following command:

1
$ rbenv install $(rbenv install -l | grep -v - | tail -1)

This command will get the latest stable ruby release and install it with rbenv install. That’s it.

References: https://stackoverflow.com/questions/30179484/install-latest-stable-version-of-ruby-using-rbenv

#ruby

#1: How to clone git repository with submodules

Today I learned how to git clone a repository that has git submodules inside of it. I realized that when I cloned a project it will clone the parent repo but the submodules will be empty. Here are the steps on how to clone it properly.

If you haven’t cloned the repository yet, you can use --recurse-submodules option:

1
$ git clone --recurse-submodules https://github.com/sample/sample-repo.git

Otherwise, If you already cloned the project then you can use the following command. Run the command inside your git repository.

1
$ git submodule update --init --recursive

This will initialize, fetch and checkout any nested submodules for the repository. That’s it.

#git