Berkshelfのバージョンが上がったらエラー

% bundle exec berks --version 3.1.4 % bundle exec knife solo cook vagrant Running Chef on vagrant-chef... Checking Chef version... Installing Berkshelf cookbooks to 'cookbooks'... ERROR: ArgumentError: wrong number of arguments (1 for 0)以…

CentOS6.5のPHPのバージョン

$ cat /etc/redhat-release CentOS release 6.5 (Final) $ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm$ yum info php | grep Version | awk '{print $3}' 5.3.3$ yum --enablerepo=remi info php | grep Version | awk '{p…

シェルで拡張子変更

sh

markdown を md に変更してみる % for i in *.markdown; do mv $i ${i%markdown}md; done

syntasticでperlのsyntaxcheckが動かなくなった件

RTFC 3.4.0 Syntax checker changes: Disable the perl checker by default, for security reasons (lcd047) https://github.com/scrooloose/syntastic/wiki/Changelog https://github.com/scrooloose/syntastic/wiki/Perl%3A---perl#security let g:syntast…

Alignta 空白で整列

vim

GitHub - h1mesuke/vim-alignta: Align Them All! :'<,'>Alignta <<0 \ /2選択範囲内をマージンをとらず、2つめの空白で整列 before color main-head blue default bold color main-tag yellow default bold color main-local-tag yellow default color main…

別ウィンドウでman表示

RTFM bind-key / command-prompt "split-window -p 60 'exec man %%'"

cli実行時にerror_reportingの設定を渡す

php

% /path/to/php -d error_reporting=6135 /path/to/legacy.php

gitで複数のauthor, committerの使い分け

git

環境変数で設定すっと上書きしてくれる % git config --help user.email Your email address to be recorded in any newly created commits. Can be overridden by the GIT_AUTHOR_EMAIL, GIT_COMMITTER_EMAIL, and EMAIL environment variables. See git-co…

The Platinum Searcher

Go言語でag(The Silver Searcher)ライクな高速検索ツールをつくった。EUC-JP/Shift-JISも検索できマス。 · THINKING MEGANEダウンロードしたバイナリが動かなかったのでビルドしてみる とりあえず、GOPATH は適当。 % brew install go % export GOPATH=~/src…

Mavericksでphp5.2.17コンパイルエラー

make: *** [ext/dom/node.lo] Error 1libxml2まわりの不具合の模様 https://mail.gnome.org/archives/xml/2012-August/msg00028.html https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txthttps://gist.github.com/oppara/8281560 % cd /path…

モデルのスタブ

getMockBuilder('Post') ->setConstructorArgs(array(false, 'posts', 'test')) ->setMethods(array('doSomething')) ->getMock(); $stub->expects($this->any()) ->method('doSomething') ->will($this->returnValue('foo'));

ipアドレスを取得

cmd

centos $ ifconfig eth0 | grep -v inet6 | grep inet | awk '{print $2;}' | cut -f2 -d ':'osx % ifconfig en0 | grep -v inet6 | grep inet | awk '{print $2;}'

JenkinsでCakeBehat

Behat/Minkのテストはブラウザでアクセスされるので、テスト時はtestデータソースを使用するように工夫が必要。 The Opera blog あと、アクセス先のテスト用DBの初期化、後始末が必要。も一つ、ciサーバ内で完結するなら、ciサーバ上でのwebサーバ設定が必要…

CakeBehat

https://github.com/oppara/CakeBehat もろもろ動かなかったのでとりあえずフォーク インストールとか 直の場合 % cd /path/to/cake_root/app/Plugin % git clone https://github.com/oppara/CakeBehat.gitsubmoduleの場合 % cd /path/to/cake_root % git su…

MinkiExtention 日本語の場合

https://github.com/Behat/MinkExtension/blob/2.0/i18n/ja.xliff例 フィーチャ: ログイン シナリオ: ログインページが表示される 前提"/login" を表示している ならば"ログインしてください" と表示されていること " の後に半角スペースが必要!! <source>[^"]+)"$/]</source>…

日本語の場合

https://github.com/cucumber/cucumber/wiki/Spoken-languages name Japanese native 日本語 encoding UTF-8 space_after_keyword feature フィーチャ / 機能 background 背景 scenario シナリオ scenario_outline シナリオアウトライン / シナリオテンプレ…

Xcode color theme 保存場所

% ls -l ~/Library/Developer/Xcode/UserData/FontAndColorThemes/

gitのリポジトリをsubversion用に変換

とりあえず、gitレポジトリは、git-flowで運用前提 git-svnで、svnリポジトリを取得 % git svn clone svn://path/to/repo -T trunk -t tags -b branches --prefix=svn/ gitのリポジトリをgit-svn のリモートとして登録 % cd repo % git remote add org git@g…

mongodbまわり設定

MapReduceのoutputオプションのinline指定は、処理結果が16MB以内でないと使えない インストール % brew install mongodb パスワード等の設定 % mongo > use admin > db.addUser('root', [root's password]) 確認 > db.system.users.find() > exit各DB毎のユ…

html文字列のあたまに空白があるとjQueryオブジェクトの作成に失敗する

var s = ' <div></div>'; console.log($($.trim(s))); console.log($(s)); // Uncaught Error: Syntax error, unrecognized expression: <div></div>

再帰的なtoJSON()

http://www.shesek.info/web-development/recursive-backbone-models-tojson Backbone.Model.prototype.toJSON = function() { if (this._isSerializing) { return this.id || this.cid; } this._isSerializing = true; var json = _.clone(this.attributes)…

Set::extract()

http://book.cakephp.org/2.0/en/core-utility-libraries/set.html Deprecated since version 2.2: The Set class has been deprecated in 2.2 in favour of the Hash class. It offers a more consistent interface and API.

ブラウザのコンソールでxpath確認

$x('//div[@id="hoge"]')

gitのtag

git

// タグ付け % git tag -a TAG_NAME % git tag -a TAG_NAME -m 'message' // タグ一覧 % git tag -l // タグをリモートにpush % git push origin TAG_NAME // ローカルのタグをすべてサーバにpushする % git push --tags % git push origin --tags // 削除 %…

tar.xz

前準備 % brew install xz % brew install gnu-tar圧縮、解凍 % gtar Jcvf hoge.tar.xz hoge/ % gtar Jxvf hoge.tar.xz

httpdのSELinux対応

環境:Cent OS 6.2 デフォルトと違うDocumentRootにアクセスできるようにする $ ls -Z /srv/httpd/ $ sudo chcon system_u:object_r:httpd_sys_content_t /srv/httpd -Rhttpd経由でDBにアクセスするようにする $ sudo getsebool -a | grep httpd $ sudo sets…

/home が削除できない件

osx

% sudo rm -rf /home rm: home: Resource busy% sudo vi /etc/auto_master #/home auto_home -nobrowse % sudo umount /home % sudo rm -rf /home % sudo mkdir /home http://install-climber.blogspot.jp/2011/10/machomedirresourcebusyinputoutputerror.h…

行のコピー

vim

Long-range line duplication " 9行目を16行目にコピー :9t16 " 9行目を現在行にコピー :9t.

Selenium RCで自己署名証明書(SSL)のテスト

% sudo java -jar /path/to/selenium-server-standalone.jar -interactive -trustAllSSLCertificates

誕生日から年齢、世代を求める

php