Skip to content

Instantly share code, notes, and snippets.

<?php
//
// Measure the time to execute two thousand jobs ten times.
//
require_once __DIR__.'/../vendor/autoload.php';
function benchmark($resque, $count) {
$start = microtime(true);
for($i=$count;$i > 0;--$i) {
/**
* Maintenance script that populates the event_page_id column of echo_event
*
* @ingroup Maintenance
*/
class updateEchoSchemaForSuppression extends Maintenance {
public function __construct() {
parent::__construct();
$this->mBatchSize = 500;
vagrant@mediawiki-vagrant:~/fastcgi$ sudo gdb /usr/bin/hhvm
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
<?php
require('src/lightncandy.php');
$template = "{{!-- --}}\n{{#foo}}{{this}}{{/foo}}";
$php = LightnCandy::compile($template, array(
'flags' => LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_THIS
));
echo "Rendered PHP code is:\n$php\n\n";
$renderer = LightnCandy::prepare($php);
<?php
echo "Replace wgMemc\n";
$realMemc = $wgMemc;
$wgMemc = new HashBagOStuff;
echo "Locate workflow for ", $argv[1], "\n";
$workflow = Flow\Container::get( 'factory.loader.workflow' )->createWorkflowLoader( Title::newFromText( $argv[1] ) )->getWorkflow();
echo "Get list of topics\n";
<?php
namespace Flow\Data;
use Flow\Exception\FlowException;
use Flow\Model\PostRevision;
use Flow\Model\Workflow;
use Flow\WatchedTopicItems;
use WatchedItem;
@ebernhardson
ebernhardson / gist:4b58fd87fedfcdd2b032
Last active August 29, 2015 14:05
Serializer.php
<?php
namespace Flow\Serializer;
use Flow\Data\UserNameBatch;
use Flow\Model\AbstractRevision;
use Flow\Model\UserTuple;
use Flow\Model\UUID;
use Flow\Templating;
use ArrayIterator;
@ebernhardson
ebernhardson / first.php
Last active August 29, 2015 14:23
When running reproduce.php both eval'd pieces of code output "first", but the second one should be outputting "second"
return function ($in, $debugopt = 1) {
return (function() {return 'first';})();
};
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package org.wikimedia.mediawiki.search;
@SuppressWarnings("all")
/** An individual request made between mediawiki and elasticsearch */
@org.apache.avro.specific.AvroGenerated
public class CirrusSearchRequest extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
{
"type": "record",
"name": "CirrusSearchRequestSet",
"namespace": "org.wikimedia.mediawiki.search",
"doc": "A set of requests made by CirrusSearch to the elasticsearch user for a single php execution context",
"fields": [
{
"name": "wikiId",
"doc": "The wiki making this request, such as dewiki or enwiktionary",
"type": "string"