Skip to content

Instantly share code, notes, and snippets.

@alrnz
alrnz / .htaccess
Last active February 14, 2023 13:29
[Mittwald htaccess] htaccess rules for Mittwald standard domains #htaccess #Mittwald
# mittwaldserver umleiten
RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*\.mittwaldserver\.info [NC,OR]
RewriteCond %{HTTP_HOST} ^.*\.webspaceconfig\.de [NC]
RewriteCond %{HTTPS}s ^on(s)|
# # Zugriff verbieten (403 Fehler) (einfacher einzubinden, reicht für SEO)
# RewriteRule ^.* - [F]
# # umleiten auf andere Domain (besser für User)
RewriteRule ^ http%1://www.DOMAIN.de/$1 [R=301,L]
@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 / flexform.xml
Last active September 11, 2019 10:57
TypoLink in flexform for TYPO3 7.6 #TYPO3
<settings.link>
<TCEforms>
<exclude>1</exclude>
<label>
Link to Page or a File or a Content-Element
</label>
<config>
<type>input</type>
<size>30</size>
<eval>trim</eval>
@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 / seo_basics.ts
Last active July 17, 2019 09:22
Set static domain for SEO-Basics TYPO3 Extension
// add to the USER object (tx_seo_xmlsitemaps.10 = USER)
tx_seo_xmlsitemaps.10.useDomain = https://www.site.de/
@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