Page 8 of 11

Using ICU transforms in Swift Feb 28 2019

The International Components for UnicodeICU provides powerful libraries for working with Unicode. In this post, I’ll explain the basics of how to use ICU transforms in Swift. There are many areas to explore in ICU and Swift, but we will focus on using the transforms defined in ICU User Guide. There is currently no support for arbitrary ICU transforms, but the basics are handy.

In a future post I will discuss the use of Unicode properties, in Swift 5 we will get Unicode properties added to Unicode.Scalar and that will give us access to more ways to get information on what our Strings represent and create software that handles better the use of different scripts and languages. But for now, let’s focus on ICU transforms.

Read More...

What is AppDelegate for in iOS? Jan 23 2019

Each app in iOS has only one UIApplication object in charge of managing the app when your app changes state in its life cycle(e.g. activate, suspend, send to background, reactivate, etc.) it notifies it’s AppDelegate so it can run any task required by that change in state. In simple terms, the AppDelegate is in charge of ensuring that your app state changes are handled correctly, that the app is ready for each state change and will end up in a valid state when the event takes place.

Read More...

Setup Swift LSP and Vim Jan 22 2019

With the release of SourceKit-LSP we can run an LSP server for the Swift programming language. That means that we can take advantage of autocompletion and jump to the definition in our text editors that support connection to an LSP server. I’ll show how to set this up using Vim 8.

LAST UPDATED: September/25/2019

First install SourceKit-LSP

Clone the source from the SourceKit-LSP repository

Read More...

iPad multitasking and StackView Jan 3 2019

To make the user experience better on iPad for multitasking remember that you can change the axis of your StackViews depending on the size class of your view or view controller.

Size Class

Size classes represent the relative space of the view or view controller on the device. There are two size classes, compact and regular, this means Compact has limited space and Regular has the regular/normal space. So this is how it looks for iPhone and iPad

Read More...

Basics of stderr and stdout on Ruby scripts Oct 23 2018

In our scripts, we present information to our users via the two standard output streams: standard output and standard error. In this post, I’ll explain why it is useful to distinguish between standard output and standard error, and share tips on how to interact with the streams when our script’s output is being redirected or used on a non-interactive shell.

The first part is the basics if you already know the basics you can skip to the last section to see an interesting example on how to take advantage of the streams.

Read More...

Exit codes for Ruby scripts Oct 15 2018

One of the most common mistakes I see in ruby scripts is the lack of good exit status, this prevents the script from being trusted in composition with other commands. The purpose of this post is to explain why exit codes are important and how to use them on our scripts.


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...

Shell friendy Ruby scripts Sep 24 2018

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 one-liner scripts Sep 17 2018

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...

Using Thor and Ruby to build a CLI Sep 10 2018

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...

Thoughts on discipline and habits Sep 3 2018

All of us want to be more productive. If we are serious about it, we end up trying a lot of different techniques and approaches: ToDo lists, Kanban Boards, Pomodoro, Calendars, eat that frog, etc. I’ve tried them all, and more. They are all good actually. All of them provide the results they promise. But why are we not more productive? And how can we fix that?

Discipline

I believe that the top cause for us not achieving our productivity goals, or any goals for that matter, is due to our lack of discipline. Discipline is what makes us do what we decided to do even when there is an easier alternative. For example, if we want to be good software engineers, we set high standards for our code, and we tell ourselves we are going to follow Sandi Metz rules for developers.

Read More...

$