MinkiExtention 日本語の場合
https://github.com/Behat/MinkExtension/blob/2.0/i18n/ja.xliff
例
フィーチャ: ログイン シナリオ: ログインページが表示される 前提"/login" を表示している ならば"ログインしてください" と表示されていること
" の後に半角スペースが必要!!
<source><![CDATA[/^(?:|I )am on "(?P<page>[^"]+)"$/]]></source> <target><![CDATA[/^(?:|ユーザーは )"(?P<page>[^\s]+)" を表示している$/u]]></target> <source><![CDATA[/^(?:|I )go to "(?P<page>[^"]+)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )"(?P<page>[^\s]+)" へ移動する$/u]]></target> <source><![CDATA[/^(?:|I )reload the page$/]]></source> <target><![CDATA[/^(?:|ユーザーが )ページをリロードする$/u]]></target> <source><![CDATA[/^(?:|I )move backward one page$/]]></source> <target><![CDATA[/^(?:|ユーザーが )履歴の前のページに戻る$/u]]></target> <source><![CDATA[/^(?:|I )move forward one page$/]]></source> <target><![CDATA[/^(?:|ユーザーが )履歴の次のページヘ進む$/u]]></target> <source><![CDATA[/^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )"(?P<button>(?:[^"]|\\")*)" ボタンをクリックする$/u]]></target> <source><![CDATA[/^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )"(?P<link>(?:[^"]|\\")*)" のリンク先へ移動する$/u]]></target> <source><![CDATA[/^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )"(?P<field>(?:[^"]|\\")*)" フィールドに "(?P<value>(?:[^"]|\\")*)" と入力する$/u]]></target> <source><![CDATA[/^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )"(?P<value>(?:[^"]|\\")*)" という値を "(?P<field>(?:[^"]|\\")*)" に入力する$/u]]></target> <source><![CDATA[/^(?:|I )fill in the following:$/]]></source> <target><![CDATA[/^(?:|ユーザーが)次のように入力する:$/u]]></target> <source><![CDATA[/^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )"(?P<option>(?:[^"]|\\")*)" という値を "(?P<select>(?:[^"]|\\")*)" から選択する$/u]]></target> <source><![CDATA[/^(?:|I )additionally select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )"(?P<option>(?:[^"]|\\")*)" という値を "(?P<select>(?:[^"]|\\")*)" から追加で選択する$/u]]></target> <source><![CDATA[/^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )"(?P<option>(?:[^"]|\\")*)" にチェックをつける$/u]]></target> <source><![CDATA[/^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )"(?P<option>(?:[^"]|\\")*)" のチェックをはずす$/u]]></target> <source><![CDATA[/^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが)パス "(?P<path>[^"]*)" にあるファイルを "(?P<field>(?:[^"]|\\")*)" に添付する$/u]]></target> <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|画面に )"(?P<text>(?:[^"]|\\")*)" と表示されていること$/u]]></target> <source><![CDATA[/^the response should contain "(?P<text>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^レスポンスに "(?P<text>(?:[^"]|\\")*)" が含まれていること$/u]]></target> <source><![CDATA[/^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^(?:|画面に )"(?P<text>(?:[^"]|\\")*)" と表示されていないこと$/u]]></target> <source><![CDATA[/^the response should not contain "(?P<text>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^レスポンスに "(?P<text>(?:[^"]|\\")*)" が含まれていないこと$/u]]></target> <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^"(?P<field>(?:[^"]|\\")*)" フィールドに "(?P<value>(?:[^"]|\\")*)" が含まれていること$/u]]></target> <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^"(?P<field>(?:[^"]|\\")*)" フィールドに "(?P<value>(?:[^"]|\\")*)" が含まれていないこと$/u]]></target> <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/]]></source> <target><![CDATA[/^チェックボックス "(?P<checkbox>(?:[^"]|\\")*)" のチェックがついていること$/u]]></target> <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should not be checked$/]]></source> <target><![CDATA[/^チェックボックス "(?P<checkbox>(?:[^"]|\\")*)" のチェックがはずれていること$/u]]></target> <source><![CDATA[/^(?:|I )should be on "(?P<page>[^"]+)"$/]]></source> <target><![CDATA[/^(?:|ユーザーが )(?P<page>[^\s]+) を表示していること$/u]]></target> <source><![CDATA[/^the (?i)url(?-i) should match (?P<pattern>"([^"]|\\")*")$/]]></source> <target><![CDATA[/^(?i)url(?-i)が (?P<pattern>"([^"]|\\")*") にマッチすること$/u]]></target> <source><![CDATA[/^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source> <target><![CDATA[/^"(?P<element>[^"]*)" エレメントに "(?P<value>(?:[^"]|\\")*)" という値が含まれていること$/u]]></target> <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)" in the "(?P<element>[^"]*)" element$/]]></source> <target><![CDATA[/^"(?P<element>[^"]*)" エレメントに "(?P<text>(?:[^"]|\\")*)" と表示されていること$/u]]></target> <source><![CDATA[/^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)" in the "(?P<element>[^"]*)" element$/]]></source> <target><![CDATA[/^"(?P<element>[^"]*)" エレメントに "(?P<text>(?:[^"]|\\")*)" と表示されていないこと$/u]]></target> <source><![CDATA[/^(?:|I )should see an? "(?P<element>[^"]*)" element$/]]></source> <target><![CDATA[/^(?:|画面に )"(?P<element>[^"]*)" エレメントが表示されていること$/u]]></target> <source><![CDATA[/^(?:|I )should not see an? "(?P<element>[^"]*)" element$/]]></source> <target><![CDATA[/^(?:|画面に )"(?P<element>[^"]*)" エレメントが表示されていないこと$/u]]></target> <source><![CDATA[/^(?:|I )should see (?P<num>\d+) "(?P<element>[^"]*)" elements?$/]]></source> <target><![CDATA[/^(?:|画面に )(?P<num>\d+) 個の "(?P<element>[^"]*)" エレメントが表示されていること$/u]]></target> <source><![CDATA[/^the response status code should be (?P<code>\d+)$/]]></source> <target><![CDATA[/^レスポンスコードが (?P<code>\d+) であること$/u]]></target> <source><![CDATA[/^the response status code should not be (?P<code>\d+)$/]]></source> <target><![CDATA[/^レスポンスコードが (?P<code>\d+) ではないこと$/u]]></target> <source><![CDATA[/^print last response$/]]></source> <target><![CDATA[/^最後のレスポンスを表示$/u]]></target> <source><![CDATA[/^show last response$/]]></source> <target><![CDATA[/^最後のレスポンスをブラウザで表示$/u]]></target> <source><![CDATA[/^(?:|I )should see text matching (?P<pattern>"(?:[^"]|\\")*")$/]]></source> <target><![CDATA[/^(?:|画面に )"(?P<pattern>"(?:[^"]|\\")*")" にマッチするテキストが表示されていること$/u]]></target> <source><![CDATA[/^(?:|I )should not see text matching (?P<pattern>"(?:[^"]|\\")*")$/]]></source> <target><![CDATA[/^(?:|画面に )"(?P<pattern>"(?:[^"]|\\")*")" にマッチするテキストが表示されていないこと$/u]]></target>
日本語の場合
https://github.com/cucumber/cucumber/wiki/Spoken-languages
name | Japanese |
native | 日本語 |
encoding | UTF-8 |
space_after_keyword | |
feature | フィーチャ / 機能 |
background | 背景 |
scenario | シナリオ |
scenario_outline | シナリオアウトライン / シナリオテンプレート / テンプレ / シナリオテンプレ |
examples | 例 / サンプル |
given | 前提 |
when | もし |
then | ならば |
and | かつ |
but | しかし / 但し / ただし |
% behat -dl --lang ja % cucumber --i18n ja
Xcode color theme 保存場所
% ls -l ~/Library/Developer/Xcode/UserData/FontAndColorThemes/
gitのリポジトリをsubversion用に変換
とりあえず、gitレポジトリは、git-flowで運用前提
% git svn clone svn://path/to/repo -T trunk -t tags -b branches --prefix=svn/
% cd repo % git remote add org git@git.example.com:/path/to/repo.git % git fetch org
org/developをcheckoutしてmasterをrebase
% git checkout -b develop org/develop % git rebase master
CONFLICT対応 (ToT)
masterにdevelopをマージしてsvn側にコミット
% git checkout master % git merge develop % git svn dcommit
mongodbまわり設定
MapReduceのoutputオプションのinline指定は、処理結果が16MB以内でないと使えない
インストール
% brew install mongodb
パスワード等の設定
% mongo > use admin > db.addUser('root', [root's password]) 確認 > db.system.users.find() > exit
各DB毎のユーザ設定
% mongo > use hogehoge > db.addUser('hoge', 'moge') 確認 > db.system.users.find() > exit
接続方法
% mongo hogehgoe -u hoge -p
認証機能の有効化
mongod.confの
#auth = true
のコメントを外すか、追加してmongodbを再起動
または、起動オプションに -auth をつける
pecl mongo
http://jp1.php.net/manual/ja/mongo.installation.php
% sudo pecl install mongo
php.iniに以下を追加
extension=mongo.so
確認
% php -i |grep mongo
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); _.each(json, function(value, name) { _.isFunction(value.toJSON) && (json[name] = value.toJSON()); }); this._isSerializing = false; return json; }; var Dish = Backbone.Model.extend({}); var Dinner = Backbone.Collection.extend({ model: Dish }); var Ingredient = Backbone.Model.extend({}); var Ingredients = Backbone.Collection.extend({ model: Ingredient }); var dinner = new Dinner([{ name: 'Green pepper steak', ingredients: new Ingredients([{ name: 'Green pepper', amount: 2 }, { name: 'beef', amount: 4 }]) }, { name: 'Rice', ingredients: new Ingredients([{ name: 'Brown rice', amount: 8 }]) }]); console.log(dinner.toJSON()); console.log(JSON.stringify(dinner.toJSON()));