Previous ~ Next page
2 of 13 pages

hugo

Image optimization in Hugo

I will go through the easy process of optimizing images in Hugo to create <img> elements that represent good practice. It will cover recommended attributes, image compression, the automatic generation of alternative formats, and cache busting using fingerprint.

Continue reading



go

Create a Boolean Yes or No prompt in Go

Article preview image Article preview image

In this post, I will create a simple function that will allow you to ask the user a question, receive a valid response, and return it as a Boolean type. And if needed, the user will be able to tap Ctrl+C at any time to exit the program. Also importantly, despite using the operating system input, we will create unit tests for os.stdin.

Continue reading


go

Center text in a terminal with Go

Article preview image Article preview image

This guide will show how simple it is to center text in a terminal or a text file using the Go standard and external libraries. We will create two functions, NCenter, which provides for a width parameter, and a Center func that will determine the center placement based on the width of the terminal screen.

You can find the final code on GitHub or play with NCenter() in the Go Playground.

Continue reading

Previous ~ Next page
2 of 13 pages