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
{
"data": {
"ControllerName": [{
"resource": "ControllerName",
"http_method": "GET",
"uri": "\/controller_name",
"params": [],
"doc_comment": {
"description": "List all the things",
"tags": {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>API Web Runner</title>
<link href="bootstrap20/css/bootstrap.min.css" rel="stylesheet" />
<link href="bootstrap20/css/bootstrap-responsive.min.css" rel="stylesheet" />
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/themes/redmond/jquery-ui.css" rel="stylesheet" />
<style type="text/css">
@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());
# 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]}"
<!DOCTYPE html>
<html>
<body>
<form method="get">
<input type="text" name="search">
</form>
</body>
</html>
<?php
namespace Cake\Core {
trait Log {
public function log() {
echo 'hi';
}
}
}
<?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
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
namespace Cake;
class Router {
protected static $_collection;
protected static $_vars;
public static function test() {
static::$_collection = new \stdClass();