Skip to main content
Antonio Morrone

Antonio Morrone

Staff / Tech Lead Software Engineer — blockchain protocols & Web3 infrastructure, and production systems more broadly.

Where ideas become words (maybe). I write about blockchain protocols, Web3 infrastructure, and production systems more broadly — plus whatever else I run into building software day to day.

Recent

Iterators & Generators in Python

·474 words·3 mins
This post aims to describe the basic mechanisms behind iterators and generators. Iterator protocol # As in many programming languages, Python allows you to iterate over a collection. The iteration mechanism is often useful when we need to scan a sequence, an operation that is very common in programming. In Python, the iterator protocol involves two components: an iterable and an iterator.

Angular Dynamic Content

·499 words·3 mins
In many cases we need to change the content of a component dynamically — for instance, to allow the user to change view, or to let the children render data retrieved and processed by its parent component. Below, we are going to show some techniques for creating a component without deciding in advance how the data will be shown. According to the application’s needs, each technique has its own strengths, but all of them encourage component reusability. We are going to describe:

CSP and CORS

·527 words·3 mins
What is CSP # CSP stands for Content Security Policy and it is a security mechanism that helps to protect or mitigate some common attacks such as XSS (Cross-site scripting). It can be set by means of a Content-Security-Policy HTTP header or using an HTML meta tag. HTTP header: Content-Security-Policy: policy HTML Meta tag: <meta http-equiv="Content-Security-Policy" content="policy"> A policy describes a set of directives, each composed of the area in which the rule is applied and the rule itself. The policy directive default-src 'self' says to load all content from the site’s origin, while if we want to load content from the site and from another trusted domain, the policy would be Content-Security-Policy: default-src 'self' *.trusted.com.

Angular and Rxjs Http Requests: Common scenarios

·938 words·5 mins
Any modern web application needs, sooner or later, to perform some http requests to retrieve data. Below, I’ll describe some common scenarios and how to perform such requests using RxJS. Single request # The most common scenario, no special rxjs handling needed, since Angular provides an Http service that returns an Observable. services.getItems().subscribe(); Is that easy? Yes. In the particular example, I assumed the http service call was inside the service.getItems method, but it could be a fetch or anything else returning an observable.

Git: Move Files Retaining History

·564 words·3 mins
Some time ago we needed to create a new product that shares many features with the existing one. The first idea was to extract some of the code into a library, to be then imported and used independently in the two projects. After creating the repository for the library, the first thing I would have done was copy the files from one repo to another. Well, it works like a charm, it’s fast, and it doesn’t require any particular expertise — a normal drag-and-drop operation. What’s more? It could be a very effective approach, but …