Apps and packages that will make you more efficient while programming on macOS
Week 2 of the Makers Academy pre-course has already started. After learning and becoming confident with the Terminal and Version Control, now it is time to kick off with Ruby.
The material provided by Makers Academy is of high quality, and it comes with plenty of exercises, which makes it easier for us rookies to take on board new concepts.
To get the most out of the whole learning period, I believe it is important to exploit our time management skills and the various resources that we have at hand.
To fulfill this purpose, I will list several apps and packages that I find extremely useful while coding.
One of the things that frustrated me the most when using Windows was, indeed, resizing windows. Getting to set up a productive environment turned out to be really unproductive every time.
After I changed to macOS, I decided this would be one of the first things I had to solve. Then, I heard about Spectacle, which allows you to move and resize windows quickly and easily.
Even though you can customise shortcuts from the app preferences, it comes already with default ones to get started straight-away and be more productive. In my opinion, some of the most useful shortcuts are:
- ⌥ ⌘ ← : snaps current window, arranging it to the left half
- ⌥ ⌘↑ : snaps current window, arranging it to the top half
- ⌥ ⌘↓ : snaps current window, arranging it to the bottom half
- ⌥ ⌘→ : snaps current window, arranging it to the right half
Another shortcut is ⌥ ⌘ F, which allows you to resize the current window to fullscreen. I find this especially useful when plugging a second screen, as, due to the resolution, some windows that are not on fullscreen mode require resizing.
You can download it from this link: https://www.spectacleapp.com/
Have you ever needed to study (and stay awake) at night because you had to sit an exam on the following day? I am pretty sure the only company you had was in the shape of caffeine.
That is precisely what Caffeine does for your system, it prevents your Mac from going to sleep.
You can download it from this link: http://lightheadsw.com/caffeine/
Sublime Text 3
My personal preference. Certainly you have other options such as Atom, but, in my opinion, Sublime has nothing to envy from other text editors.
Similar to other text editors, on the left part, as a sidebar, you have the directories and files. On the right side, you have a tab bar on the top to manage your files; the rest of the window is where you will code for your active file from the tab bar (greetings.rb on the image above).
Follow this link to download the program: https://www.sublimetext.com/
Now let’s take a look at several Sublime packages that I would like to highlight.
Sublime Text 3 packages with Package Control
The following list of packages is a selection that I find extremely useful when coding in Sublime.
In order to add packages to Sublime, install Package Control, the Sublime Text package manager, by following this guide: https://packagecontrol.io/installation
Once it is installed (make sure you restart Sublime), follow these simple instructions from Sublime to install pretty much every package you need:
Command Paletteusing menu item
Tools → Command Palette...
Package Control: Install Package
1) A File Icon
This package makes your sidebar look prettier. Without this (or a similar) package, there will be cases where you will struggle to find, at a glance, the type of file you are looking for.
Imagine that you have a folder with ten different files, each with a different extension, you would have to read the names and extensions in order to know which one you want to open.
How many times have you shared a raw piece of code with someone by text message? Chances are this person has complained about code legibility.
A solution is to open Pastebin (link: https://pastebin.com/), paste our piece of code, select the programming language and then share it.
This is not a bad solution at all, but it is not optimal. I would even dare say that it is time-consuming, especially as we, as learners, usually share a lot of code for training purposes.
What if we could send our code from Sublime to Pastebin straight-away?
This is perfectly possible thanks to the SendToPasteBin package.
Once you add it to Sublime from Install Package, check the configuration section here to get started: https://packagecontrol.io/packages/SendToPasteBin
What is happening here? First, we have a yellow dot on line 4, then, a red one on line 8. Each colored dot indicates an error.
If you take a look at the bottom part of the image, it reads: “1 of 2 errors…”, followed by the error description for the line you are on at the moment.
In line 4 we have a warning telling us: “Hey, you have created a statement, but you are not using the variable
unused_variable anywhere else in the script.”
In other words, we do not really need this in our script as we are taking up memory space and it is not doing anything for us right now.
Usually, a warning means the script will execute normally, it is just suggesting us to improve it.
In line 8, we have a syntax error, this is of a different nature. It will prevent the script from running until we fix it. In this case I forgot to add the letter ‘f’ to create the full, correct if statement. SublimeLinter, then, is telling me: “Hey, you made a mistake. Fix it before running your script.”
Note: after installing SublimeLinter, make sure you install (also from the Install Package) the Ruby plugin for the package: SublimeLinter-contrib-ruby-lint
This package is intended to opening a terminal at the current file (
cmd + shift + T), or the current root project folder (
cmd + alt + shift + T).
I find this especially useful when we have to move around directories often to run different scripts.
It goes without saying, you have a wider range of options. In case you would like to explore further and keep an eye on new releases, check the Package Control homepage: https://packagecontrol.io/
Do you like Pokémon? If so, we will be creating a game from scratch in Ruby and we will get to play it as well. It will be my first video of a series with an educational an entertaining approach.
Make sure you follow me in order not to miss it! Also, if you enjoyed the content of this article, some claps are highly appreciated.