Skip to content

Instantly share code, notes, and snippets.

View AD7six's full-sized avatar
:shipit:
Busy shippin'

Andy Dawson AD7six

:shipit:
Busy shippin'
View GitHub Profile
// Render the inputs, except id
echo $this->Form->inputs(
array(
'id' => false,
'name' => array(
...
)
),
array(
<div class="row">
<div class="col-lg-6">
<?php
echo $this->Form->create($x->createModel(), $x->options());
echo $this->Form->inputs($fields->inputs(), $nulll, fields->options());
$buttons = $x->buttons();
foreach($buttons as $button) {
echo $this->Form->submit($button->name(), $button->options());
<?php
App::uses('AppController', 'Controller');
class CountriesController extends AppController {
public $components = array('Paginator');
public function view($id = null) {
if (!$id) {
root @ dev [ /var/www/cakephp.dev/htdocs/app/webroot ] (master $%=)
-> cat infinite.php
<?php
echo ini_get('error_log') . "\n";
function recurse() {
return recurse();
}
recurse();
<?php
$formatter = function($entity) use ($preferredlanguage, $translatedFields) {
foreach ($entity->translations as $translation) {
if ($translation->locale === $preferredlanguage) {
$field = $translation->get('field');
$value = $translation->get('value');
$entity->set($field, $value);
}
}
air:cakephp andy$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'debian7-bownty-21052013'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
@AD7six
AD7six / layout.ctp
Last active December 25, 2015 04:09
<head>
...
<script>
APP = <?= json_encode(array('user' => Auth::user())); ?>;
</script>
</head>
<body>
...
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-1.10.2.min.js"><\/script>')</script>
@AD7six
AD7six / cake-only.json
Last active December 22, 2015 15:29
how much extra time does adding phpunit to composer add?
{
"name": "friendsofcake/app-template",
"description": "An empty CakePHP 2.4 application",
"type": "project",
"keywords" : [],
"homepage" : "http://cakephp.org",
"license" : "MIT",
"require" : {
"php" : ">=5.4",
"composer/installers" : "~1.0",
@AD7six
AD7six / bench.php
Created August 15, 2013 09:36
Is is_null still slow?
<?php
$null = null;
$notNull = 123;
$is_null = function($value) {
for($i = 0; $i < 1000000; $i++) {
$result = is_null($value);
}
return "is_null";
};
-> grep -r "version_compare([^,]*,[^,]*)" *
lib/Cake/Utility/File.php: if ($all === false && version_compare(PHP_VERSION, '5.3.0') >= 0) {
lib/Cake/Utility/Debugger.php: if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
lib/Cake/Console/Command/ServerShell.php: if (version_compare(PHP_VERSION, '5.4.0') < 0) {
lib/Cake/Test/Case/Utility/DebuggerTest.php: if (version_compare(PHP_VERSION, '5.3.0') >=