Skip to content

Instantly share code, notes, and snippets.

View h3nn3s's full-sized avatar

Henrik Ziegenhain h3nn3s

View GitHub Profile
@einpraegsam
einpraegsam / datamappingExtbase.php
Last active November 3, 2023 16:15
Use DataMapper class in TYPO3 to convert an array into an object
public function mapProperties(): AnyModel
{
$properties = [
'uid' => 123,
'pid' => 123,
'firstname' => 'Alex',
'lastname' => 'Kellner'
'email' => '[email protected]'
];
$dataMapper = $this->objectManager->get(TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class);
@zeraphie
zeraphie / !-readme.md
Last active October 16, 2019 11:56
Add a service worker that can read a sitemap

Service Workers with a Sitemap Parser

This is a collection of ES2017 classes (so a transpiler is needed, webpack is used here with babel and the env preset) that utilize Service Workers to add offline support for a site. This example should work for WordPress sites as well

Installation

Because DOMParser is not included in Service Workers, you will need to install the npm package xmldom

npm install xmldom --save-dev

With Service Workers

@peterkraume
peterkraume / import-production-data
Created January 9, 2020 11:00
DDEV custom command for .ddev/commands/host
#!/bin/bash
## Description: Fetch and import production data
## Usage: import-production-data
## Example: "ddev import-production-data"
SSH_CREDENTIALS="[email protected]"
PRODUCTION_DB_USER="user"
PRODUCTION_DB_PASSWORD="pw"
<?php
namespace MyVendor\MyPackage\Service;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Use in ext_localconf.php with ExtensionManagementUtility::addTypoScript()