Skip to content

Instantly share code, notes, and snippets.

@Digi92
Digi92 / getNameFromNumber
Last active May 13, 2021 07:51
This function will convert a number to an excel-like column name. For example: 1 => A 2 => B 27 => AA 28 => AB 14558 => UMX URL: https://stackoverflow.com/questions/3302857/algorithm-to-get-the-excel-like-column-name-of-a-number#answer-3302991
<?php
function getNameFromNumber($num) {
$numeric = $num % 26;
$letter = chr(65 + $numeric);
$num2 = intval($num / 26);
if ($num2 > 0) {
return $this->getNameFromNumber($num2 - 1) . $letter;
} else {
return $letter;
@Digi92
Digi92 / If with "AND"
Created November 2, 2017 08:54
Example for an "AND"-If in TypoScript
// Add language parameter on shortcuts when the field tx_shortcut_language is not null
3.IFSUB.additionalParams = &L={field:tx_shortcut_language}
3.IFSUB.additionalParams.insertData = 1
3.IFSUB.additionalParams.if {
value = 4
equals.field = doktype
}
3.IFSUB.additionalParams.if.isTrue = 1
3.IFSUB.additionalParams.if.isTrue.if {
value = -1
OLD: export PHP_IDE_CONFIG="serverName=example.dev"; /Applications/MAMP/bin/php/php7.0.12/bin/php -dxdebug.remote_autostart=1 -dxdebug.remote_host=127.0.0.1 /Volumes/Daten/Work/Example/htdocs/typo3/cli_dispatch.phpsh extbase example:cache:cleare exampleenviorment exampleenviorment
NEW: export PHP_IDE_CONFIG="serverName=example.dev"; /Applications/MAMP/bin/php/php7.0.12/bin/php -dxdebug.remote_autostart=1 -dxdebug.remote_host=127.0.0.1 /Volumes/Daten/Work/Example/htdocs/typo3/cli_dispatch.phpsh extbase exampleenviorment example:cache:cleare
@Digi92
Digi92 / doctrine_example_id_field.php
Last active April 15, 2017 21:00
Doctrine Example ID Field Annotation Configuration
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Example
* @package AppBundle\Entity
* @ORM\Entity
@Digi92
Digi92 / BaseEntity.php
Created April 15, 2017 20:57
Doctrine Beispiel zum Erstellen einer Base Entity Klasse so das alle anderen Klassen die diese Extenden die Felder auch in der Datenbank bekommen. Die Base Entity Klasse benötigt nur "@Orm\MappedSuperclass" als Annotation.
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class BaseEntity
* @package AppBundle\Entity
* @ORM\MappedSuperclass
@Digi92
Digi92 / doctrine_default_value.php
Last active April 15, 2017 20:57
Doctrine Add default field value.
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Example
* @package AppBundle\Entity
* @ORM\Entity
* @ORM\Table(name="example")
@Digi92
Digi92 / doctrine_on_update_CURRENT_TIMESTAMP.php
Last active October 1, 2018 08:51
Doctrine Add "on Update CURRENT_TIMESTAMP" to a field
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Example
* @package AppBundle\Entity
* @ORM\Entity
* @ORM\Table(name="example")
## Lang = de, falls de default-Sprache
page {
config {
htmlTag_stdWrap {
cObject = TEXT
cObject.value (
<!--[if lt IE 7]> <html lang="de" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="de" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="de" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="de" class="no-js"> <!--<![endif]-->
@Digi92
Digi92 / Filter_Function.php
Last active March 8, 2017 14:57
Find entry by object property from a array of objects
<?php
// Note: This will return all results with if true
$neededObject = array_filter(
$arrayOfObjects,
function ($element) use (&$searchedValue) {
/**@var element $element*/
return $element->id == $searchedValue;
}
);
@Digi92
Digi92 / Image Resize_Scaling
Created March 1, 2017 14:33
ImageMagic Bilder auf eine Größe eine Größe Skalieren womit es die Weite und Höhen angaben mittels Cropping erfüllen kann. Das ergebnis Bild hat dann angegebene Höhe und Breite bekommen. URL: http://www.imagemagick.org/Usage/resize/
convert dragon.gif -resize 64x64^ -gravity center -extent 64x64 fill_crop_dragon.gif