Skip to content

Instantly share code, notes, and snippets.

@kenjis
kenjis / test-of-filemtime.md
Last active August 29, 2015 14:18
test of filemtime()
$ mkdir dir
$ touch dir/file
$ php -r 'echo filemtime("dir").PHP_EOL;'
1427934928
$ echo aaa > dir/file 
$ php -r 'echo filemtime("dir").PHP_EOL;'
1427934928
<?php
namespace Koriym\Work\Resource\App;
use BEAR\Resource\ResourceObject;
use Psr\Log\LoggerInterface;
use Ray\Di\Di\Inject;
class Add extends ResourceObject
{

There are not a few people who think "Laravel facade" is the same as GoF Facade design pattern, or came from it.

Laravel app class doesn't use static methods. It uses facade design pattern. http://www.sitepoint.com/php-dependency-injection-container-performance-benchmarks/#comment-1540329181

Fortunately, Taylor came up with the wonderful idea of Facade classes, named after the ‘Facade’ design pattern. http://daylerees.com/codebright/architecture

It uses Facade Design Pattern, when you call a static method, actually much more things happen behind the scene than it appears. Lets go through the life cycle of a static call. http://usman.it/laravel-4-uses-static-not-true/

diff --git a/composer.json b/composer.json
index e1b21ea..006ac5b 100644
--- a/composer.json
+++ b/composer.json
@@ -16,10 +16,14 @@
"forum": "http://fuelphp.com/forums"
},
"require": {
- "php": ">=5.3.3",
+ "php": ">=5.4",
@kenjis
kenjis / cakephp_2.2.2_core_tests.log
Created October 21, 2012 02:09
CakePHP 2.2.2 core AllTests Results
kenji@macbook:~/work/cakephp/cakephp-2.2.2/app$ Console/cake test core AllTests --coverage-html webroot/coverage
Welcome to CakePHP v2.2.2 Console
---------------------------------------------------------------
App : app
Path: /home/kenji/work/cakephp/cakephp-2.2.2/app/
---------------------------------------------------------------
CakePHP Test Shell
---------------------------------------------------------------
PHPUnit 3.7.1 by Sebastian Bergmann.
<?php
namespace foo;
define('FOO', 'FOO');
define('foo\FOO', 'foo\FOO');
var_dump(FOO);
var_dump(\FOO);
diff -urN original/META-INF/container.xml kobo-store/META-INF/container.xml
--- original/META-INF/container.xml 2012-09-07 23:42:28.000000000 +0900
+++ kobo-store/META-INF/container.xml 2012-09-07 23:28:52.000000000 +0900
@@ -1,6 +1,6 @@
-<?xml version="1.0"?>
+<?xml version='1.0' encoding='UTF-8'?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
- <rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>
+ <rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"></rootfile>
@kenjis
kenjis / CommitLog-fuel-core-1.2.1.txt
Created June 24, 2012 23:56
FuelPHP 1.2.1 Core Commit Log
commit 584355c307f0938d963b72fc6cd2c16991d88138
Merge: faff5ad 8f8344a
Author: WanWizard <[email protected]>
Date: Mon Jun 25 00:49:16 2012 +0200
Merge branch '1.2/develop' into 1.2/master
commit 8f8344a67e638ef3611f9f9164898555c101c545
Author: WanWizard <[email protected]>
Date: Mon Jun 25 00:48:20 2012 +0200
@kenjis
kenjis / fuelphp-1.2-and-1.2.1.diff
Created June 24, 2012 23:31
diff between FuelPHP 1.2 and 1.2.1
diff -urN fuelphp-1.2/docs/classes/arr.html fuelphp-1.2.1/docs/classes/arr.html
--- fuelphp-1.2/docs/classes/arr.html 2012-05-07 03:55:16.000000000 +0900
+++ fuelphp-1.2.1/docs/classes/arr.html 2012-06-25 05:36:50.000000000 +0900
@@ -108,7 +108,7 @@
<article>
<h4 class="method" id="method_to_assoc">to_assoc($arr)</h4>
- <p>The <strong>to_assoc</strong> method turns a non-associative array into an associative array if it has an even number of segments. If it has an odd number of segments it returns <kbd>null</kbd>.</p>
+ <p>The <strong>to_assoc</strong> method turns a non-associative array into an associative array if it has an even number of segments.</p>
<table class="method">
@kenjis
kenjis / _autocomplete.php
Created April 12, 2012 02:13
FuelPHP 1.2 helperfile for IDE code completion
<?php
class Asset_Instance extends Fuel\Core\Asset_Instance {}
class Cache_Handler_Json extends Fuel\Core\Cache_Handler_Json {}
class Cache_Handler_Serialized extends Fuel\Core\Cache_Handler_Serialized {}
class Cache_Handler_String extends Fuel\Core\Cache_Handler_String {}
class Cache_Storage_Apc extends Fuel\Core\Cache_Storage_Apc {}
abstract class Cache_Storage_Driver extends Fuel\Core\Cache_Storage_Driver {}
class Cache_Storage_File extends Fuel\Core\Cache_Storage_File {}
class Cache_Storage_Memcached extends Fuel\Core\Cache_Storage_Memcached {}