Skip to content

Instantly share code, notes, and snippets.

View JeroenDeDauw's full-sized avatar
🐈
~=[,,_,,]:3

Jeroen De Dauw JeroenDeDauw

🐈
~=[,,_,,]:3
View GitHub Profile
@JeroenDeDauw
JeroenDeDauw / gist:3600814
Created September 2, 2012 15:53
Evil PHP changing string to int
php > $a = array();
php > $a['42'] = true;
php > var_dump($a);
array(1) {
[42]=>
bool(true)
}
.svn
*~
*.kate-swp
.*.swp
public function testInsertEntity() {
$item = Item::newEmpty();
$item->setId( 42 );
$queryInterface = new ObservableQueryInterface();
$assertEquals = array( $this, 'assertEquals' );
$queryInterface->registerCallback(
'insert',
<?php
namespace Wikibase\Test\Query\SQLStore;
use Wikibase\Database\FieldDefinition;
use Wikibase\Database\ObservableQueryInterface;
use Wikibase\Database\TableDefinition;
use Wikibase\Item;
use Wikibase\QueryEngine\SQLStore\DVHandler\BooleanHandler;
use Wikibase\QueryEngine\SQLStore\DVHandler\MonolingualTextHandler;
<?php
namespace Wikibase\Test\Query\SQLStore;
use Wikibase\Database\FieldDefinition;
use Wikibase\Database\ObservableQueryInterface;
use Wikibase\Database\TableDefinition;
use Wikibase\Entity;
use Wikibase\Item;
use Wikibase\Property;
@JeroenDeDauw
JeroenDeDauw / Approach0-UsingMethodArguments.php
Last active December 22, 2015 20:19
Fields vs method arguments
<?php
class SimpleTableSchemaUpdater implements TableSchemaUpdater {
private $schemaModifier;
public function __construct( SchemaModifier $schemaModifier ) {
$this->schemaModifier = $schemaModifier;
}
/**
@JeroenDeDauw
JeroenDeDauw / active.md
Last active August 29, 2015 14:03 — forked from paulmillr/active.md

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Sat, 29 Jun 2013 00:57:40 GMT till Sun, 29 Jun 2014 00:57:40 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 62)
@JeroenDeDauw
JeroenDeDauw / keybase.md
Last active August 29, 2015 14:07
Keybase verification

Keybase proof

I hereby claim:

  • I am JeroenDeDauw on github.
  • I am jeroendedauw (https://keybase.io/jeroendedauw) on keybase.
  • I have a public key whose fingerprint is AB95 CECD B3C2 6869 E485 CD1C EEAA 431E 2E91 371F

To claim this, I am signing this object:

@JeroenDeDauw
JeroenDeDauw / ElementTowerDefence.php
Last active August 29, 2015 14:10
Selling point for pure essence in Element Tower Defence (StarCraft 2 version)
<?php
$maxWave = 60;
$interestInterval = 15;
$interestPercentage = 2;
$waveDuration = 40;
$lateSell = getSaleProfit( $maxWave );
for ( $sellWave = 1; $sellWave <= $maxWave; $sellWave++ ) {
@JeroenDeDauw
JeroenDeDauw / MapPatcher.php
Created December 29, 2014 15:27
MapPatcher method split
<?php
namespace Diff\Patcher;
use Diff\Comparer\StrictComparer;
use Diff\Comparer\ValueComparer;
use Diff\DiffOp\Diff\Diff;
use Diff\DiffOp\DiffOpAdd;
use Diff\DiffOp\DiffOpChange;
use Diff\DiffOp\DiffOpRemove;