Skip to content

Instantly share code, notes, and snippets.

View nojimage's full-sized avatar

Takashi Nojima nojimage

View GitHub Profile
@nojimage
nojimage / FormHelperTest.php
Created April 15, 2016 13:33
cakephp issue8654 testcode
<?php
public function testUnlockMultipleFieldRemovingFromFields() {
$this->Form->request['_Token'] = array(
'key' => 'testKey',
'unlockedFields' => array()
);
$this->Form->create('Order');
$this->Form->hidden('Order.id', array('value' => 1));
$this->Form->checkbox('Ticked.id.');
@nojimage
nojimage / codeception.patch
Created March 8, 2016 03:18
codeception path fix for 2.1.5
diff --git a/vendor/codeception/codeception/src/Codeception/Lib/Parser.php b/vendor/codeception/codeception/src/Codeception/Lib/Parser.php
index 7e6987a..543b155 100644
--- a/vendor/codeception/codeception/src/Codeception/Lib/Parser.php
+++ b/vendor/codeception/codeception/src/Codeception/Lib/Parser.php
@@ -126,7 +126,7 @@ protected function addCommentStep($comment)
public static function validate($file)
{
- exec("php -l $file 2>&1", $output, $code);
+ exec("php -l '$file' 2>&1", $output, $code);
@nojimage
nojimage / NetBeansSuite.php
Created March 17, 2012 05:22
NetBeansからでもCakePHP2のFixtureを読み込むためのNetBeansSuite魔改造
<?php
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2010 Oracle and/or its affiliates. All rights reserved.
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* The contents of this file are subject to the terms of either the GNU
@nojimage
nojimage / users.css
Created January 10, 2014 10:05
MTAppjQueryでブログ記事編集画面のフィールドをグルーピングしてタブで表示する http://www.tinybeans.net/blog/download/mt-plugin/mtapp-jquery.html
.mtapp-tabs-navi li {
margin-right: 4px;
}
.mtapp-tabs-navi li.first-child {
margin-left: 0;
}
.mtapp-tabs-navi li a {
padding: 10px;
min-width: 6em;
color: #7B7C7D;
@nojimage
nojimage / phpunit.php
Last active December 29, 2015 10:19
netbeans custom phpunit script
#!/usr/bin/env php
<?php
$paths = array(
PHP_BINDIR,
'/usr/local/phpenv/shims',
getenv('PATH')
);
putenv('PATH=' . join(PATH_SEPARATOR, $paths));
array_shift($argv);
@nojimage
nojimage / users.po
Created November 18, 2013 04:28
CakePHP Users Plugin Japanese Language file
# LANGUAGE translation of CakePHP Application
# Copyright YEAR NAME <EMAIL@ADDRESS>
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2013-09-18 23:20+0200\n"
"PO-Revision-Date: 2013-11-18 13:21+0900\n"
"Last-Translator: nojimage <nojimage@gmail.com>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@nojimage
nojimage / gist:7212052
Created October 29, 2013 10:18
timecop拡張を入れていると、WebTestCase経由のテストでResponse::setLastModifiedが使えない問題の対処 ;)
<?php
// ...
if (!extension_loaded('timecop')) {
$response = $app->sendFile($file, 200, $headers);
} else {
// timecop hack
$response = new Symfony\Component\HttpFoundation\BinaryFileResponse($file, 200, $headers, false, null, false, false);
$date = \DateTime::createFromFormat('U', $response->getFile()->getMTime());
@nojimage
nojimage / bake-composer.sh
Last active December 25, 2015 18:49
ComposerでインストールしたCakePHPからプロジェクトを生成して、CAKE_CORE_INCLUDE_PATHの相対パス化とautoloaderの読込み。
#!/usr/bin/env bash
Vendor/bin/cake bake project --empty -v app
# replace include_path
replace="s/define('CAKE_CORE_INCLUDE_PATH',.*$/define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib');/"
sed -i .orig -e "$replace" app/webroot/index.php app/webroot/test.php
## # replace console path, if CakePHP < 2.5
@nojimage
nojimage / fixes-5.3.sh
Last active December 24, 2015 01:29
php-buildにおいて、php5.3系がビルドできないのを回避するbefore-installスクリプトsee: https://bugs.php.net/bug.php?id=48795
#!/bin/bash
# Fix the 64bit c++ patch for PHP5.3
# https://bugs.php.net/bug.php?id=48795
#
# install to {path_to_php-build}/share/php-build/before-install.d/
function version { echo "$@" | awk -F. '{ printf("%d.%d.%d\n", $1,$2,$3); }'; }
phpver=$(basename "`pwd`")
@nojimage
nojimage / mysqldump.php
Created August 20, 2013 09:49
mysqldump-php for php5.1 with mysql driver(Not PDO) original https://github.com/clouddueling/mysqldump-php
<?php
/*
* Database MySQLDump Class File
* Copyright (c) 2009 by James Elliott
* James.d.Elliott@gmail.com
* GNU General Public License v3 http://www.gnu.org/licenses/gpl.html
*
*/