Skip to content

Instantly share code, notes, and snippets.

@SvenJuergens
SvenJuergens / Events2XmlSitemapDataProvider.php
Created August 8, 2024 09:13
TYPO3 Events2XmlSitemapDataProvider
<?php
declare(strict_types=1);
namespace Vendor\Abc\Seo;
use JWeiland\Events2\Domain\Model\Event;
use JWeiland\Events2\Domain\Model\Filter;
use JWeiland\Events2\Domain\Repository\DayRepository;
use Psr\Http\Message\ServerRequestInterface;
/* based on https://websemantics.uk/tools/fluid-responsive-property-calculator/ */
// Base for responsive calculation: Specifies the minimum and maximum size
// for which the size should be dynamically created
$min-vw: 375;
$max-vw: 1250;
@mixin responsive-property($min-value, $max-value,$property: font-size) {
$slope: math.div(($max-value - $min-value), ($max-vw - $min-vw));
$base: $min-value - ($slope * $min-vw);

Short and dirty workaround for this Bug in TYPO3 Blog Extension TYPO3GmbH/blog#158

i'm using a Viewhelper, based on f:variable and call it CountPostsViewHelper and run through {categories}, count the attached posts from current Language and save the result in a fluidVariable In My Widget/Categories.html, add the namespace and use the viewhelper in the <f:for> loop

<html data-namespace-typo3-fluid="true"
      xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      xmlns:blogvh="http://typo3.org/ns/T3G/AgencyPack/Blog/ViewHelpers"
      xmlns:abc="http://typo3.org/ns/MyNameSpace/MyProject/ViewHelpers"
@SvenJuergens
SvenJuergens / CropVariantUtility.php
Created July 18, 2023 14:01 — forked from derhansen/CropVariantUtility.php
TYPO3 CMS CropVariantUtility to manually calculate the default crop variant string for a given image
<?php
declare(strict_types=1);
namespace Derhansen\Typo3Dev\Utility;
use TYPO3\CMS\Core\Imaging\ImageManipulation\Area;
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
use TYPO3\CMS\Core\Imaging\ImageManipulation\InvalidConfigurationException;
use TYPO3\CMS\Core\Resource\File;
@SvenJuergens
SvenJuergens / shortcuts.md
Created June 28, 2023 09:31 — forked from memphys/shortcuts.md
Bash Shortcuts For Maximum Productivity

source: http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/

Command Editing Shortcuts

  • Ctrl + a – go to the start of the command line
  • Ctrl + e – go to the end of the command line
  • Ctrl + k – delete from cursor to the end of the command line
  • Ctrl + u – delete from cursor to the start of the command line
  • Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
  • Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
//inspired by this tweet https://twitter.com/mgechev/status/1354300680807329793
// i made this
// add a new css rule
let style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule('body.rocket {cursor:url(\"data:image\/svg+xml;utf8,<svg xmlns=\'http:\/\/www.w3.org\/2000\/svg\' width=\'64\' height=\'64\' viewport=\'0 0 100 100\' style=\'font-size: 32px; transform: scaleX(-1)\'><text y=\'50%\'>🚀<\/text><\/svg>\"), auto}');
// whenever you scroll fast enough, we add the css class to the body tag
// and wooooshh the mouse is a rocket :)
@SvenJuergens
SvenJuergens / TYPO3 Order by Random im Repository
Created December 9, 2019 10:20
TYPO3 Order by Random im Repository
//hier gefunden:https://www.npostnik.de/typo3/typo3-order-by-random-im-repository/
/**
* @param int $limit
*/
public function findRandom($limit)
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->getTableName());
$queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
$records = $queryBuilder
@SvenJuergens
SvenJuergens / pre-commit
Last active August 21, 2019 11:42 — forked from edgar/pre-commit
Git: Pre-commit git hook that prevents commits with undesired words, usually debugging statements #git #hook #pre-commit
# This script verifies if a list of "undesired" words are presented in the files you are intended to commit such console
# output, debugging information or keys/tokens/passwords
# Based on the git hook created by Mark Story
# http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
# Instructions:
# Put this file into your .git/hooks folder and set as executable (chmod +x pre-commit)
sudo chown -R $(whoami) /usr/local/lib
sudo chown -R $(whoami) /usr/local/opt
sudo chown -R $(whoami) /usr/local/share
brew tap caskroom/cask
brew tap drud/ddev
brew cleanup
// https://beyondgrep.com/why-ack/
>You could do
>`$this->objectManager->get(Typo3DbQueryParser::class)->convertQueryToDoctrineQueryBuilder($query)->getSql();`
Found this piece here: thanks to Mathias wild Brodala - mbrodala
https://typo3.slack.com/archives/C025BQLFA/p1538055078000100