Skip to content

Instantly share code, notes, and snippets.

Tony Levi tlevi

Block or report user

Report or block tlevi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View replace_deprecated_constructors.php
#!/usr/bin/php
<?php
if (empty($argv[1]) || preg_match('#help#', $argv[1])) {
echo <<<END
Magically rename php4 style constructors to php5 style and add a deprecated stub for BC.
Recommended usage:
time git grep -lP '^\s*((abstract|final)\s+)*class [\w\d]+(\s*\{.*|\s*|\s+extends.*)$' -- '*.php' | sort -R | xargs -rn200 -P8 replace_deprecated_constructors.php
@tlevi
tlevi / accesslib_roledefs_benchmark.php
Created Jan 19, 2015
accesslib_roledefs_benchmark
View accesslib_roledefs_benchmark.php
<?php
define('CLI_SCRIPT', true);
require_once __DIR__.'/config.php';
$t = microtime(true);
$size = 0;
for ($i = 1; $i <= 1000; $i++) {
$user = $DB->get_record_sql("SELECT * FROM {user} WHERE id = :id", array('id' => $i));
@tlevi
tlevi / hhvm-include-problem
Last active Jan 3, 2016
This test demonstrates a problem with HHVM not seeing when included files have been updated. hhvm#1595
View hhvm-include-problem
<?php
# This test demonstrates a problem with HHVM not seeing when included files have been updated.
# hhvm#1595
# Expected output:
# $ php test.php
# $included has value: [a]
# $included has value: [b]
You can’t perform that action at this time.