Skip to content

Instantly share code, notes, and snippets.

@Erichain
Erichain / msconvert.js
Last active December 25, 2023 19:15 — forked from remino/msconvert.js
JavaScript: Convert milliseconds to object with days, hours, minutes, and seconds
function convertMS( milliseconds ) {
var day, hour, minute, seconds;
seconds = Math.floor(milliseconds / 1000);
minute = Math.floor(seconds / 60);
seconds = seconds % 60;
hour = Math.floor(minute / 60);
minute = minute % 60;
day = Math.floor(hour / 24);
hour = hour % 24;
return {
@jrenggli
jrenggli / AdditionalConfiguration.php
Created December 16, 2015 21:26
pageNotFound_handling for restricted pages in TYPO3
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = 'USER_FUNCTION:EXT:usermytemplate/Classes/Utility/PageNotFoundHandling.php:user_pageNotFound->pageNotFound';
// Custom configuration for multi-language 404 page, see EXT:usermytemplate/Classes/Utility/PageNotFoundHandling.php
// ID of the page to redirect to if page was not found
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_redirectPageID'] = 123;
// ID of the page to redirect to if current page is access protected
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_loginPageID'] = 789;
@Merec
Merec / PageLayoutView.php
Last active September 16, 2021 08:55 — forked from uberboom/PageLayoutView.php
TYPO3: Render a backend preview of custom content elements (TYPO3 CMS 6.2)
<?php
namespace Your\Extension\Namespace\Hooks;
class PageLayoutView implements \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface
{
/**
* Preprocesses the preview rendering of a content element.
*
@paulirish
paulirish / what-forces-layout.md
Last active May 23, 2024 14:12
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@oliverthiele
oliverthiele / robots.txt
Last active November 23, 2023 18:18
robots.txt for TYPO3
User-agent: *
# Only allow URLs generated with RealURL
Disallow: /*?id=*
Disallow: /*&id=*
# L=0 is the default language
Disallow: /*?L=0*
Disallow: /*&L=0*
@wolffc
wolffc / extabase_in_controller_action_validation_example.php
Created May 7, 2015 07:34
This is an TYPO3 / Extbase Example on how to Validate some Properties in the Controller - this is usefull for conditonal Validation
<?php
class foo {
/**
* keep trac if we have created a custom error.
* @var boolean
*/
protected $hasCustomError = false;
@cedricziel
cedricziel / ext_tables.php
Created May 4, 2015 20:47
Add a custom doktype to TYPO3 pages table
<?php
/**
* Custom Doktypes
*/
// Define a new doktype
$customShortlinkDoktype = 120;
$customPageIcon = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/Shortlink.png';
// Add the new doktype to the list of page types
$GLOBALS['PAGES_TYPES'][$customShortlinkDoktype] = array(
@a-r-m-i-n
a-r-m-i-n / _realurl_domain_language_mapping.md
Last active September 1, 2017 09:45
RealURL Configuration for Domain == Language

This config shows an example of TYPO3 RealURL configuration, to map languages to domains.

Lets say the default language (L=0) is german and the foreign language is english (L=1). Normally RealURL would create links like that:

This example is about getting rid of the /en path segment.

@cedricziel
cedricziel / BookingPageOneValidator.php
Created April 17, 2015 07:16
Dynamic Validation on controller level
<?php
namespace Websight\MyExt\Validation;
/***************************************************************
* Copyright notice
*
* (c) 2015 Cedric Ziel <cedric@cedric-ziel.com>
* (c) 2014 Carsten Bleicker <carsten@bleicker.de>
* All rights reserved
@htuscher
htuscher / AdditionalConfiguration.php
Last active March 26, 2018 20:00
TYPO3 Multitree without domain records in development
<?php
use TYPO3\CMS\Core\Utility\GeneralUtility;
if (\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getApplicationContext()->isDevelopment()) {
/**
* This override adds the possibility to use multitree subdomains without domain records (for SHARED_DB, vagrant, etc.)
* You can override the mappings or undo the override by creating a config file inside conf.d
*
* The override PageRepository checks for $subdomain . exec('hostname -f')