Skip to content

Instantly share code, notes, and snippets.

public function testFirstSentence() {
$many = str_repeat('many ', 100);
$cases = array(
'<h1>should ignore</h1><p>First sentence. Second sentence.</p>' => 'First sentence.',
'<h1>should ignore</h1><p>First Mr. sentence. Second sentence.</p>' => 'First Mr. sentence.',
"<h1>should ignore</h1><p>Sentence with {$many}words. Second sentence.</p>"
=> "Sentence with {$many}words.",
'<p>This classic picture book features a repetitive format that lends itself to audience interaction.&nbsp; Illustrator Eric Carle submitted new, bolder artwork for the 25th anniversary edition.</p>'
=> 'This classic picture book features a repetitive format that lends itself to audience interaction.'
);
@tractorcow
tractorcow / gist:6969730
Created October 14, 2013 02:20
Parameterised query performance
$ ./sake dev/benchmarks/all "flush=all"
SQLBENCHMARK
------------
SQLBENCHMARK
benchmarkSelect
---------------
@tractorcow
tractorcow / gist:6969731
Created October 14, 2013 02:21
Current performance
$ ./sake dev/benchmarks/all "flush=all"
SQLBENCHMARK
------------
SQLBENCHMARK
benchmarkSelect
---------------
@tractorcow
tractorcow / gist:6969805
Created October 14, 2013 02:31
Performance using PDO
$ ./sake dev/benchmarks/all "flush=all"
SQLBENCHMARK
------------
SQLBENCHMARK
benchmarkSelect
---------------
@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',
@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 / 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 / pdo.txt
Created October 14, 2013 23:20
PDO - With parameterised statement caching
$ ./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 / 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
---------------