Skip to content

Instantly share code, notes, and snippets.

View smichaelsen's full-sized avatar
🥋
Changing the world in code

Sebastian Michaelsen smichaelsen

🥋
Changing the world in code
View GitHub Profile
www.googletagmanager.com
bild.de
@smichaelsen
smichaelsen / Favicons.html
Last active October 12, 2023 17:52
Multiple Favicons in TypoScript
<html data-namespace-typo3-fluid="true" xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers">
<link rel="apple-touch-icon" sizes="57x57" href="{f:uri.resource(path:'Favicons/apple-touch-icon-57x57.png')}">
<link rel="apple-touch-icon" sizes="60x60" href="{f:uri.resource(path:'Favicons/apple-touch-icon-60x60.png')}">
<link rel="apple-touch-icon" sizes="72x72" href="{f:uri.resource(path:'Favicons/apple-touch-icon-72x72.png')}">
<link rel="apple-touch-icon" sizes="76x76" href="{f:uri.resource(path:'Favicons/apple-touch-icon-76x76.png')}">
<link rel="apple-touch-icon" sizes="114x114" href="{f:uri.resource(path:'Favicons/apple-touch-icon-114x114.png')}">
<link rel="apple-touch-icon" sizes="120x120" href="{f:uri.resource(path:'Favicons/apple-touch-icon-120x120.png')}">
<link rel="apple-touch-icon" sizes="144x144" href="{f:uri.resource(path:'Favicons/apple-touch-icon-144x144.png')}">
<link rel="apple-touch-icon" sizes="152x152" href="{f:uri.resource(path:'Favicons/apple-touch-icon-152x152.png')}">
@smichaelsen
smichaelsen / RelationHandler.php
Last active April 3, 2023 03:14
TCA bidirectional mm relation to same field
<?php
namespace Smichaelsen\Gist\Database;
/**
* @see https://gist.github.com/smichaelsen/4e99a0d19d81a42caeac
* As of TYPO3 7 it's not possible in TCA to define bidirectional MM relations with each side of
* the relation being the same field. (e.g. "related news").
*
* As a fix this extension of the relation handler just stores the relation in both ways into the
* MM table when it detects a MM relation with both sides being the same field.
<?php
declare(strict_types=1);
namespace Vendor\Sitepackage\DataProcessing;
use Doctrine\DBAL\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\FrontendWorkspaceRestriction;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
@smichaelsen
smichaelsen / AddProjectVersionToSystemInformationToolbar.php
Created December 2, 2021 10:57
Show project version in TYPO3 backend
<?php
declare(strict_types=1);
namespace MyVendor\Sitepackage\EventListener;
use TYPO3\CMS\Backend\Backend\Event\SystemInformationToolbarCollectorEvent;
use TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Utility\CommandUtility;
#include <stdio.h>
int main() {
if(showMenu() == 0) {
printf("Telefonnummern: ");
} else {
printf("Neue Nummer hinzufuegen: ");
}
return 0;
}
int showMenu() {
@smichaelsen
smichaelsen / formula_e.md
Last active August 13, 2022 18:23
Vandoorne oder Evans?

Vandoorne oder Evans?

Vor dem letzten Rennen

  1. Vandoorne: 195 Pkt (1 Sieg)
  2. Evans: 174 Pkt (4 Siege)
  • Evans gewinnt bei Punktgleichheit.
  • Evans muss 21 Pkt mehr gewinnen als Vandoorne.
@smichaelsen
smichaelsen / gitlab_typo3_setup.md
Last active August 12, 2022 14:11
Setting up a Build Server for TYPO3 projects on Gitlab.com

Setting up a Build Server for TYPO3 projects on Gitlab.com

Background

We're a small team of only two people, but we're tackling more and more rather big TYPO3 projects. Over time we introduced package management for PHP (composer) and JS (bower) and depended on frontend building with Grunt. With rising complexity and importance of our projects we felt the demand for an efficient and safe way to deploy our websites on different servers.

We helped our selves with small self written deploy scripts that performed building on the target server, but you can't run node (for Grunt) or sass in every environment, and if building goes wrong the website was likely to be broken on the live server - so we needed a Build Server.

But solutions we looked at turned out to be quite time consuming (setting up and managing self hosted Gitlab and Gitlab-CI or a Jenkins server and runners) or costly.

Free Hosting on Gitlab.com

@smichaelsen
smichaelsen / classList.bem.js
Last active April 16, 2022 15:20
Add/Remove BEM Modifier with classList
DOMTokenList.prototype.getFullModifierClassName = function (modifier) {
if (this.length === 0) {
return '';
}
return this.item(0) + '--' + modifier;
};
DOMTokenList.prototype.addModifier = function (modifier) {
this.add(this.getFullModifierClassName(modifier));
};
// ==UserScript==
// @name Paypal YNAB Export
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.paypal.com/mep/dashboard
// @icon https://www.google.com/s2/favicons?domain=paypal.com
// @grant none
// ==/UserScript==