Skip to content

Instantly share code, notes, and snippets.

@MarkMaldaba
MarkMaldaba / MP3MediaHandler.php
Last active July 3, 2017 20:03
MP3 media handler for MediaWiki
<?php
# Stream MP3 using HTML5 <audio> tag
$wgMediaHandlers['audio/mp3'] = 'MP3MediaHandler';
$wgFileExtensions[] = 'mp3';
$wgExtensionCredits['parserhook'][] = array(
'name' => 'MP3MediaHandler',
'description' => 'Provides an in-page mp3 player.',
@MarkMaldaba
MarkMaldaba / test_long_keys.php
Last active July 9, 2019 10:29
Long key names - memory usage demonstration
<?php
ReportMemoryUsage("Start Usage");
$arr = array();
for ($i = 0; $i < 10000; $i++) {
$arr[] = array(true);
}
ReportMemoryUsage("After no keys");
<?php
function intToString($int) {
$first = 'second';
$second = 'third';
$third = 'forth';
$forth = 'fifth';
$dollarer = function ($count) { return @(($count > print($first + $second === $third)) ? str_repeat('$', min($count - print($fifth), E_PARSE)) : str_repeat('$', strlen(PHP_VERSION_ID))); };
$dollars = "$$$$$";