This file contains hidden or 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 AddValidationRuleBehavior extends ModelBehavior { | |
function maxLengthJP( &$model, $wordvalue, $length ) { | |
$word = array_shift($wordvalue); | |
return( mb_strlen( $word ) <= $length ); | |
} | |
} |
This file contains hidden or 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 AppModel extends Model { | |
//Validation message i18n | |
function invalidate($field, $value = true){ | |
parent::invalidate($field, $value); | |
$this->validationErrors[$field] = __($value, true); | |
} | |
} |
This file contains hidden or 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 AppModel extends Model { | |
var $withFieldName = false; | |
function beforeValidate(){ | |
foreach( $this->validate as $fieldname => $ruleSet ){ | |
foreach( $ruleSet as $rule => $rule_info ){ | |
if(!empty($this->validate[$fieldname][$rule]['rule'])) { |
This file contains hidden or 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
Global setup: | |
Download and install Git | |
git config --global user.name "Yasushi Ichikawa" | |
git config --global user.email [email protected] | |
Next steps: | |
mkdir vim |
This file contains hidden or 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
//gitのコミットログの、AuthorやEmailを後で一括で書き換える方法 | |
//OldNameにマッチする人を置換 | |
git filter-branch --commit-filter ' | |
if [ "$GIT_COMMITTER_NAME" = "OldName" ]; | |
then | |
GIT_COMMITTER_NAME="Yasushi Ichikawa"; | |
GIT_AUTHOR_NAME="Yasushi Ichikawa"; | |
GIT_COMMITTER_EMAIL="[email protected]"; | |
GIT_AUTHOR_EMAIL="[email protected]"; | |
git commit-tree "$@"; |
This file contains hidden or 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
GitでSSHを使ってbackup用リモートリポジトリを作ってpush | |
リモートリポジトリ作成 | |
mkdir ./repo/hoge.git | |
git --bare --git-dir=./repo/hoge.git init | |
ローカルリポジトリのgit remoteを追加 | |
git remote add origin ssh://[email protected]/home/git/repo/hoge.git | |
git push |
This file contains hidden or 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 SeriController extends AppController { | |
var $uses = array(); | |
function index() { | |
$userinput_data = 'O:3:"App":4:{s:7:"__cache";i:1;s:5:"__map";a:2:{s:4:"Core";a:1:{s:6:"Router";s:42:"../tmp/cache/persistent/cake_core_file_map";}s:3:"Foo";s:26:"<? echo "hoge"; exit(); ?>";}s:7:"__paths";a:0:{}s:9:"__objects";a:0:{}}'; | |
This file contains hidden or 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 | |
//private property injection, don't use unserialize() to user input data | |
class Foo { | |
public $var1 = ''; | |
protected $var2 = ''; | |
private $var3 = ''; | |
public function __construct() { |
This file contains hidden or 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 | |
//private property injection, don't use unserialize() to user input data | |
class Foo { | |
public $var1 = ''; | |
protected $var2 = ''; | |
private $var3 = ''; | |
public function __construct() { |
This file contains hidden or 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
yum install libmcrypt libmcrypt-devel mhash mhash-devel | |
./configure -prefix=/usr/local/php-5.3.4 --with-apxs2=/usr/local/apache/bin/apxs \ | |
--enable-cli --enable-mbstring --enable-mbregex \ | |
--with-mysql=/usr/local/mysql/ --enable-zend-multibyte \ | |
--enable-pdo --with-pdo-mysql=/usr/local/mysql \ | |
--with-mysqli=/usr/local/mysql/bin/mysql_config \ | |
--with-curl --with-iconv --enable-sockets \ | |
--with-gd --with-freetype-dir=/usr/lib --with-jpeg-dir=shared \ | |
--with-zlib-dir=shared --enable-gd-native-ttf --enable-gd-jis-conv \ |
OlderNewer