RSSAmplifier

Blog

Posts on Evert Timberg

Recent content in Posts on Evert Timberg

everttimberg.ioRSS feed ↗7 posts

Latest posts

Thoughts on Redux

Redux is a state management library that is commonly used in React apps. Redux was created in 2015 and almost immediately became a common sight in React apps. This may have been due to the fact that many of the React docs assumed that Redux was installed along with the popularity of boilerplates that included Redux by default. As a result of this, many front-end developers including myself,…

Circular Gradients for the HTML5 Canvas

Circular gradients are commonly used in pie or doughnut charts to change the colour of segment as the angle around the center of the chart changes. In many non web platforms, the ability to generate these gradients is provided as part of the standard APIs. For example, Android provides a SweepGradient. In the browsers, only Linear and Radial gradients are provided. Thus, if we want to a circular…

A Simple Custom React Hook to Keep State in Query String

A common problem with many web apps is that it is not easy to share links to another user. This is usually due to the fact that the transient page state is only stored in memory. I ran into this recently with a page in an app that allowed the user to view a parameter over time. The filter parameters (id, startTime, and endTime) were all stored in the component state and so if the user refreshed…

Circuit Breakers in Python

The Circuit Breaker pattern is commonly used in microservice architectures to fail quickly when an external service is down. This prevents a single service from bringing down the entire system and allows functionality to gracefully degrade. I spent part of the last weekend building my own version of a circuit breaker. There are already many existing implementations in Python, however there were a…

Self Documenting APIs with Flask and Swagger

Flask is a simple Python framework for creating web applications. It can be used to create API servers in a microservices architecture. When doing so, it is helpful to provide API documentation that ships with your service. This post outlines a technique for shipping OpenAPI v3 documentation from your service while co-locating the documentation with the API implementation. Keeping the…

About this Site

Welcome to my personal site. I wrote the site using Hugo, a static site generator written in Go. It’s been a great introduction to the Go template language. Hosting is done via static files published to Github pages. The theme for this site is based on a modified version of the Introduction theme.

Profiling Python Code with QCacheGrind

Profiling is the first step to improving the performance of code. Suppose we want to profile the Python script below which is based on the example here. It prints out the first 20 Fibonacci numbers and is unoptimized to make the profile exaggerated. def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2) def fib_seq(n): seq = [ ] if n > 0: seq.