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
<?php
namespace Schaefertours\PackageSchaefertours\ViewHelpers\Render;
use FluidTYPO3\Vhs\View\UncacheTemplateView;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Utility\ArrayUtility;
/**
* Fixes https://github.com/FluidTYPO3/vhs/issues/1075 and can be removed and replaced with the original UncacheViewHelper once
@smichaelsen
smichaelsen / output.txt
Last active July 14, 2016 07:54
Nested foreach over ObjectStorage
array (size=4)
0 => string 'outer' (length=5)
1 => string 'inner' (length=5)
2 => string 'inner' (length=5)
3 => string 'inner' (length=5)
@smichaelsen
smichaelsen / pokemon-go.md
Last active July 8, 2016 17:57
Review: Pokémon Go

Review Pokémon Go

Demnächst erscheint Pokémon Go für iOS und Android in Deutschland. Ich habe das Spiel bereits vor einigen Tagen aus dem australischen AppStore geladen und ausprobiert. Hier möchte ich euch eine kleine Review geben.

Exkurs: iOS Apps aus anderen Ländern

Wenn ihr mal eine App braucht, die es im Store eures Heimatlandes nicht gibt, gibt es einen relativ einfachen Weg trotzdem an diese zu kommen. Hierfür müsst ihr euch für das jeweilige Land eine weitere AppleID registrieren. Hier ein paar Beispiellinks:

@smichaelsen
smichaelsen / date.php
Created May 23, 2016 11:36
PHP Date localization
<?php
setlocale(LC_TIME, 'de_DE');
echo (new DateTime())->format('F'); // May
echo strftime('%B', time()); // Mai
// BUT WHY!?
@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 / mount_point_problem.md
Last active April 12, 2016 11:24
how do I even mount point?

I'm having a hard time using mount points in TYPO3 7. Goal is to reuse a part of the page tree for multiple websites. The problem is: When I configure the mount point and open a mounted page there is no typoscript anymore. It seems not be inherited from the "parent" page. But I don't want a whole new TS setup for the mounted pages, because they should appear in the respective layouts of the websites.

Imagine a red website and a blue website that both offer the same product for which a product page exists (in fact it's multiple pages). The product page has to be included in both websites, but one time in the blue layout (from the blue website's TS) and one time in the red layout.

Any hints?

@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.
@smichaelsen
smichaelsen / A.php
Last active March 11, 2016 16:17
Idea: Injection Traits #typo3 #extbase
<?php
class A
{
/**
* In TYPO3 (Extbase) you can use a simple @inject annotation to get an instance of the class specified with
* the @var annotation ready-to-use when your class is instanciated.
* However you're discouraged to use that variant for performance reasons.
*
@smichaelsen
smichaelsen / n26.js
Created February 3, 2016 22:48
Number26 running balance
// this script displays the running balance for each day in the transaction list of your number26 bank account
// attention: you should not execute any random code you found in the internet on your online banking!
var getBalance = function(string) {
var amountParts = string.split(',');
return parseInt(amountParts[0]) + parseInt(amountParts[1]) / 100;
};
var getDayOverviewNodes = function() {
return $('.activities').find('.node.delim');
vagrantfile:
target: local
vm:
box: puphpet/debian75-x64
box_url: puphpet/debian75-x64
hostname: ''
memory: '512'
cpus: '1'
chosen_provider: parallels
box_version: ''