Skip to content

Instantly share code, notes, and snippets.

View peterlozano's full-sized avatar

Pedro Lozano peterlozano

View GitHub Profile
@peterlozano
peterlozano / Readme.md
Last active August 29, 2015 13:57
ipv6 entries in /etc/hosts for MAMP
@peterlozano
peterlozano / XHPROF MEASURE
Last active September 25, 2015 08:27
Enable and dump xhprof
$path = '/usr/share/php';
include_once $path . '/xhprof_lib/utils/xhprof_lib.php';
include_once $path . '/xhprof_lib/utils/xhprof_runs.php';
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
// YOUR CODE HERE
$namespace = 'app_namespace';
$xhprof_data = xhprof_disable();
@peterlozano
peterlozano / PHP measure code time
Created February 8, 2011 11:01
Measure the time spent in a piece of code. Extracted from Drupal database layer.
<?php
list($usec, $sec) = explode(' ', microtime());
$timer = (float)$usec + (float)$sec;
//
// YOUR CODE HERE
//
list($usec, $sec) = explode(' ', microtime());