Skip to content

Instantly share code, notes, and snippets.

View staabm's full-sized avatar
👋

Markus Staab staabm

👋
View GitHub Profile
@staabm
staabm / php.sh
Last active August 29, 2015 14:14
build php branch, incl. phpdbg
#!/bin/bash
if [ "$#" != "1" ]
then
echo "Usage: $0 <branch>"
exit 1;
fi
if [ $1 == "master" ]
then
@staabm
staabm / docker
Last active August 29, 2015 14:14
php-dev docker
#from boot2docker
docker run -it dockerfile/ubuntu
#from withini the new vm
apt-get update && apt-get install -y git gcc bison autoconf libxml2-dev libssl-dev valgrind
mkdir /dvl && cd /dvl
git clone https://github.com/php/php-src.git php/php-src
wget https://gist.githubusercontent.com/staabm/d95a5ee8296043fea30d/raw/112820accbb9f7014814d78868a43cc4782408e4/php.sh && chmod +x php.sh && bash php.sh master
@staabm
staabm / maxpostsize.php
Last active July 30, 2020 14:16
Throw error when post_max_size was reached
<?php
function checkPostSizeExceeded() {
$maxPostSize = iniGetBytes('post_max_size');
if ($_SERVER['CONTENT_LENGTH'] > $maxPostSize) {
throw new Exception(
sprintf('Max post size exceeded! Got %s bytes, but limit is %s bytes.',
$_SERVER['CONTENT_LENGTH'],
$maxPostSize
@staabm
staabm / gist:6be991b7f711a19938cd
Created May 7, 2014 07:36
composer: dump optimized autoload map on dependency install/update
{
...
"scripts": {
"post-update-cmd": [
"composer dump-autoload --optimize"
],
"post-install-cmd": [
"composer dump-autoload --optimize"
]
},
@staabm
staabm / composer.json
Created January 28, 2014 16:38
phpunit on php 5.2
{
"require": {
...
},
"require-dev": {
"pear-phpunit/phpunit": "3.6.*"
},
"repositories": [
{
"type": "pear",
@staabm
staabm / composer.json
Created January 16, 2014 09:11
composer.json for phpunit 3.6 on Ubuntu 10 (requred, because of php 5.2)
{
"require": {
"php": ">=5.2.0",
"staabm/thincache": "0.*",
"rmccue/requests": "1.6.*",
"ircmaxell/password-compat": "1.0.*",
"staabm/xhprof.io": "dev-master"
},
"require-dev": {
"lstrojny/phpunit-clever-and-smart": "dev-master",
@staabm
staabm / callgraph.svg
Created December 30, 2013 12:58
callgraph svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@staabm
staabm / gist:7240968
Created October 30, 2013 21:50
Hhvm analyze
$ find . -name '*.php' > /tmp/files.list
$ hvm --hphp -t analyze --input-list /tmp/files.list
(snip...)
$ ls -1 /tmp/hphp_xegBug/
@staabm
staabm / strip.sh
Last active December 25, 2015 18:59
strip php closing tags from all files within a directory.
#!/bin/bash
# vim:ft=sh:ts=3:sts=3:sw=3:et:
# origin taken from http://bryan.ravensight.org/2010/07/remove-php-closing-tag/
# with some custom changes.
###
# Strips the closing php tag `?>` and any following blank lines from the
# end of any PHP file in the current working directory and sub-directories. Files
# with non-whitespace characters following the closing tag will not be affected.
@staabm
staabm / baseclass.php
Last active December 17, 2015 01:09
watson
<?php
// baseclass
public abstract class AbstractWatsonSearcher {
/**
* @return string[] an array of supported keywords
* /
abstract function keywords();
/**