Skip to content

Instantly share code, notes, and snippets.

View bojanz's full-sized avatar

Bojan Zivanovic bojanz

View GitHub Profile
bojanz / bench_test.go
Created January 21, 2022 17:58
bojanz/currency benchmark
package currency_test
import (
var result currency.Amount
var cmpResult int
bojanz / responsetest.go
Last active April 29, 2024 12:55
OpenAPI assert helper
package responsetest
import (
bojanz / CustomerProfile.php
Created December 21, 2018 01:05
Addressbook 2.x UX
namespace Drupal\commerce_order\Plugin\Commerce\InlineForm;
use Drupal\commerce\EntityHelper;
use Drupal\commerce\Plugin\Commerce\InlineForm\EntityInlineFormBase;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\EntityTypeManagerInterface;
bojanz / generate_currencies.php
Last active June 27, 2017 11:48
Script for regenerating Commerce 1.x currencies based on CLDR
* Regenerates the Commerce 1.x currency list from CLDR.
* Assumes the existence of commerce/ and intl/ folders.
* The intl/ folder should contain the commerceguys/intl
* library with the CLDR dataset downloaded via
* scripts/
color pt_black
syntax enable
set nowrap
set wildmenu
set lazyredraw
set showmatch
set incsearch
set hlsearch

Keybase proof

I hereby claim:

  • I am bojanz on github.
  • I am bojanz ( on keybase.
  • I have a public key whose fingerprint is 44A5 A3CC 1569 CD18 1863 8732 6FC5 55AF 7DB3 3E13

To claim this, I am signing this object:

bojanz /
Last active January 14, 2023 16:59
Extension patterns: events, tagged services, plugins

This documentation is destined for Created first as a gist to make initial comments easier. Rewrites and clarifications welcome. Code samples are simplified for clarity. Perhaps a bit too much?

When talking about extensibility, there are several distinct use cases:

  1. Reacting to an action that has already happened.

The reaction can be anything; outputting a message, sending an email, modifying a related object, etc. Examples:

  • "A node has been saved"
  • "A product has been added to the cart".