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 / typo3_unit.md
Created November 26, 2014 11:24
Run TYPO3 Core Unit tests
  1. Run the tests from within the VM (if you have one).
  2. cd to the web root
  3. composer install
  4. ./vendor/phpunit/phpunit/phpunit -c typo3/sysext/core/Build/UnitTests.xml
@smichaelsen
smichaelsen / gist:cc53bf4e4a07919101cb
Created December 11, 2014 14:04
git branch slashes
✗ git checkout -b feature/admin-interface/materialize feature/admin-interface
error: unable to resolve reference refs/heads/feature/admin-interface/materialize: Not a directory
fatal: Failed to lock ref for update: Not a directory
@smichaelsen
smichaelsen / .bashrc
Last active March 9, 2016 13:29
TYPO3 Deployment File (jweiland.net specific)
# Add Home directory to path so that you can have executables there.
export PATH=~:$PATH
# Fine, now do the following:
# Put a PHP shortcut into your home directory: ln -s /usr/local/bin/php5.6.2-cli php
# Download composer and rename the composer.phar to composer in your home directory
<?php
namespace Smichaelsen\MyExtension\ViewHelpers\Format;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Usage example
*
@smichaelsen
smichaelsen / gist:47e066ba84e268bd1fe1
Created June 19, 2015 21:11
FluidTYPO3 data access

What is FluidTYPO3 general approach towards database access?

We really like to create content elements with fluidcontent, but sometimes we lack the option to prepare some variables for the template. In our current project we use Viewhelper to get records from the database, but of course that's far from best practice (though it works nicely).

I thought it would be nice I was able to create Controller classes based on naming conventions, e.g. I have a Downloads.html fluidcontent template and create a controller in Classes/Controller/Content/DownloadsController which extends fluidcontent's ContentController and gives me the ability to prepare template variables.

What do you think? What's your approach towards this?

<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
@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 / ExtbaseViewHelper.php
Created September 16, 2015 13:36
ExtbaseViewHelper
<?php
namespace AppZap\Tripshop\ViewHelpers;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Core\Bootstrap;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Renders an extbase action into your template
*
<?php
namespace Smichaelsen\MyExt\Backend\View;
use FluidTYPO3\Flux\Service\ContentService;
class BackendLayoutView extends \TYPO3\CMS\Backend\View\BackendLayoutView {
/**
* Flux doesn't work well with TYPO3 backend layouts. The colPos item that is added in ext_tables.php is discarded by TYPO3's
* BackendLayoutView. That's why we re-add it here.
@smichaelsen
smichaelsen / kata1.md
Created October 1, 2015 12:47
MySQL Kata #1
+------+-------+
| type | value |
+------+-------+
| a    | 2     |
+------+-------+
| a    | 5     |
+------+-------+
| c    | 1     |
+------+-------+

| b | 8 |