<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Christian Giacomi</title><link>https://cgiacomi.com/</link><description>Recent content on Christian Giacomi</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 16 Nov 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://cgiacomi.com/index.xml" rel="self" type="application/rss+xml"/><item><title>To AI or not to AI</title><link>https://cgiacomi.com/posts/2025-11-16-to-ai-or-not-to-ai/</link><pubDate>Sun, 16 Nov 2025 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2025-11-16-to-ai-or-not-to-ai/</guid><description>&lt;blockquote>
&lt;p>This is not an AI-bashing post, and it’s not a fanboy love letter either.
It’s just me trying to put into words what it actually feels like to work with LLMs as a developer after 25+ years in this job.&lt;/p>&lt;/blockquote>
&lt;p>For a little over a year I’ve been using LLMs both on my personal projects and at work. Not every single day at the beginning, but now it’s pretty close to daily. I started small, and over time it’s become a natural part of how I work.&lt;/p></description></item><item><title>About</title><link>https://cgiacomi.com/about/</link><pubDate>Mon, 25 Aug 2025 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/about/</guid><description>&lt;p>Hi, I’m Christian Giacomi — but everyone calls me Chris.&lt;/p>
&lt;p>I’m a Senior Backend Engineer and Tech Lead with more than 25 years of experience building distributed systems, leading technical direction, and shipping production software across fintech and SaaS products. I work across the full stack, but my strongest focus is backend architecture and system design.&lt;/p>
&lt;p>I’m passionate about creating software that’s simple, reliable, and built to last. Over the years I’ve worked with Java, C#, Ruby, Python, Typescript, Go and presently Kotlin and I’ve designed services that power critical business workflows at scale. I care deeply about clarity, communication, engineering culture, and the kind of decision-making that turns a codebase into a product rather than a pile of technical debt.&lt;/p></description></item><item><title>Unit of Work design pattern in Go</title><link>https://cgiacomi.com/posts/2022-09-29-unit-of-work-in-go/</link><pubDate>Thu, 29 Sep 2022 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2022-09-29-unit-of-work-in-go/</guid><description>&lt;p>When working with a database, relational or not, and a large number of domain objects, one often risks of having to keep track of all the changes that need to be performed to ensure proper consistency. This can lead to a multitude of small read and write operations for the lifetime of a business transaction. This is not optimal.&lt;/p>
&lt;p>Opening and closing database connections is costly and even when using a single connection and a database &amp;lsquo;Transaction&amp;rsquo; can still lead to inconsistencies. Further more as a developer one might perform database operations from different code paths leading to even more tightly coupled code.&lt;/p></description></item><item><title>How to check if a key exists in a map in Go</title><link>https://cgiacomi.com/posts/2022-07-12-key-exists-in-go-map/</link><pubDate>Tue, 12 Jul 2022 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2022-07-12-key-exists-in-go-map/</guid><description>&lt;p>This post is going to be a simple and short one. When using a &lt;code>map&lt;/code> in Go, it is not uncommon for a developer like myself to access the map via an index without checking if the key is actually present in the map. This can lead to some funky outcomes. In other languages accessing an index that is not present in the equivalent data structure usually results in a runtime error of some kind.&lt;/p></description></item><item><title>How to perform type checking in Python</title><link>https://cgiacomi.com/posts/2022-02-20-type-checking-in-python/</link><pubDate>Sun, 20 Feb 2022 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2022-02-20-type-checking-in-python/</guid><description>&lt;p>In Python there are two ways to check the type of a variable or object.&lt;/p>
&lt;h2 id="isinstance" id=isinstance>
 
 &lt;span class="me-2">isinstance()&lt;/span>
 &lt;a href="#isinstance" class="anchor text-muted">&lt;i class="fas fa-hashtag">&lt;/i>&lt;/a>
 
&lt;/h2>&lt;p>This is an in built function which takes two parameters and is the preferred way to check the type of a variable or object. This function also takes into account subclasses.&lt;/p>
&lt;div class="code-block">
 &lt;div class="code-header"> &lt;span data-label-text="Python">&lt;i class="fas fa-code fa-fw small">&lt;/i>&lt;/span> &lt;button aria-label="copy" data-title-succeed="Copied!">&lt;i class="far fa-clipboard">&lt;/i>&lt;/button>&lt;/div>
 
 &lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">isinstance&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nb">object&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">classinfo&lt;/span>&lt;span class="p">)&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;p>The &lt;a href="https://docs.python.org/3.9/library/functions.html#isinstance">documentation&lt;/a> explicitly states the following:&lt;/p>
&lt;blockquote>
&lt;p>&amp;ldquo;Return True if the object argument is an instance of the classinfo argument, or of a (direct, indirect or virtual) subclass thereof.&amp;rdquo;&lt;/p></description></item><item><title>Multistage Docker image for Go</title><link>https://cgiacomi.com/posts/2021-03-10-multi-stage-docker-image-go/</link><pubDate>Wed, 10 Mar 2021 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2021-03-10-multi-stage-docker-image-go/</guid><description>&lt;p>I love working with Go, especially when I am building Microservices, and I usually use Docker to help me both during development and in stage/production environments.&lt;/p>
&lt;p>So I thought I would share my little Docker recipe for what I like to use. I know there are a ton of other docker tutorials out there, but when it comes to Go, there is two small things to remember before you go to production or you might stumble like I did.&lt;/p></description></item><item><title>Git rename branch</title><link>https://cgiacomi.com/posts/2020-12-20-git-rename-branch/</link><pubDate>Sun, 20 Dec 2020 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2020-12-20-git-rename-branch/</guid><description>&lt;p>This will be a very short post, and like the other git posts is meant primarily for me to remember a git command which I seldom use, but when I do, I never remember the exact syntax.&lt;/p>
&lt;p>As they say:&lt;/p>
&lt;blockquote>
&lt;p>If you want to remember somethinng, write it down&lt;/p>&lt;/blockquote>
&lt;h2 id="rename-a-local-branch" id=rename-a-local-branch>
 
 &lt;span class="me-2">Rename a local branch&lt;/span>
 &lt;a href="#rename-a-local-branch" class="anchor text-muted">&lt;i class="fas fa-hashtag">&lt;/i>&lt;/a>
 
&lt;/h2>&lt;p>To do this you will need to use the &lt;code>branch&lt;/code> command with the &lt;code>-m&lt;/code> option and will have to specify the new name.&lt;/p></description></item><item><title>How to set up the NSTrackingSeparatorToolbarItem in macOS 11</title><link>https://cgiacomi.com/posts/2020-11-29-setup-nstrackingseparatortoolbaritem-macos11/</link><pubDate>Sun, 29 Nov 2020 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2020-11-29-setup-nstrackingseparatortoolbaritem-macos11/</guid><description>&lt;p>I have a small utility app that I am building using AppKit and as such I have decided to adopt the new look and feel of macOS 11 (Big Sur) and the new &lt;a href="https://developer.apple.com/design/human-interface-guidelines/macos/overview/whats-new-in-macos/">HIG&lt;/a>.&lt;/p>
&lt;p>So I decided to modify the tool bar of the app and adopt the new &lt;code>NSTrackingSeparatorToolbarItem&lt;/code> which will give the app a very distinctive look. The following WWDC &lt;a href="https://developer.apple.com/wwdc20/10104">talk&lt;/a> gives an overview of the new look and feel and what new controls are available in macOS 11. In the talk they go over the API for the new toolbar item, but not how to actually implement it in code, especially not if you are using Interface Builder.&lt;/p></description></item><item><title>macOS context menu from an NSButton</title><link>https://cgiacomi.com/posts/2020-10-03-macos-contextmenu-from-nsbutton/</link><pubDate>Sat, 03 Oct 2020 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2020-10-03-macos-contextmenu-from-nsbutton/</guid><description>&lt;p>Currently I am developing a small utility app for the Mac as a side project, and one of the requirements is the ability to open a URL in a browser. The idea was to have a button that when pressed displays a context menu with several options which the user can select from. Kind of like a drop down menu but visually different.&lt;/p>
&lt;p>I am not an expert in macOS development and I am very inexperienced when it comes to AppKit, thus what seemed like a simple task actually took me some time. So for the sake of helping out another poor soul who might be struggling like I was, I am going to show you how I managed to solve my problem. In the end the solution is extremely simple.&lt;/p></description></item><item><title>Black Lives Matter</title><link>https://cgiacomi.com/posts/2020-06-09-black-lives-matter/</link><pubDate>Tue, 09 Jun 2020 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2020-06-09-black-lives-matter/</guid><description>&lt;p>Up to now I have always written about software and about things which I have discovered in my journey as a technologist. I have always kept my personal views out of my professional life as much as possible. Today is different, I can no longer watch what is going on around me and stay silent.&lt;/p>
&lt;p>The last couple of weeks have been very difficult, as I watched what has happened in the States and around the world.&lt;/p></description></item><item><title>Simple PUT/PATCH requests using Go</title><link>https://cgiacomi.com/posts/2020-05-15-simple-put-patch-request-go/</link><pubDate>Fri, 15 May 2020 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2020-05-15-simple-put-patch-request-go/</guid><description>&lt;p>Making HTTP requests in Go is very simple, the &lt;code>http&lt;/code> package contains all the tools you will need to carry out your task. The package contains three helper functions to perform basic requests, and in the case of more complex or custom requests one needs only a couple of extra lines of code.&lt;/p>
&lt;h2 id="http-package" id=http-package>
 
 &lt;span class="me-2">Http Package&lt;/span>
 &lt;a href="#http-package" class="anchor text-muted">&lt;i class="fas fa-hashtag">&lt;/i>&lt;/a>
 
&lt;/h2>&lt;p>The http package in Go contains several convenience functions to make &lt;code>Get&lt;/code>, &lt;code>Post&lt;/code> and &lt;code>Head&lt;/code> requests over http. But in the case of &lt;code>PUT&lt;/code> and &lt;code>PATCH&lt;/code> we will need to add a little more code. Lets start looking at the helper functions and then move to the more complex requests.&lt;/p></description></item><item><title>Git undo last commit</title><link>https://cgiacomi.com/posts/2020-04-12-git-undo-commit/</link><pubDate>Sun, 12 Apr 2020 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2020-04-12-git-undo-commit/</guid><description>&lt;p>This will be a very short post, because it&amp;rsquo;s meant primarily as a way for me to remember a git command which I seldom use, but when I do, I never remember the exact syntax.&lt;/p>
&lt;p>As they say:&lt;/p>
&lt;blockquote>
&lt;p>If you want to remember somethinng, write it down&lt;/p>&lt;/blockquote>
&lt;h2 id="undo-a-commit" id=undo-a-commit>
 
 &lt;span class="me-2">Undo a commit&lt;/span>
 &lt;a href="#undo-a-commit" class="anchor text-muted">&lt;i class="fas fa-hashtag">&lt;/i>&lt;/a>
 
&lt;/h2>&lt;p>In this case you will have to use the &lt;code>reset&lt;/code> command and will have to specify the revision you want to rewind to.&lt;/p></description></item><item><title>MongoDB index using Go</title><link>https://cgiacomi.com/posts/2020-03-15-mongodb-index-using-go/</link><pubDate>Sun, 15 Mar 2020 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2020-03-15-mongodb-index-using-go/</guid><description>&lt;p>This month&amp;rsquo;s post will not be as long as the one from last month, and will focus on a small area regarding MongoDB.&lt;/p>
&lt;p>When I started using Go, and the official mongo-go-driver, one of the issues that I ran into was the creation of indexes, and coming from a NodeJS experience using Mongoose it was extremely simple. So I decided to write this small post to help out anyone that might find themselves in the same situation I was in.&lt;/p></description></item><item><title>Terraform and AWS SNS and SQS and Lambda</title><link>https://cgiacomi.com/posts/2020-02-23-terraform-sns-sqs-lambda/</link><pubDate>Sun, 23 Feb 2020 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2020-02-23-terraform-sns-sqs-lambda/</guid><description>&lt;p>Recently I worked with the AWS CDK to provision a certain amount of infrastructure for a project. I honestly had never worked with the CDK, so I decided to start like the newbie I was and dig into a tutorial recommended by a colleague.&lt;/p>
&lt;p>The tutorial was great, easy to go through and very interesting. At the end you were left with a simple yet powerful infrastructure in AWS that consisted of an SNS Topic, an SQS queue with a subscription, and a Lambda function that consumed the SQS queue.&lt;/p></description></item><item><title>Alternative Command Design Pattern in Go</title><link>https://cgiacomi.com/posts/2020-01-25-alternative-command-pattern-go/</link><pubDate>Sat, 25 Jan 2020 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2020-01-25-alternative-command-pattern-go/</guid><description>&lt;p>In my previous post regarding the &lt;a href="https://cgiacomi.com/posts/2019-05-12-command-pattern-go/">command design pattern in Go&lt;/a> I explored the way one would structure the code to implement this classic design pattern.&lt;/p>
&lt;p>One thing that one would immediately notice about the implementation in Go is the lack of type inheritance and the fact that interfaces are not explicitly implemented either, this is of course due to how Go is designed. The code implementation of my previous post is based on the original implementation in C++ as can be seen in the book by the gang of four. So even though I believe the implementation in Go is correct it feels like it&amp;rsquo;s just not a perfect fit.&lt;/p></description></item><item><title>How to Extend Express when using Typescript</title><link>https://cgiacomi.com/posts/2019-12-22-extend-express-typescript-custom-types/</link><pubDate>Sun, 22 Dec 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-12-22-extend-express-typescript-custom-types/</guid><description>&lt;p>If you have ever used &lt;em>Express&lt;/em> with Typescript you have surely defined new types for your application. You might have defined several types for your models, or for your function arguments or return types. You definitely would have had to create just a few, especially if you are using &lt;a href="https://palantir.github.io/tslint/">tslint&lt;/a> to check and lint your code.&lt;/p>
&lt;p>I mention tslint just because it will mark all your variables, the ones without an explicit type, as being implicitly typed to &lt;code>any&lt;/code> and of course you will get a nice red underline in your IDE or editor. This will undoubtedly push you to create more custom types.&lt;/p></description></item><item><title>REST Design principles</title><link>https://cgiacomi.com/posts/2019-11-02-rest-design-principles/</link><pubDate>Sat, 02 Nov 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-11-02-rest-design-principles/</guid><description>&lt;p>Most of the developers I talk to eventually end up talking about REST, and they all want to build the best REST API possible. This of course leads to the usual discussions about what is a good REST API, or what should you do to ensure that your API is REST&lt;em>ful&lt;/em>. Sometimes tensions run high and so I decided I wanted to write a post to address this.&lt;/p>
&lt;p>This post is meant as a way to gather what I have come to see as the primary design principles behind REST. I will of course update the document to reflect any lacking on my part or any new ideas that could help anyone out there who is in doubt.&lt;/p></description></item><item><title>Check if two Time objects are the same point in time in Go</title><link>https://cgiacomi.com/posts/2019-10-14-check-if-time-is-the-same-in-go/</link><pubDate>Mon, 14 Oct 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-10-14-check-if-time-is-the-same-in-go/</guid><description>&lt;p>How do you check if two Time objects in Go refer to the same point in time?&lt;/p>
&lt;p>Well in Go unlike Javascript it is extremely simple. The Go standard library has this functionality built in, as long as you are comparing both date and time.&lt;/p>
&lt;p>In the Time Package, there is a Function for the Time struct that can do the job for us. As an extra bonus, this function will also take into account timezones. This will allow us to check for equality across timezones.&lt;/p></description></item><item><title>Mongo Go Driver findOneAndUpdate</title><link>https://cgiacomi.com/posts/2019-09-25-mongo-go-driver-update/</link><pubDate>Wed, 25 Sep 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-09-25-mongo-go-driver-update/</guid><description>&lt;p>When I started to develop in Go I found that one of the things that sometimes is missing is the multitude of examples on the net like you would find with NodeJS. I am not saying that Go is not popular, all I am saying is that sometimes I wish there were more examples out there. This is especially true for the mongo-go-driver. That is why I decided to write this post.&lt;/p></description></item><item><title>Generate random hex token using Go</title><link>https://cgiacomi.com/posts/2019-08-15-random-hex-go/</link><pubDate>Thu, 15 Aug 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-08-15-random-hex-go/</guid><description>&lt;p>In my previous post we saw how to create &lt;a href="https://cgiacomi.com/posts/2018-06-18-random-hex-strings/">random hex strings&lt;/a> in various languages, and since I have started working with Go I found I needed a random hex token again. So like we saw in nodejs when you need to create unique token of some type, which you might use in a user email verification or password reset scenario, you can easily generate a random hex string like this&lt;/p></description></item><item><title>Removing duplicate values from Slice in Go</title><link>https://cgiacomi.com/posts/2019-07-18-remove-duplicates-from-slice-go/</link><pubDate>Thu, 18 Jul 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-07-18-remove-duplicates-from-slice-go/</guid><description>&lt;p>Lately while using Go I had an interesting situation, I had a Slice which contained duplicate integer values and I needed to find a way to get rid of the duplicates.&lt;/p>
&lt;p>Having worked with other languages I found that the solution could in some cases, be a one liner. This is the case for C#, where one can leverage &lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/">Linq&lt;/a>.&lt;/p>
&lt;p>Using Linq one can simply tell the compiler what you want. Of course Linq hides the implementation, but that after all is the underlying philosophy of Linq. Tell the compiler &amp;lsquo;what&amp;rsquo; you want and not &amp;lsquo;how&amp;rsquo; you want it, let the compiler take care of the &amp;lsquo;how&amp;rsquo; for you.&lt;/p></description></item><item><title>Fontawesome 5 in iOS as a UIImage</title><link>https://cgiacomi.com/posts/2019-06-15-fontawesome-swift/</link><pubDate>Sat, 15 Jun 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-06-15-fontawesome-swift/</guid><description>&lt;p>I love Fontawesome, I have been using them for many years in various web projects.
I have always found the icons to be elegant and easy to embed in my web projects.&lt;/p>
&lt;p>So when I first needed icons for an iOS app I was working on I found myself at a loss,
what should I use? Of course there are tons of different icon libraries out there but somehow none are what
I was looking for.&lt;/p></description></item><item><title>Command design pattern in Go</title><link>https://cgiacomi.com/posts/2019-05-12-command-pattern-go/</link><pubDate>Sun, 12 May 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-05-12-command-pattern-go/</guid><description>&lt;p>Design patterns are a must know for any software developer. They are important not just because they give developers a set of tools to overcome common problems encountered while developing software, but the also give developers a common language with which to communicate with.&lt;/p>
&lt;p>Classic &amp;lsquo;Design patterns&amp;rsquo; are grouped in three different categories: &lt;em>Creational&lt;/em>, &lt;em>Structural&lt;/em> and &lt;em>Behavioral&lt;/em>, as outlined in the book &lt;em>&amp;lsquo;Design Patterns: Elements of Reusable Object-Oriented Software&amp;rsquo;&lt;/em> by the Gang of Four.&lt;/p></description></item><item><title>Custom events in Hapi</title><link>https://cgiacomi.com/posts/2019-04-07-events-in-hapijs/</link><pubDate>Sun, 07 Apr 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-04-07-events-in-hapijs/</guid><description>&lt;p>For those of you that are not familiar with &lt;a href="https://hapi.dev">Hapi&lt;/a>, let me just say that it&amp;rsquo;s a wonderful nodejs framework. There are no other words that I can use to describe it. It&amp;rsquo;s not only a high performance framework but it is also a framework that makes it fun to work with.&lt;/p>
&lt;p>Personally I love that the framework has built in support for plugins, as they allow the code to be completely modular without the middleware nightmare that other frameworks suffer from.&lt;/p></description></item><item><title>Go mod cheat sheet</title><link>https://cgiacomi.com/posts/2019-03-15-go-mod-cheat-sheet/</link><pubDate>Fri, 15 Mar 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-03-15-go-mod-cheat-sheet/</guid><description>&lt;p>This is a simple cheat sheet for go modules, listing the main commands.&lt;/p>
&lt;h2 id="initialization" id=initialization>
 
 &lt;span class="me-2">Initialization&lt;/span>
 &lt;a href="#initialization" class="anchor text-muted">&lt;i class="fas fa-hashtag">&lt;/i>&lt;/a>
 
&lt;/h2>&lt;p>Create a new module, with automatic module path resolution.&lt;/p>
&lt;div class="code-block">
 &lt;div class="code-header"> &lt;span data-label-text="Shell">&lt;i class="fas fa-code fa-fw small">&lt;/i>&lt;/span> &lt;button aria-label="copy" data-title-succeed="Copied!">&lt;i class="far fa-clipboard">&lt;/i>&lt;/button>&lt;/div>
 
 &lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">$ go mod init
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">go: creating new go.mod&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;p>Create a new module, with explicit module path.&lt;/p>
&lt;div class="code-block">
 &lt;div class="code-header"> &lt;span data-label-text="Shell">&lt;i class="fas fa-code fa-fw small">&lt;/i>&lt;/span> &lt;button aria-label="copy" data-title-succeed="Copied!">&lt;i class="far fa-clipboard">&lt;/i>&lt;/button>&lt;/div>
 
 &lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">$ go mod init github.com/my/repo
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">go: creating new go.mod: module github.com/my/repo&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="clean-up" id=clean-up>
 
 &lt;span class="me-2">Clean up&lt;/span>
 &lt;a href="#clean-up" class="anchor text-muted">&lt;i class="fas fa-hashtag">&lt;/i>&lt;/a>
 
&lt;/h2>&lt;p>Prune any no-longer-needed dependencies and add any dependencies needed for other combinations of OS and architectures.&lt;/p></description></item><item><title>UILabel tap gesture in Swift</title><link>https://cgiacomi.com/posts/2019-02-18-swift-tap-label/</link><pubDate>Mon, 18 Feb 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-02-18-swift-tap-label/</guid><description>&lt;p>In iOS there are situations where a &lt;code>UIButton&lt;/code> will not be exactly what you need. One of these, at least in my case has been when creating my UI via the Storyboard. I have found that embedding a &lt;code>UILabel&lt;/code> in a &lt;code>UITableViewCell&lt;/code> is a much simpler process that attempting to so so with a &lt;code>UIButton&lt;/code>.&lt;/p>
&lt;p>Therefore I have found myself using a &lt;code>UILabel&lt;/code> more than once instead of a &lt;code>UIButton&lt;/code>. Unfortunately a label does not respond exactly like a button, specifically when you tap the label, nothing happens by default.&lt;/p></description></item><item><title>Angular, extract route parameter from Url</title><link>https://cgiacomi.com/posts/2019-01-05-angular-routing-id/</link><pubDate>Sat, 05 Jan 2019 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2019-01-05-angular-routing-id/</guid><description>&lt;p>Angular is great, but some simple things seem to be more complicated than they actually are.&lt;/p>
&lt;p>One of these is the way you can extract the id route parameter from a Url. There are many ways, and if you search on google you will really find tons of different ways, and it can sometimes be confusing. Especially when you start to see Observables mentioned.&lt;/p>
&lt;p>Personally when I need to retrieve an id route parameter from a Url I always go with what I think is the simplest solution, and I follow the official Angular documentation.&lt;/p></description></item><item><title>Bearer strategy in Express.js</title><link>https://cgiacomi.com/posts/2018-08-12-express-bearer-strategy/</link><pubDate>Sun, 12 Aug 2018 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2018-08-12-express-bearer-strategy/</guid><description>&lt;p>When working with Express.js you will at some point require some kind of authentication. In my case, since I have moved away from server side rendering and use Angular for the front-end and Express.js or Hapi for my REST API, I choose to use JWT tokens for my authentication needs.&lt;/p>
&lt;p>I will not cover JWT tokens as it would make this post much longer and also because there are so many awesome posts about it out there, like this &lt;a href="https://flaviocopes.com/jwt/">blog post&lt;/a> by Flavio Copes.&lt;/p></description></item><item><title>Random hex strings</title><link>https://cgiacomi.com/posts/2018-06-18-random-hex-strings/</link><pubDate>Mon, 18 Jun 2018 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2018-06-18-random-hex-strings/</guid><description>&lt;p>As a developer is sometimes happens that I need to generate some random bytes as a hexadecimal string. This could be the case if you need a short lived token of some kind.&lt;/p>
&lt;p>&lt;strong>This is not something you should use to generate a password for any environment.&lt;/strong>&lt;/p>
&lt;p>So I have compiled a small sample in the languages I usually develop in.&lt;/p>
&lt;p>&lt;strong>C#&lt;/strong>&lt;/p>
&lt;div class="code-block">
 &lt;div class="code-header"> &lt;span data-label-text="C#">&lt;i class="fas fa-code fa-fw small">&lt;/i>&lt;/span> &lt;button aria-label="copy" data-title-succeed="Copied!">&lt;i class="far fa-clipboard">&lt;/i>&lt;/button>&lt;/div>
 
 &lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-csharp" data-lang="csharp">&lt;span class="line">&lt;span class="cl">&lt;span class="k">using&lt;/span> &lt;span class="nn">System&lt;/span>&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Random&lt;/span> &lt;span class="n">random&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="k">new&lt;/span> &lt;span class="n">Random&lt;/span>&lt;span class="p">();&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kt">var&lt;/span> &lt;span class="n">bytes&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="k">new&lt;/span> &lt;span class="n">Byte&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="m">30&lt;/span>&lt;span class="p">];&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">random&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="n">NextBytes&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">bytes&lt;/span>&lt;span class="p">);&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kt">var&lt;/span> &lt;span class="n">hexArray&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="n">Array&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="n">ConvertAll&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">bytes&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">x&lt;/span> &lt;span class="p">=&amp;gt;&lt;/span> &lt;span class="n">x&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="n">ToString&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s">&amp;#34;X2&amp;#34;&lt;/span>&lt;span class="p">));&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kt">var&lt;/span> &lt;span class="n">hexStr&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="n">String&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="n">Concat&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">hexArray&lt;/span>&lt;span class="p">);&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Console&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="n">WriteLine&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">hexStr&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="n">ToLower&lt;/span>&lt;span class="p">());&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;p>&lt;strong>Python&lt;/strong>&lt;/p></description></item><item><title>Check if a value is an array in JavaScript</title><link>https://cgiacomi.com/posts/2017-09-06-check-if-array-javascript/</link><pubDate>Wed, 06 Sep 2017 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2017-09-06-check-if-array-javascript/</guid><description>&lt;p>I am sure it has happened to everyone to call a function in Javascript without knowing exactly the return type. The question is, how can I test that value to see if it&amp;rsquo;s an array?&lt;/p>
&lt;p>This is especially true if you have business logic that differentiates between an array and a normal value, and performs different instructions based on the type.&lt;/p>
&lt;p>Well it&amp;rsquo;s actually super easy to do that. Always use the &lt;code>isArray()&lt;/code> static method provided by the runtime on the Array object, introduced in ECMAScript: 5&lt;/p></description></item><item><title>Hello world</title><link>https://cgiacomi.com/posts/2017-08-30-hello-world/</link><pubDate>Wed, 30 Aug 2017 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/posts/2017-08-30-hello-world/</guid><description>&lt;p>In most programming books the author attempts to appease the programming gods by printing a small sacrifice, usually &amp;lsquo;hello world&amp;rsquo;.&lt;/p>
&lt;p>Here is my attempt to appease the programming gods.&lt;/p>
&lt;p>In C#&lt;/p>
&lt;div class="code-block">
 &lt;div class="code-header"> &lt;span data-label-text="C#">&lt;i class="fas fa-code fa-fw small">&lt;/i>&lt;/span> &lt;button aria-label="copy" data-title-succeed="Copied!">&lt;i class="far fa-clipboard">&lt;/i>&lt;/button>&lt;/div>
 
 &lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;span class="lnt">8
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-csharp" data-lang="csharp">&lt;span class="line">&lt;span class="cl">&lt;span class="k">using&lt;/span> &lt;span class="nn">System&lt;/span>&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">class&lt;/span> &lt;span class="nc">Program&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="kd">public&lt;/span> &lt;span class="kd">static&lt;/span> &lt;span class="k">void&lt;/span> &lt;span class="n">Main&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="kt">string&lt;/span>&lt;span class="p">[]&lt;/span> &lt;span class="n">args&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">Console&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="n">WriteLine&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s">&amp;#34;Hello, world!&amp;#34;&lt;/span>&lt;span class="p">);&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;p>In Swift.&lt;/p>
&lt;div class="code-block">
 &lt;div class="code-header"> &lt;span data-label-text="Swift">&lt;i class="fas fa-code fa-fw small">&lt;/i>&lt;/span> &lt;button aria-label="copy" data-title-succeed="Copied!">&lt;i class="far fa-clipboard">&lt;/i>&lt;/button>&lt;/div>
 
 &lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-swift" data-lang="swift">&lt;span class="line">&lt;span class="cl">&lt;span class="bp">println&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s">&amp;#34;Hello, world!&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;p>In Go.&lt;/p>
&lt;div class="code-block">
 &lt;div class="code-header"> &lt;span data-label-text="Go">&lt;i class="fas fa-code fa-fw small">&lt;/i>&lt;/span> &lt;button aria-label="copy" data-title-succeed="Copied!">&lt;i class="far fa-clipboard">&lt;/i>&lt;/button>&lt;/div>
 
 &lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-go" data-lang="go">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">package&lt;/span> &lt;span class="nx">main&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">import&lt;/span> &lt;span class="s">&amp;#34;fmt&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kd">func&lt;/span> &lt;span class="nf">main&lt;/span>&lt;span class="p">()&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nx">fmt&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nf">Println&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s">&amp;#34;Hello, world!&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div></description></item><item><title>Archives</title><link>https://cgiacomi.com/archives/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://cgiacomi.com/archives/</guid><description/></item></channel></rss>