Blog

What CURLOPT_FAILONERROR does in PHP

Published: April 12, 2023

Tags:

Testing for this blog post was done with PHP version 8.2.1

During a recent code review I learned about CURLOPT_FAILONERROR for the first time.

I read through both the libcurl documentation as well as the PHP documentation and in the end was still unclear exactly what this option does.

In this post I’ll share my findings from some experimentation.

Experimenting with Partytown

Published: December 22, 2022

A couple weeks back in a Twitter conversation I learned about Partytown.

I was immediately intrigued by the idea and saw great potential, especially on the ecommerce projects that I work on on a daily basis.

Today I spent some time playing with Partytown. In this post I’ll share my process and findings.

Magento + OneTrust Cookie Consent - require is not a function

Published: December 20, 2022

Tags:

There’s a lot to be said about implementing OneTrust Cookie Consent and this post doesn’t intend to cover it all. Instead, I’d like to share my experience with the JavaScript errors that occured when adding the OneTrust Cookie Consent scripts to a production Magento instance. Here’s a screenshot of the errors from the developer tools:

Screenshot of errors present in a developer tools

How Magento's JavaScript Block Loader Works

Published: December 11, 2022

Tags:

I’ve been looking at a Magento site where multiple loaders show up in different areas on the cart page. The loaders look something like this:

Screenshot of what the loader looks like

I did a bit of a deep dive into what actually causes these loader to show up. In this post I’ll share my findings.

Getting the Current Fastly VCL via API

Published: September 28, 2022

Tags:

This is just a quick little tip, but something I always have to look up how to do. The Fastly API has an endpoint for fetching the generated VCL for a service. The issue is that the version_id for the serivce must be provided in the request (there’s no way to say “just give me the currently active VCL”).

Preventing Flag Conflicts in Go

Published: July 18, 2022

Tags:

After import-ing a new package into one of my go projects and attempting to run the build, I was presented the following error:

panic: flag redefined: version

In my project, the version flag allows the user to see what version of the tool they have installed (main.version is passed as the current git tag via -ldflags in the build script).

package main

import (
	"flag"
	"fmt"
)

var version string

func main() {
	ver := flag.Bool("version", false, "Get current version")
	flag.Parse()

	if *ver {
		fmt.Println(ver)
	}
}

Presumably, the problem was that the newly imported package also used a flag with the same name.