Skip to content

Instantly share code, notes, and snippets.

View DavidBruchmann's full-sized avatar
💭
It's all about compatibility

David Bruchmann DavidBruchmann

💭
It's all about compatibility
  • Webdevelopment Barlian
  • Bandung, West Java, Indonesia
View GitHub Profile
function do_something_recursive (array $arr_someArray) {
$result = array();
foreach($arr_someArray as $key => $value) {
if(is_array($value)) {
$result[$key] = do_something_recursive (array $arr_someArray)
} else {
$result[$key] = 'Here the value '.$value.' can be used or manipulated.'
}
}
return $result;
// demo-array
$arr_exampleArray = array(
'name' => 'fruits and vegetables',
'purpose' => 'demo and test only.',
'usage' => 'use, play and learn by changing.',
'fruits' => array(
'sower' => array(
'citron',
'gooseberry'
),
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
@DavidBruchmann
DavidBruchmann / lib.navSidebar.ts
Created June 16, 2018 07:26 — forked from julrich/lib.navSidebar.ts
Fully cached TYPO3 HMENU navigation example with expAll and 'active', 'current' states
#
# Main navigation in Sidebar
#
# General idea: Don't render & cache 'active' and 'current' states in 'expAll' menu, so it becomes cacheable
# over all pages. To regain 'active' and 'current' states, the result of the cached menu is parsed by
# 'stdWrap.replacement', utilizing specific information about the resulting menu item markup to insert them.
# Use COA to decouple the stdWrap ('lib.navSidebar.stdWrap.replacement') needed for RegExp replacement from
# the cached menu ('lib.navSidebar.10'). This way the complete menu can be generically cached without current
@DavidBruchmann
DavidBruchmann / debug-sql
Last active January 14, 2022 04:27 — forked from rvollebregt/debug-sql
Debug SQL query in TYPO3 8 Extbase
/** @var ObjectManager $objm */
$dbParser = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class);
$doctrineQueryBuilder = $dbParser->convertQueryToDoctrineQueryBuilder($query);
$sql = $doctrineQueryBuilder->getSQL();
$parameters = $doctrineQueryBuilder->getParameters();
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(['sql' => $sql, 'parameters' => $parameters], __METHOD__ . ':' . __LINE__);
@DavidBruchmann
DavidBruchmann / Update_Powermail.sql
Last active January 12, 2019 14:42 — forked from einpraegsam/Update.sql
Update TYPO3 Powermail from 2.x to 5.x or a newer version
# Just copy all tables from plural to singular naming
create table tx_powermail_domain_model_form LIKE tx_powermail_domain_model_forms;
insert tx_powermail_domain_model_form select * from tx_powermail_domain_model_forms;
create table tx_powermail_domain_model_page LIKE tx_powermail_domain_model_pages;
insert tx_powermail_domain_model_page select * from tx_powermail_domain_model_pages;
create table tx_powermail_domain_model_field LIKE tx_powermail_domain_model_fields;
insert tx_powermail_domain_model_field select * from tx_powermail_domain_model_fields;
@echo off
cd /D %~dp0
echo Diese Eingabeforderung nicht waehrend des Running beenden
echo Bitte erst bei einem gewollten Shutdown schliessen
echo Please close this command only for Shutdown
echo Apache 2 is starting ...
SET OPENSSL_CONF=F:\___XAMPP___\xampp-portable-win32-5.6.31-0-VC11\apache\conf\openssl.cnf
REM IF EXIST F:\___XAMPP___\xampp-portable-win32-5.6.31-0-VC11\apache\bin
SET PATH=%PATH%;F:\___XAMPP___\xampp-portable-win32-5.6.31-0-VC11\apache\bin
@DavidBruchmann
DavidBruchmann / composer.json
Last active March 5, 2019 12:44
composer-snippet for scripts
"scripts":{
"command": [
"echo \"EVENT: command\\n\"",
"VENDOR\\build\\command::myClassMethod"
],
"pre-command-run": [
"echo \"EVENT: pre-command-run\\n\"",
"VENDOR\\build\\preCommandRun::myClassMethod"
],
@DavidBruchmann
DavidBruchmann / myFile.php
Last active March 9, 2019 09:59
TYPO3, DBAL: TRUNCATE table
## THIS IS ONLY TO TRUNCATE A TABLE COMPLETELY
$tablename = 'xyz'
$driver = new \Doctrine\DBAL\Driver\Mysqli\Driver;
$queryBuilder = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Database\Query\QueryBuilder::class,
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Database\Connection::class, $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'], $driver
)
@DavidBruchmann
DavidBruchmann / decode.php
Created March 5, 2019 12:41
decode the blobs in TYPO3-scheduler-tasks
$hex = '';
$result = '';
$encoded = substr($hex, 2);
while(strlen($encoded)) {
$current = substr($encoded, 0, 2);
$encoded = substr($encoded, 2);
$result .= chr(hexDec($current));
}
echo $result;