Skip to content

Instantly share code, notes, and snippets.

@bnf
bnf / typo3-default-configuration-to-settings.php
Created March 27, 2024 10:43
TYPO3 DefaultConfigurationDescription.yaml to Settings.schema.yaml
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Symfony\Component\Yaml\Yaml;
$fileName = 'typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml';
$data = Yaml::parseFile($fileName);
$defaultConfiguration = require('typo3/sysext/core/Configuration/DefaultConfiguration.php');
$schema = new stdClass;
@bnf
bnf / typo3-default-configuration-to-json-schema.php
Last active March 25, 2024 07:36
TYPO3 Default Configuration Description to JSON Schema Converter
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Symfony\Component\Yaml\Yaml;
$fileName = 'typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml';
$data = Yaml::parseFile($fileName);
$defaultConfiguration = require('typo3/sysext/core/Configuration/DefaultConfiguration.php');
$schema = (new SchemaConverter())->parseSchema(
@bnf
bnf / .git_hooks_pre-push
Last active January 16, 2024 13:11
Prevent accidental push of security commits
#!/usr/bin/bash
# Store in .git/hooks/pre-push
# Only allow pushes of branches named "security*" and
# commits that include "SECURITY" to the remote
# named $ALLOWED_SECURITY_REMOTE
ALLOWED_SECURITY_REMOTE="security"
@bnf
bnf / Fedora systemd-nspawn container for web development.md
Last active November 24, 2023 16:12
Fedora systemd-nspawn container for web development

Fedora systemd-nspawn container for web development

Requires: systemd/systemd#30080

Usage

cd path/to/your/local/sources
# creates a container with the current directory mapped to /var/www/html and configures apache/php/mariadb.
create-webfedora.sh testsite

Example usage

php equation-resolver.php

Output:

(1 / 7 + 7) * (7 + 7) = 100
((1 / 7) + 7) * (7 + 7) = 100
(7 + 1 / 7) * (7 + 7) = 100
@bnf
bnf / cherry-split.sh
Last active February 6, 2023 18:29 — forked from ohader/cherry-split.sh
TYPO3 Git Commit Splitter
#!/bin/sh
###
# TYPO3 Git Cherry-Picked Commit Splitter ("Cherry-Split")
# @author Oliver Hader <oliver@typo3.org>
# @license GPL v2 on any later version
#
# Usage
# - cherry-pick change to local Git working copy
# - execute this script `./cherry-split.sh` which processed the tip commit
@bnf
bnf / Makefile
Last active April 20, 2022 14:13
Makefile wrapper for TYPO3 core Gruntfile – location: Build/Makefile
.PHONY: assets css js install help watch build
HAS_DDEV_CONFIG=$(if $(wildcard ../.ddev/config.yaml),1)
IS_IN_DDEV_CONTAINER=${IS_DDEV_PROJECT}
# Generate "ddev exec" prefix if ddev is configured and not running inside the ddev container
COMMAND_PREFIX=$(if $(HAS_DDEV_CONFIG),$(if $(IS_IN_DDEV_CONTAINER),,(ddev exec -s web true >/dev/null || ddev start) && ddev exec -s web -d /var/www/html/Build))
YARN=$(COMMAND_PREFIX) yarn
GRUNT=$(COMMAND_PREFIX) node_modules/.bin/grunt
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Demonstration that conflicts don't make composer convenient.

First run:

$ composer install

Then

$ composer require typo3/cms-about
@bnf
bnf / a-psr14-psr11-service-provider-example.php
Last active January 31, 2019 13:27
Chained PSR-14 ListenerProviderInteface's, autoconfigured using container-interop/service-providers
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Bnf\Di\Container;
use Crell\Tukio\Dispatcher;
use Interop\Container\ServiceProviderInterface;
use Psr\Container\ContainerInterface;
use Psr\EventDispatcher\ListenerProviderInterface;
use Psr\EventDispatcher\EventDispatcherInterface;