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 / limits.md
Last active April 27, 2018 07:59
Limitations of PHP's built-in web server - UPDATE: Workaround available

Since about a year we're mostly using PHP's built-in web server for TYPO3 projects.

I've posted a how-to run TYPO3 on PHP dev server with switchable PHP versions.

The built-in server "is not intended to be a full-featured web server" however it brings everything you need for running most PHP applications - including TYPO3. Yesterday I learned one of its limitations the hard way.

When trying to index a page onto a Apache Solr search server using the solr TYPO3 extension - the indexing took forever and produced timeout error messages.
After hours(!) of debugging, I found the reason: PHP's built-in web server is single threaded. That means that while it is processing one request it can not start another one.
Why is that a problem? When indexing a page the solr extension fires requests to the frontend to retreive a fully r

@smichaelsen
smichaelsen / howto.md
Last active February 21, 2019 13:23
TYPO3 on php dev server

How-to develop TYPO3 projects locally with the built-in PHP dev server

You can develop TYPO3 projects locally without MAMP, Vagrant or Docker.

This how-to is targeted for TYPO3 developers who want to run and develop their projects on their Mac. This solution might work in a similar way on other operating systems. Feel free to add helpful information in the comments.

Prerequesite: Switchable PHP versions

One time setup

@smichaelsen
smichaelsen / _requirements.md
Last active December 13, 2017 12:35
Anforderungen an Projekt- und Buchhaltungssoftware

Muss:

  • Onlinelösung (Zugriff per Browser und/oder App)
  • Zeiterfassung oder Möglichkeit der direkten Anbindung von mite oder toggl
  • Kunden- und Projektverwaltung
  • Angebote und Rechnungen schreiben
  • Eingangsbelege erfassen und in Buchhaltungskonten buchen
  • Kontenabgleich per HBCI
  • Zuordnen von Belegen zu Bankkonto-Transaktionen (doppelte Buchführung)
  • Unterstützt Soll-Besteuerung
@smichaelsen
smichaelsen / phpstorm_shortcuts.md
Created March 31, 2017 12:11
PhpStorm Shortcuts

PhpStorm Shortcuts

Find / Open / Navigate

  • ⌘ + O: Open Class (append :42 to jump to a certain line)
  • ⌘ + ⇧ + O: Open File
  • ⌘ + Alt + O: Open Symbol
  • ⇧, ⇧: Search Everywhere
  • ⌘ + E: Recent files
  • ⌘ + ⇧ + E: Recently edited files
var loadScript = function (url, callback) {
// Adding the script tag to the head as suggested before
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
// Then bind the event to the callback function.
// There are several events for cross browser compatibility.
if (callback) {
<?php
declare(strict_types = 1);
namespace Smichalsen\Gist;
use FluidTYPO3\Fluidpages\Provider\PageProvider;
use FluidTYPO3\Fluidpages\Service\ConfigurationService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
@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;
@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 / 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 / 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.