Skip to content

Instantly share code, notes, and snippets.

View robo47's full-sized avatar

Benjamin Steininger robo47

View GitHub Profile
@robo47
robo47 / test.php
Created February 1, 2012 21:00
comparing speed of fetching single elements from apc vs. accessing an array
<pre>
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
if (!isset($_GET['num'])) {
die('you forgot a parameter');
}
echo 'Doing ' . $_GET['num'] . ' entries' . PHP_EOL . PHP_EOL;
@robo47
robo47 / gitworktimestats
Created January 11, 2012 13:49
gitworktimestats
#!/usr/bin/php
<?php
// shows how many of your commits are on saturdays/sundays or outside of your worktime (9 - 18 is standard)
// Number of commits
$count = shell_exec('git log --oneline | wc -l');
// log with only commitmessage and timestamp, separated by a space
$lines = explode(PHP_EOL, shell_exec('git log --pretty=format:"%H %at"'));
@robo47
robo47 / create-bridges.php
Created December 10, 2011 09:07
wordpress bridge generator
<?php
// @todo extract functions via tokenizer from files and create dummys including phpdoc
$data = array('admin-bar', 'author-template', 'bookmark', 'bookmark-template',
'canonical', 'capabilities', 'category', 'category-template', 'comment',
'comment-template', 'compat', 'cron', 'default-constants', 'default-widgets',
'deprecated', 'feed', 'formatting', 'functions.wp-scripts', 'functions.wp-styles',
'general-template', 'http', 'kses', 'l10n', 'link-template', 'load', 'media',
'meta', 'ms-blogs', 'ms-default-constants', 'ms-deprecated', 'ms-functions',
@robo47
robo47 / Goutte\Client.php
Created November 22, 2011 23:16
Goutte\Client.php
<?php
namespace Goutte;
use Symfony\Component\BrowserKit\Client as BaseClient;
use Symfony\Component\BrowserKit\History;
use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\BrowserKit\Request;
use Symfony\Component\BrowserKit\Response;
@robo47
robo47 / Goutte\Client.php
Created November 22, 2011 22:58
Goutte\Client.php
<?php
namespace Goutte;
use Symfony\Component\BrowserKit\Client as BaseClient;
use Symfony\Component\BrowserKit\History;
use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\BrowserKit\Request;
use Symfony\Component\BrowserKit\Response;
@robo47
robo47 / behat-jenkins.txt
Created October 10, 2011 09:50
Behat, Symfony2, Jenkins
Ant-Task which runs behat:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Foo" default="build" basedir=".">
....
<target name="behat">
<exec dir="${basedir}/" executable="php" failonerror="true">