Skip to content

Instantly share code, notes, and snippets.

View mneuhaus's full-sized avatar

Marc Neuhaus mneuhaus

View GitHub Profile
@kdambekalns
kdambekalns / README.rst
Created October 12, 2011 12:21
Converting Doctrine annotations back to strings

When creating proxy classes, we do not copy the docblock, but generate one, using the parsed annotations of the original class. Thus we need to render them out to string form. This is what we currently use for that purpose...

@afoeder
afoeder / ReflectionDemo.php
Created January 13, 2012 09:30
Accessing private properties and methods using PHP's reflection
<?php
/**
* Please be aware that private properties are private for good purpose,
* changing it during runtime so is only OK during Unit Testing for example.
* So use this only if you're knowing what you're doing :)
*/
class BareDemoClass() {
@beelbrecht
beelbrecht / SimpleSurfDeployScript.php
Created October 14, 2012 20:59
This is an example of a simple deployment script using with the great TYPO3 Surf. You can use this script with TYPO3 Surf to deploy a simple static website.
<?php
// Create a simple workflow based on the predefined 'SimpleWorkflow'.
$workflow = new \TYPO3\Surf\Domain\Model\SimpleWorkflow();
// Define a custom task for smoketesting based on the 'httptest' task.
// Be sure, that the document root of next.example.org points to
// '[deploymentPath]/releases/next'
$smokeTestOptions = array(
'url' => 'http://next.example.org',
@bwaidelich
bwaidelich / EntityManagerFactoryAspect.php
Created October 19, 2012 11:13
Doctrine behaviors in TYPO3 Flow - Example: Softdeletable
<?php
namespace YourPackage\Aop;
use TYPO3\Flow\Annotations as Flow;
/**
* @Flow\Aspect
*/
class EntityManagerFactoryAspect {
<?php
namespace ......;
/* *
* This script belongs to the TYPO3 Flow package '........'. *
* *
* */
use TYPO3\Flow\Annotations as Flow;
@bwaidelich
bwaidelich / CacheViewHelper.php
Created November 29, 2012 12:03
Cache View Helper for TYPO3 Fluid
<?php
namespace Your\Package\ViewHelpers;
/* *
* This script belongs to the TYPO3 Flow package "Your.Package". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
<?php
use TYPO3\Surf\Domain\Model\Node;
use TYPO3\Surf\Domain\Model\SimpleWorkflow;
$application = new \TYPO3\Surf\Application\TYPO3\Flow();
$application->setOption('version', getenv('VERSION'));
$application->setOption('repositoryUrl', getenv('REPOSITORY'));
$application->setOption('localPackagePath', FLOW_PATH_DATA . 'Checkout' . DIRECTORY_SEPARATOR . $deployment->getName() . DIRECTORY_SEPARATOR . getenv('DEPLOYMENT_NAME') . DIRECTORY_SEPARATOR);
$application->setOption('composerCommandPath', getenv('COMPOSER_PATH') ? getenv('COMPOSER_PATH') : '/usr/bin/composer');
$application->setOption('transferMethod', 'rsync');
#!/usr/bin/php
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_STRICT);
define('FLOW_PATH_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
define('FLOW_PATH_PACKAGES', FLOW_PATH_ROOT . 'Packages' . DIRECTORY_SEPARATOR);
class Gerrit {
@bwaidelich
bwaidelich / User.php
Created August 21, 2013 09:20
Simple example for a custom User domain object with some convenience methods in TYPO3 Flow
<?php
namespace Some\Package\Domain\Model;
use TYPO3\Flow\Annotations as Flow;
use Doctrine\ORM\Mapping as ORM;
use TYPO3\Flow\Security\Policy\Role;
use TYPO3\Party\Domain\Model\AbstractParty;
/**
* A User
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
window.onresize = function(){
var agent = navigator.userAgent;
var current_width = window.innerWidth;
var html = document.getElementsByTagName('html')[0];
if (agent.match(/Android.*Mobile|BlackBerry|iPhone|iPod|Opera Mini|IEMobile/i)) {