Skip to content

Instantly share code, notes, and snippets.

View anthonybishopric's full-sized avatar
🚴

Anthony Bishopric anthonybishopric

🚴
View GitHub Profile
@anthonybishopric
anthonybishopric / Destructy.php
Last active December 19, 2015 20:08
Guess what $counter is!
<?php
function timer(callable $fn, $name, $freq=50000)
{
$start = microtime(true);
$start_mem = memory_get_usage(true);
$things = [];
for ($i = 0; $i < $freq; $i++)
{
$things[] = $fn();
@anthonybishopric
anthonybishopric / parse-junit
Created October 18, 2013 17:55
Simple script to print errors in a junit-formatted xml file.
#! /usr/bin/env ruby
require "xmlsimple"
require "colored"
def parse_test_cases(test_cases)
test_cases.each do |test_case|
errs = test_case["failure"] || test_case["error"]
if errs
puts ("-->" + test_case["name"]).red
@anthonybishopric
anthonybishopric / extensions.md
Last active April 12, 2016 00:48
Interesting PHP Extensions. These aren't necessarily good to use right off the shelf, but serve as inspiration for things that could be built.
@anthonybishopric
anthonybishopric / gist:3915637
Created October 19, 2012 00:50
Inline C in PHP
<?php
// This is largely stolen from test.php in the Inline_C repo (https://github.com/pear/Inline_C/blob/master/test.php)
require_once("C.php");
$function1 = <<<EOF
PHP_FUNCTION(times)
{
long i,j;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i,&j) == FAILURE) {