Skip to content

Instantly share code, notes, and snippets.

View radmiraal's full-sized avatar

Rens Admiraal radmiraal

View GitHub Profile
@radmiraal
radmiraal / Template
Created November 17, 2011 19:43
Recursion issue with binding 2 textfields
{{view SC.TextField valueBinding="_imageWidth" }}
{{view SC.TextField valueBinding="_imageHeight" }}
require(
[
'order!Library/jquery-1.6.4.min.js',
'order!Library/sproutcore-2.0.beta.3.js'
],
function() {
jQuery('document').ready(function() {
require(
[],
function() {
@radmiraal
radmiraal / gist:1416348
Created December 1, 2011 12:24
Plugin unit test
<?php
/**
* @test
*/
public function renderSetsControllerActionInformationOnRequestObjectIfThePluginHasNoNode() {
$plugin = $this->getAccessibleMock('TYPO3\TYPO3\TypoScript\Plugin', array('getPluginNamespace'));
$plugin->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('typo3_plugin_namespace'));
$plugin->setRenderingContext($this->mockRenderingContext);
$plugin->_set('subRequestBuilder', $this->mockSubRequestBuilder);
TYPO3:
FLOW3:
aop:
globalObjects:
securityContext: TYPO3\FLOW3\Security\Context
configuration:
compileConfigurationFiles: true
core:
context: Production
phpBinaryPathAndFilename: /opt/local/bin/php
@radmiraal
radmiraal / gist:1688514
Created January 27, 2012 12:12
_cropOptions
_cropWidth:null,
_cropHeight:null,
_cropX:null,
_cropY:null,
_cropOptions: function(key, value) {
if (arguments.length === 1) {
return {
w: this.get('_cropWidth'),
h: this.get('_cropHeight'),
class test {
protected $methodRegex = <<<EOF
/^
\s*
(?P<visibility>public|protected|private)?
\s*
function
\s*
(?P<methodName>\w*)
@radmiraal
radmiraal / gist:1901648
Created February 24, 2012 15:31
Unit test
public function collectionValidatorValidatesNestedObjectStructuresWithoutEndlessLooping() {
$classNameA = 'A' . md5(uniqid(mt_rand(), TRUE));
eval('class ' . $classNameA . '{ public $b = array(); public $integer = 5; }');
$classNameB = 'B' . md5(uniqid(mt_rand(), TRUE));
eval('class ' . $classNameB . '{ public $a; public $c; public $integer = "Not an integer"; }');
$A = new $classNameA();
$B = new $classNameB();
$A->b = array($B);
$B->a = $A;
$B->c = array($A);
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file.cObject = CASE
file.cObject {
key {
field = backend_layout
ifEmpty.data = levelfield:-2, backend_layout_next_level, slide
}
<?php
namespace TYPO3\FLOW3\Utility\Exception;
/* *
* This script belongs to the FLOW3 framework. *
* *
* 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. *
* *
public function compile() {
// "driver" is used only for Doctrine, thus we (mis-)use it here
// additionally, when no path is set, skip this step, assuming no DB is needed
if ($this->settings['backendOptions']['driver'] !== NULL && $this->settings['backendOptions']['path'] !== NULL) {
$schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->entityManager);
///// Why this check?
if ($this->settings['backendOptions']['driver'] === 'pdo_sqlite') {
$schemaTool->createSchema($this->entityManager->getMetadataFactory()->getAllMetadata());