Skip to content

Instantly share code, notes, and snippets.

@alrnz
alrnz / create_user.php
Created September 12, 2022 13:29
Create User at sendinblue.com via sendinblue/APIv3-php-library
<?php
function create_user($sendinblueApiKey = '', $mail = '', $sendinblueLists = '1,2,3'){
$config = \SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', $sendinblueApiKey);
$apiInstance = new \SendinBlue\Client\Api\ContactsApi(
new \GuzzleHttp\Client(),
$config
);
$listIds = [];
@alrnz
alrnz / replace_db_errors.sql
Created December 2, 2021 19:40
Replace decomposed saved chars in the db
/*
Ersetzt alle "Decomposed" gespeicherten Umlaute (ü,ö,ä,Ö) in der Datenbank
Ersetzt alle kaputten Ligaturen (ffi) in der Datenbank
https://de.wikipedia.org/wiki/Umlaut#Unicode
*/
UPDATE THE_TABLE
SET THE_FIELD = UNHEX(
REPLACE(
REPLACE(
@alrnz
alrnz / tx_aatsomeext_domain_model_some.php
Last active November 23, 2021 21:37
TYPO3 TCA from Extension-Builder extended with Image Crop (cropVariants)
'image' => [
'exclude' => true,
'label' => 'Label',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'image',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference',
'enabledControls' => [
'info' => true,
@alrnz
alrnz / resizeEnd.js
Last active February 12, 2020 09:45
jQuery onResizeEnd Function
var resizeEndDelay = 150;
var resizeEndTimeout;
window.onresize = function(){
clearTimeout(resizeEndTimeout);
resizeEndTimeout = setTimeout(function(){
$(document).trigger('resizeEnd');
}, resizeEndDelay);
};
$(document).on("resizeEnd", function (event) {
@alrnz
alrnz / strtotime_de.php
Created July 17, 2019 11:17
[Convert German Date to timestamp] Convert dates like 31.5.2019 to timestamp #PHP #Timestamp
private function strtotime_de($input = '20.5.2019'){
if ( preg_match('/^(?P<day>\d+)[\.-\/](?P<month>\d+)[\.-\/](?P<year>\d+)$/', $input, $matches) )
{
$timestamp = mktime(12, 0, 0, $matches['month'], $matches['day'], $matches['year']);
}
}
@alrnz
alrnz / imgtest.php
Created June 9, 2019 10:55
Check for image tools on server
<?php
echo "<h4>GhostScript-Version is: </h4>"
. shell_exec("gs --version") . '<br><br>';
echo "<h4>ImageMagick-Version is: </h4>"
. shell_exec("convert --version") . '<br><br>';
@alrnz
alrnz / remove_duplicate_lines.sh
Last active May 29, 2019 12:12
[remove duplicate lines] remove duplicate lines from files keeping the original order #Shell
# [remove duplicate lines] remove duplicate lines from files keeping the original order #Shell
# From: https://iridakos.com/how-to/2019/05/16/remove-duplicate-lines-preserving-order-linux.html
awk '!visited[$0]++' your_file > deduplicated_file
@alrnz
alrnz / global.ts
Last active May 8, 2019 08:43
Add new type of image orientation to text-media content-elements #TYPO3 #TypoScript
# Remove items from imageorient of textpic elements
TCEFORM.tt_content.imageorient {
removeItems = 1,2,3,4,5,6,7,8,9,10
addItems {
62 = As Background
62.icon = EXT:typo3sz_assets/Resources/Public/Icons/svg/0645-earth.svg
}
}
@alrnz
alrnz / mysqldump.php
Created September 11, 2018 21:44 — forked from micc83/mysqldump.php
Simple PHP script to dump a MySql database
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';
@alrnz
alrnz / shell.sh
Last active May 8, 2019 08:45
Nach Update von 7.6.16 auf 7.6.19 Fehlermeldung LinkHandler #TYPO3 #Shell
# TYPO3 Update von 7.6.16 auf 7.6.19 führt zu Fehlermeldung im RTE-Link Fenster.
# Fehlermeldung: Uncaught TYPO3 Exception: #1442787911: No link handlers are configured. Check page TSconfig TCEMAIN.linkHandler.
#
# Lösung: cache_core Dateien löschen
sudo rm -rf typo3temp/Cache/Code/cache_core
# oder
sudo rm -rf typo3temp/