Skip to content

Instantly share code, notes, and snippets.

View dave1010's full-sized avatar

Dave Hulbert dave1010

View GitHub Profile
@dave1010
dave1010 / de-resolve-symlinks.php
Created November 5, 2013 14:23
De-resolve symlinks from PHP's __FILE__
@dave1010
dave1010 / php-timezone-conf.sh
Created December 4, 2013 16:53
PHP timezone config
#!/bin/bash
echo "date.timezone = Europe/London" > /etc/php5/conf.d/timezone.ini
ln -s /etc/php5/conf.d/timezone.ini /etc/php5/apache2/conf.d/
ln -s /etc/php5/conf.d/timezone.ini /etc/php5/cli/conf.d/
$ cat hh.php
<?hh class Foo { public function __construct(private int $num) : void { } }
$ hhvm --version
HipHop VM 2.4.0 (rel)
Compiler: tags/HHVM-2.4.0-0-gc82fcd8e6199c500454b1a8b930a876ef2c1522b
Repo schema: a536a1d1567b1fb5d722c0349a3296d4e8589f96
$ hhvm hh.php
HipHop Fatal error: Parameters modifiers not allowed on methods in /home/base/hh.php on line 1
@dave1010
dave1010 / wp-db.php
Created February 27, 2014 13:58
wp-db.php.diff
<?php
// workaround for HHVM not supporting case-insensitive constants
// http://www.hhvm.com/blog/113/getting-wordpress-running-on-hhvm
if (! defined( 'HHVM_VERSION' )) {
define( 'OBJECT', 'OBJECT', true );
} else {
define('OBJECT', 'OBJECT');
define('Object', 'OBJECT');
@dave1010
dave1010 / hhvm-usort.php
Created February 28, 2014 16:59
HHVM and PHP usort difference
<?php
class T {
public function __construct($v)
{
$this->v = $v;
}
public function __toString()
{
return 'a';
diff --git a/wp-content/plugins/post-expirator/post-expirator.php b/wp-content/plugins/post-expirator/post-expirator.php
index d9536ff..2d2dc4c 100644
--- a/wp-content/plugins/post-expirator/post-expirator.php
+++ b/wp-content/plugins/post-expirator/post-expirator.php
@@ -1264,17 +1264,17 @@ class Walker_PostExpirator_Category_Checklist extends Walker {
$this->disabled = 'disabled="disabled"';
}
- function start_lvl(&$output, $depth, $args) {
+ function start_lvl(&$output, $depth = 0, $args = array()) {
@dave1010
dave1010 / magic-class-alias.php
Created April 2, 2014 08:08
magic class alias
<?php
class Magic {public function __call($metod, $args=null){return $this;}}
spl_autoload_register(function($c) {
eval("class $c extends Magic {};");
});
(new Foo)->bar()->baz();
@dave1010
dave1010 / app-routes.php
Last active August 29, 2015 13:58
laravel hhvm double closure bug
<?php
Route::group(['prefix' => 'api/v1'], function() {
Route::group(['prefix' => 'lines'], function(){});
});
@dave1010
dave1010 / ssltest.py
Created April 8, 2014 10:31
heartbleed test
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select