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
<!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">
{
"data": {
"ControllerName": [{
"resource": "ControllerName",
"http_method": "GET",
"uri": "\/controller_name",
"params": [],
"doc_comment": {
"description": "List all the things",
"tags": {
@jrbasso
jrbasso / AllAppTest.php
Created August 4, 2012 21:47
All application tests ignoring CakePHP core files from Code Coverage
<?php
class AllAppTest extends CakeTestSuite {
protected $coverageSetup = false;
public static function suite() {
$suite = new self('All Application Tests');
$suite->addTestDirectoryRecursive(dirname(__FILE__));
return $suite;
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php
index cadbbbd..dfa1d3e 100644
--- a/lib/Cake/Network/CakeRequest.php
+++ b/lib/Cake/Network/CakeRequest.php
@@ -694,26 +694,7 @@ class CakeRequest implements ArrayAccess {
* @return array An array of prefValue => array(content/types)
*/
public function parseAccept() {
- $accept = array();
- $header = explode(',', $this->header('accept'));
@jrbasso
jrbasso / cakebin.php
Created July 9, 2012 01:03
Example how to create bin in bin.cakephp.org
<?php
namespace Cake\Bin;
class Push {
const DEFAULT_TYPE = 'text';
const CAKEBIN_URL = 'http://bin.cakephp.org';
protected $allowedTypes = array(
@jrbasso
jrbasso / proof_bug.diff
Created June 23, 2012 01:22
PHP_CodeSniffer bug on ScopeIndent
diff --git a/CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.inc b/CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.inc
index 848fc56..0d0e224 100644
--- a/CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.inc
+++ b/CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.inc
@@ -37,6 +37,16 @@ class Test
}
}
+ function hello4()
+ {
@jrbasso
jrbasso / update_use.php
Created May 27, 2012 03:34
Update "use" to be 1 per class and ordered by name
<?php
$dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__));
while ($dir->valid()) {
$filename = $dir->key();
if (substr($filename, -4) !== '.php' || strpos($filename, '.git')) {
$dir->next();
continue;
}
@jrbasso
jrbasso / pre-commit
Created March 31, 2012 21:54
Pre commit hook for CakePHP
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
echo "Checking PHP Lint..."
FILES=""
for FILE in `git diff --cached --name-only --diff-filter=ACMR HEAD | egrep \\\\.\(php\|ctp\)\$`
do
php -l -d display_errors=0 $PROJECT/$FILE
if [ $? != 0 ]
@jrbasso
jrbasso / cake3ns.markdown
Created December 10, 2011 23:39
CakePHP 3.0 Namespace

CakePHP Core

  • Core namespace: Cake
  • Namespace will follow the directories, ie. Cake\Cache\Engine\ApcEngine, Cake\Controller\Controller
  • View files don't need namespaces
  • Basic functions will not be namespaced as well
  • Use the class loader defined by the PHP Standard Group, see https://gist.github.com/562509
  • Suffixes will not be removed (ie. HtmlHelper will be Cake\View\Helper\HtmlHelper instead of Cake\View\Helper\Html)
  • Remove App::uses()
  • Remove filemap