This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach (range(1, 10) as $n) { | |
echo "calculating $n connection...\n"; | |
$c = new Connection($n, $n === 1 ? null : $c); | |
echo 'got answer. connection patterns: ', count($c->answers), "\n"; | |
} | |
class Connection { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!empty($this->params['path'])) { | |
$path = $this->params['path']; | |
$type = array_shift($path); | |
$types = array('origin', 'incomplete', 'review'); | |
$types = array_diff($types, array($type)); | |
$moveTo = '<h4>' . __('Move to', true) . '</h4>'; | |
$copyTo = '<h4>' . __('Copy to', true) . '</h4>'; | |
$this->Menu->add('actions', $moveTo, false, null, array('escapeTitle' => false)); | |
$this->Menu->add('actions', $copyTo, false, null, array('escapeTitle' => false)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StaticClass { | |
function hoge() { | |
echo 'hoge'; | |
} | |
function piyo() { | |
echo 'piyo'; | |
} | |
} | |
foreach (array('hoge', 'piyo') as $name) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class WebrootController extends AppController { | |
var $uses = null; | |
var $_ext = '.php'; | |
function show() { | |
$path = func_get_args(); | |
$path = implode(DS, $path); | |
if (in_array($path, array('index', 'css', 'test'))) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once CAKE_TESTS_LIB . 'cake_fixture_manager.php'; | |
class AppFixtureManager extends CakeFixtureManager { | |
public function fixturize(CakeTestCase $test) { | |
$this->_autoLoadFixtures($test); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AppController extends Controller { | |
var $uses = array('Service'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ArticlesController extends AppController { | |
function add() { | |
if (!empty($this->data)) { | |
if ($this->Service->transaction()->saveNewArticle($this->data)) { | |
$this->Session->setFlash(__('Article has been saved.', true)); | |
$this->redirect(array('action' => 'index')); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Service { | |
function addArticle($data) { | |
$this->Transaction->begin(); | |
if (!$this->Article->save($this->Article->create($data))) { | |
$this->Transaction->begin(); | |
return false; | |
} | |
$this->Transaction->commit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Model\Entity; | |
use Cake\ORM\Entity; | |
use Cake\Auth\DefaultPasswordHasher; | |
/** | |
* SiteAdminUser Entity. | |
* | |
* @property int $id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript">(function () { $.ajax({type: "GET", url: "http://tepco-usage-api.appspot.com/latest.json", dataType: "jsonp", success: function (data) { document.write(parseInt(100 * data.usage/data.capacity) + "%"); } }); })(); </script> |
OlderNewer