Skip to content

Instantly share code, notes, and snippets.

View ohader's full-sized avatar

Oliver Hader ohader

View GitHub Profile
@ohader
ohader / DuplicateReducer.php
Created September 10, 2018 11:50
Duplicate file reducer. Searches for files having duplicate content and clones them to a dedicated directory.
<?php
declare(strict_types = 1);
namespace OliverHader\IndependentUtility;
/**
* Duplicate file reducer. Searches for files having duplicate content and
* clones them to a dedicated directory.
*
* @author Oliver Hader <oliver.hader@typo3.org>
* @license MIT
@ohader
ohader / database-charset-converter.php
Last active January 15, 2021 00:22
Migrates MySQL database table columns from `latin1` to `utf8` that have been stored in a mixed environment
<?php
/**
* Migrates MySQL database table columns that have been stored in a mixed
* environment - e.g. database running on `latin1` but using `SET NAMES utf8`
* during the connection when writing data to the DMBS.
*
* Expected source character set: latin1
* Defined target character set: utf8
* Defined target collation: utf8_general_ci
*
<?php
/*
Result:
Array
(
[foo.bar] =>
[foo.down.a] => AA
[foo.down.b] => BB
[value] => test
@ohader
ohader / typo3-documentation-compare.sh
Last active March 13, 2018 12:13
TYPO3 Core: Search for similar documentation *.rst files
#!/bin/bash
##############################################################################################
# searching for similar documentation *.rst files in e.g.
# typo3/sysext/core/Documentation/Changelog organized in
# different sub-directories
#
# @license MIT
# @author Oliver Hader <oliver@typo3.org>
##############################################################################################
@ohader
ohader / ticker.php
Last active March 6, 2017 09:56
PHP tick call analysis
<?php
/*
* Output:
*
* T
* #1:TTT -> 2 ticks (removed echo tick)
* #2:TT -> 1 tick (removed echo tick)
* #3:TTTT -> 3 ticks (removed echo tick)
* #4:TTT -> 2 ticks (removed echo tick)
* end:T% *
<?php
// execute with PHP 7.1.0 CGI
class Lexer
{
// All tokens that are not valid identifiers must be < 100
const T_NONE = 1;
const T_STRING = 2;
const T_DOT = 8;
<?php
class Utility
{
/**
* @param string $data
* @param array $allowedClasses
* @param bool $extend
* @return mixed
*/
static public function deserialize(string $data, array $allowedClasses, $extend = false)
@ohader
ohader / ext_emconf.php
Created February 18, 2015 17:56
EXT:newscalendar ext_emconf.php
<?php
/***************************************************************
* Extension Manager/Repository config file for ext "newscalendar".
*
* Auto generated 18-02-2015 17:33
*
* Manual updates:
* Only the data in the array - everything else is removed by next
* writing. "version" and "dependencies" must not be touched!
#!/bin/bash
PWD=$(pwd)
DIR=typo3_src-workspaces
git clone -b TYPO3_6-1 git://git.typo3.org/Packages/TYPO3.CMS.git $DIR
cd $DIR
git remote add github https://github.com/ohader/TYPO3.CMS-Workspaces.git
@ohader
ohader / Handler.php
Last active December 14, 2015 15:18
<?php
/***************************************************************
* Copyright notice
*
* (c) 2013 TYPO3 CMS Core-Security Team <security@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by