Skip to content

Instantly share code, notes, and snippets.

function setUp() {
$this->useToken = SecureToken::is_enabled();
}
function tearDown() {
if($this->useToken) SecureToken::enable();
else SecureToken::disable();
}
@tractorcow
tractorcow / Banner.php
Created May 15, 2014 01:53
How to use ListboxField (multiple selection)
<?php
/**
* For cool guy @BenENewton
*/
class Banner extends DataObject {
private static $db = array(
'Title' => 'Varchar'
);
// 4 width grid = 960px
$gridSize: 236px;
$gridSpacing: 5px; // External spacing
$mobileSpacing: 10px; // External spacing on mobile
$cellPadding: 15px; // Internal padding
@function gridSize($columns) {
@return $columns * ($gridSize + $gridSpacing) - $gridSpacing;
}
@tractorcow
tractorcow / gist:6999768
Created October 15, 2013 22:37
- Mac OSX - MySQL (mysqli parameterised)
Rua-Hotseat:framework rua$ ./sake dev/benchmarks/all "flush=all"
SQLBENCHMARK
------------
SQLBENCHMARK
benchmarkSelect
---------------
@tractorcow
tractorcow / gist:6999723
Created October 15, 2013 22:34
- Mac OSX - mysql - master branch
Rua-Hotseat:framework rua$ ./sake dev/benchmarks/all "flush=all"
SQLBENCHMARK
------------
SQLBENCHMARK
benchmarkSelect
---------------
@tractorcow
tractorcow / gist:6999660
Created October 15, 2013 22:27
Benchmark: - Mac OSX 10.5 - MySQL PDO
Rua-Hotseat:framework rua$ ./sake dev/benchmarks/all "flush=all"
SQLBENCHMARK
------------
SQLBENCHMARK
benchmarkSelect
---------------
@tractorcow
tractorcow / pdo.txt
Created October 14, 2013 23:20
PDO - With parameterised statement caching
$ ./sake dev/benchmarks/all "flush=all"
SQLBENCHMARK
------------
SQLBENCHMARK
benchmarkSelect
---------------
@tractorcow
tractorcow / mysqli.txt
Last active December 25, 2015 13:29
mysqli - With parameterised statement caching
$ ./sake dev/benchmarks/all "flush=all"
SQLBENCHMARK
------------
SQLBENCHMARK
benchmarkSelect
---------------
@tractorcow
tractorcow / SQLBenchmark.yml
Last active December 25, 2015 13:09
SQLBenchmark.yml
DataObjectTest_Team:
team1:
Title: Team 1
team2:
Title: Team 2
team3:
Title: Team 3
DataObjectTest_Player:
captain1:
FirstName: Captain
@tractorcow
tractorcow / SQLBenchmark.php
Last active December 25, 2015 13:08
SQLBenchmark.php
<?php
class SQLBenchmark extends SS_Benchmark {
protected static $fixture_file = 'SQLBenchmark.yml';
protected $extraDataObjects = array(
'DataObjectTest_Team',
'DataObjectTest_Fixture',
'DataObjectTest_SubTeam',