Skip to content

Instantly share code, notes, and snippets.

View jrbasso's full-sized avatar

Juan Basso jrbasso

  • Zumba
  • Pembroke Pines, FL, USA
  • X @jrbasso
View GitHub Profile
@jrbasso
jrbasso / serializer_perf_test.php
Created February 28, 2016 19:33
Testing performance with options suggested on zumba/json-serializer#14
<?php
class JsonSerializer {
const CLASS_IDENTIFIER_KEY = '@type';
const FLOAT_ADAPTER = 'JsonSerializerFloatAdapter';
/**
* Storage for object
*
* Used for recursion
*

Keybase proof

I hereby claim:

  • I am jrbasso on github.
  • I am jrbasso (https://keybase.io/jrbasso) on keybase.
  • I have a public key whose fingerprint is FB6C 0029 F72B 33F3 69CF C90F B81C DD9B B318 78F8

To claim this, I am signing this object:

<?php
namespace Cake;
class Router {
protected static $_collection;
protected static $_vars;
public static function test() {
static::$_collection = new \stdClass();
<?php
App::uses('CakeRoute', 'Routing/Route');
/**
* Just a wrap of CakeRoute to support var_export
*/
class ZumbaRoute extends CakeRoute {
public static function __set_state($fields) {
<?php
$data = array_fill(0, 1000, 1.0);
$iterations = 10000;
$m = microtime(true);
while ($iterations-- > 0) {
json_encode($data);
}
echo "Elapsed time: ", (microtime(true) - $m), "\n";
<?php
namespace Cake\Core {
trait Log {
public function log() {
echo 'hi';
}
}
}
<!DOCTYPE html>
<html>
<body>
<form method="get">
<input type="text" name="search">
</form>
</body>
</html>
# Bash completation for application
_my_application()
{
local cur prev opts job
COMPREPLY=()
job="${COMP_WORDS[0]}"
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@jrbasso
jrbasso / bash_completation.php
Created August 19, 2012 23:20
PHP code for
<?php
// In my job.php file
if ($argv[1] === '__check__') {
if (empty($argv[2])) {
echo implode(' ', \Zumba\Job\Job::availableJobs());
} else {
$class = getJobClass($argv[2]);
if (class_exists($class)) {
echo implode(' ', $class::availableMethods());