Skip to content

Instantly share code, notes, and snippets.

View ichikaway's full-sized avatar

Yasushi Ichikawa (ichikaway) ichikaway

View GitHub Profile
@ichikaway
ichikaway / CircleCI-VAddy-sample.yml
Last active August 29, 2015 14:10
CircleCI-VAddy-sample
test:
override:
- ./test.sh
deployment:
staging:
branch: master
commands:
- ./deploy.sh
- git clone git@github.com:vaddy/vaddy-api-ruby.git && rvm use 2.1.0 && cd ./vaddy-api-ruby/ && ruby vaddy.rb
- ./deploy2.sh
@ichikaway
ichikaway / gist:e20450fe1910f760c613
Last active August 29, 2015 14:21
VAddy Codeship Config Sample
./unit-test.sh
./deploy-staging.sh
git clone git@github.com:vaddy/vaddy-api-ruby.git && cd ./vaddy-api-ruby && ruby vaddy.rb && cd ../
./deploy-production.sh
<?php
class AddValidationRuleBehavior extends ModelBehavior {
function maxLengthJP( &$model, $wordvalue, $length ) {
$word = array_shift($wordvalue);
return( mb_strlen( $word ) <= $length );
}
}
<?php
class AppModel extends Model {
//Validation message i18n
function invalidate($field, $value = true){
parent::invalidate($field, $value);
$this->validationErrors[$field] = __($value, true);
}
}
<?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'])) {
Global setup:
Download and install Git
git config --global user.name "Yasushi Ichikawa"
git config --global user.email ichikaway@gmail.com
Next steps:
mkdir vim
//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="ichikaway@gmail.com";
GIT_AUTHOR_EMAIL="ichikaway@gmail.com";
git commit-tree "$@";
GitでSSHを使ってbackup用リモートリポジトリを作ってpush
リモートリポジトリ作成
mkdir ./repo/hoge.git
git --bare --git-dir=./repo/hoge.git init
ローカルリポジトリのgit remoteを追加
git remote add origin ssh://git@git.intranet/home/git/repo/hoge.git
git push
<?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:{}}';
<?php
//private property injection, don't use unserialize() to user input data
class Foo {
public $var1 = '';
protected $var2 = '';
private $var3 = '';
public function __construct() {