Skip to content

Instantly share code, notes, and snippets.

<?php
// switch this variable to see the difference
$useTimeZone3 = true;
date_default_timezone_set('Europe/Berlin');
if ($useTimeZone3) {
$date = new \DateTime('2016-09-09 00:00:00');
} else {
#!/bin/bash
# Remote Server
# If you don't use a SSH-Key you have to use format: user[:password]@jweilandXYZ.net
# else domainname is enough
server="jweilandXYZ.net"
rPath="~/typo3cms/dev/"
# Path to project root, not FE root (web)
lPath="/Users/stefan/htdocs/kunden/project/"
# PID of first root page. Needed to create a sys_domain record. In most cases this will be 1
lRootPageUid="1"
@froemken
froemken / project-update.sh
Last active May 7, 2018 13:52
A little shell script to update our projects composer environment
#!/bin/bash
# Remote Server
# If you don't use a SSH-Key you have to use format: user[:password]@jweilandXYZ.net
# else domainname is enough
server="jweiland124.net"
path="~/typo3cms/SCRIPTS/"
#System variables
localSsh="/usr/bin/ssh"
@froemken
froemken / index.php
Created May 7, 2018 06:05
A little request logger
<?php
$fp = fopen('requests.txt', 'a');
$now = new \DateTime('now');
fwrite(
$fp,
sprintf(
'%s %s %s' . CHR(10),
$now->format('d.m.Y H:i:s'),
$_SERVER['REMOTE_ADDR'],
@froemken
froemken / .htaccess
Last active May 9, 2018 10:01
Redirect domains to https ssl and prepend www
# You can check you .htaccess with: https://htaccess.madewithlove.be/
RewriteEngine On
# First: rewrite domains to different targets
RewriteCond %{HTTP_HOST} sfroemken-old\.de$ [NC]
RewriteRule ^(.*)$ https://www.sfroemken-new.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} another-domain-old\.cc$ [NC]
RewriteRule ^(.*)$ https://www.another-domain-new.com/$1 [R=301,L]
@froemken
froemken / AbstractUnitTestCase.php
Last active November 8, 2018 13:42
Abstract class for TYPO3 UnitTests based on NiMut Testing Framework to create dynamic assertions for QueryBuilder
<?php
namespace JWeiland\MyExtension\Tests\Unit;
/*
* This file is part of the my project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
@froemken
froemken / TcaSelectItemsProcessor.php
Created September 21, 2018 06:59
Show translated labels in selectbox of relations in backend
<?php
namespace Elo\EloCareer\Tca;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
@froemken
froemken / DatabaseUtility.php
Last active June 14, 2021 06:21
TYPO3 admin_get_fields with Doctrine QueryBuilder
<?php
declare(strict_types=1);
/*
* This file is part of the package jweiland/maps2.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
@froemken
froemken / Mqtt311Client.php
Created December 13, 2018 23:39
With this script you may see, why your Dyson Pure Hot and Cool will not connect with MQTT. My is not 3.1.1 compatible
<?php
$errNo = 0;
$errMsg = '';
// throws WARNING if hostname is invalid. Add @.
if ($res = @fsockopen($ipAddress, 1883, $errNo, $errMsg, 10)) {
//var_dump(chr(63>>8));
//var_dump(bin2hex('11110000'));
$packetType = '1';
config.contentObjectExceptionHandler = 0
# Default PAGE object:
page = PAGE
page.10 = FLUIDTEMPLATE
page.10.file = fileadmin/template.html
page.10 {
dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
dataProcessing.10 {
table = pages
pidInList = 1