Skip to content

Instantly share code, notes, and snippets.

View ichikaway's full-sized avatar

Yasushi Ichikawa (ichikaway) ichikaway

View GitHub Profile
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
//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 "$@";
Global setup:
Download and install Git
git config --global user.name "Yasushi Ichikawa"
git config --global user.email [email protected]
Next steps:
mkdir vim
<?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'])) {
<?php
class AppModel extends Model {
//Validation message i18n
function invalidate($field, $value = true){
parent::invalidate($field, $value);
$this->validationErrors[$field] = __($value, true);
}
}
<?php
class AddValidationRuleBehavior extends ModelBehavior {
function maxLengthJP( &$model, $wordvalue, $length ) {
$word = array_shift($wordvalue);
return( mb_strlen( $word ) <= $length );
}
}