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
@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 / 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 / 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 / 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 / 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)
<?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 / ssh_host_machine_docker_ci_server.md
Created July 21, 2016 14:49
Use SSH key from host machine in docker CI server

We run a CI server for some of our gitlab.com hosted projects. For that we have a machine over at digitalocean.com, for which I followed this tutorial: https://about.gitlab.com/2016/04/19/how-to-set-up-gitlab-runner-on-digitalocean/

Now we have the problem that our repositories have git dependencies which are not public but have to be cloned via SSH authentication. As a quick-fix we're shipping SSH keys in our repositories which grant access to those dependencies, but that doesn't seem like a good idea.

I think it would be good to have a SSH key centrally on the CI server. Unfortunatelly we're everything but docker pros and have no idea how to access a SSH key on the host machine from within the docker image. Maybe you can mount a folder via the Dockerfile, but the above tutorial doesn't include creating one, so I'm not sure where I should do that.

@smichaelsen
smichaelsen / packagestates.md
Last active October 12, 2020 11:32
Goodbye PackageStates.php

Getting PackageStates.php out of your TYPO3 project's git

Why?

Ideally your git repository only contains code that you and your team wrote yourself by hand.

  • 3rd party code should be included via a dependency manager (like composer)
  • Generated files (like compiled stylesheets) should be excluded and be regenerated whenever needed (for example when you deploy your code to a server).

PackageStates.php contains the information which TYPO3 extensions are available and loaded in the system and is typically generated when you use the extension manager to (un)install extensions.

@smichaelsen
smichaelsen / bash_question.md
Last active December 19, 2016 08:23
Bash: Variable variable name and default fallback

I'm trying to write in bash what would look like this in PHP 7:

echo ${$branch . '_SSH'} ?? $default_SSH;
  1. Check for a variable which has a variable name.
  2. Fall back to another variable if it doesn't exist.
  3. echo the result.

Is there an equivalent one liner in bash?

@smichaelsen
smichaelsen / ContentController.php
Created January 31, 2017 17:31
Workaround for flux bug #1308
<?php
namespace MyVendor\MyExtension\Controller;
use FluidTYPO3\Flux\Utility\ExtensionNamingUtility;
use FluidTYPO3\Flux\Utility\RecursiveArrayUtility;
use FluidTYPO3\Flux\View\TemplatePaths;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;