Bash Beyond Basics
Increase your efficiency and understanding of the shell
If you are interested in this topic you might enjoy my course Bash Byond Basics.
This course helps you level up your bash skills. This is not a course on shell-scripting, is a course on improving your efficiency by showing you the features of bash that are seldom discussed and often ignored.
Read More...
When we build Ruby scripts, generally, we build them to be run independently but being able to compose them with other scripts makes them even better. How can we make our Ruby scripts be easy to compose? This is what this post is about, I will show you how to build your scripts so they can be composed or used independently.
Let’s see a basic Ruby script that receives a list of files and displays all lines capitalized.
Read More...
Ruby excels in its simplicity. It allows programmers to go from idea to implementation in a short time without much overhead. While many programmers have only heard of Ruby in relation to the web framework Rails, the scripting side of Ruby is very interesting and a rewarding use of the language. In this post, I will show you how to use Ruby to build one-liner scripts, and I will explain some useful flags when using Ruby scripts to process text.
Read More...
Thor is a toolkit that can help us build command line interfaces(CLIs). You can find many tutorials on how to build a basic CLI using Thor. I want to explain the default behaviour of Thor and also when to use env to define the binary that will run your script.
We normally build custom scripts to automate tasks on our servers or local environments. Often these scripts require many flags or a big list of parameters. If the number of flags and parameters (from now on, options) are small then we won’t have a problem building the logic to handle them. However, when there are a number of options or we want to handle aliases, e.g. accepting the flag –delete or -d as the same operation, then things can become harder and more tedious to maintain.
Read More...
There are simple concepts that can significantly improve our projects, one of these concepts is Feature Toggles. In this post, I will explain the basic idea behind Feature Toggles and a basic implementation example.
Feature toggles (aka, flags, flippers, bits), in simple terms, are a way to control the flow of our code and make decisions to run specific versions/implementations of it. What this means is better understood by an example, so let’s get to it.
Read More...
I have always been fascinated by other professions that have physical workshops, imagine a room full of neat rows of tools, with everything at hand, just having everything on its own places makes you want to create and build new things with your tools. The same applies to software, we should have all of our tools clean and sorted, we should know where everything is and where to expect to find a piece of configuration we need to modify.
Read More...
Update 2018-08-27
I ran into a problem with Rails, it couldn’t find a database.yml, this was not because of a Rails missconfiguration but because of the binstub for rails had:
1
| APP_PATH = File.expand_path('../../test/dummy/config/application', __FILE__)
|
And well we change it to use rspec, so it should be:
1
| APP_PATH = File.expand_path('../../spec/dummy/config/application', __FILE__)
|
Adding RSpec to an existing Rails engine
If we already have a Rails engine and we wish to add RSpec to it, how would we go about it? The solution is not as straightforward as we might think, there are a few details always missing from tutorials or the guides, so I’ll try to share what I found and hopefully help someone that has the same issue.
Read More...
Let me start by stating that all code is legacy code, the difference is in how we perceive it, and like with everything else, is only a matter of perception. There is more focus on the “new” but working on something new is not the only path to innovation. I’ve heard people wanting to work on the edge of the field bringing new development and improvements to the industry. Well, here is the trick, innovation is not tied only to new projects, innovation and improvements can occur on already existing projects, the only limitation to innovation is how we approach each problem.
Read More...
One of the most useful Unix commands, and mostly underutilized, is find. To get the most out of it there are two key features that we need to explore and understand.
- How to iterate over the results
- Limitation on the number of results we can operate on
Learn by doing
Lets create a few files and directories to use as examples:
Read More...