[RVM] .rvmrc から .ruby-version と .ruby-gemset に移行すべき

RVM で .rvmrc ファイルで Ruby のバージョンと gemset を切り替えていたのですが、今だとWarningメッセージが表示されるんですね。

You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to [.]ruby-version'
or ignore this warnings with 'rvm rvmrc warning ignore /Users/your_username/git/myapp/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
 
Using /Users/your_username/.rvm/gems/ruby-2.0.0-p247 with gemset myapp

どうやら、これからはRubyのバージョン管理システム(rvm, rbenv, rbfu)で設定ファイルを統一する動きがあったそうで、下記のように .ruby-version と .ruby-gemset に分割しておいた方がよさそうです。

.rvmrc ファイル

rvm use ruby-2.0.0-p247@mygemset

↓ .rvmrc を2ファイルに分割します。

.ruby-version ファイル

ruby-2.0.0-p247

.ruby-gemset ファイル

mygemset

もちろん、従来の .rvmrc ファイルも使えるので、その場合、警告を無視するには下記のコマンドを実行すればOKです。

rvm rvmrc warning ignore all.rvmrcs

参考情報

Use rvmrc or ruby-version file to set a project gemset with RVM? – Stack Overflow

.rvmrcから.ruby-gemsetと.ruby-versionに移行 – Qiita [キータ]

Rubyバージョン管理界にも統一球導入?

[Mac] PHP5.4 を Homebrew でインストール

Mac に PHP5.4 を Homebrew でインストールしたのでメモ。

デフォルトでは、PHPのFormulaは無いので、homebrew-phpを使ってインストールします。

brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php

PHP5.4 のインストールオプションを確認します。

% brew options php54
--32-bit
	Build 32-bit only.
--homebrew-apxs
	Build against apxs in Homebrew prefix
--with-cgi
	Enable building of the CGI executable (implies --without-apache)
--with-debug
	Compile with debugging symbols
--with-fpm
	Enable building of the fpm SAPI executable (implies --without-apache)
--with-gmp
	Build with gmp support
--with-homebrew-openssl
	Include OpenSSL support via Homebrew
--with-imap
	Include IMAP extension
--with-intl
	Include internationalization support
--with-libmysql
	Include (old-style) libmysql support
--with-mssql
	Include MSSQL-DB support
--with-pgsql
	Include PostgreSQL support
--with-thread-safety
	Build with thread safety
--with-tidy
	Include Tidy support
--with-unixodbc
	Build with unixodbc support
--without-apache
	Build without shared Apache 2.0 Handler module
--without-bz2
	Build without bz2 support
--without-mysql
	Remove MySQL/MariaDB support
--without-pear
	Build without PEAR
% brew install php54 \
> --with-fpm \
> --with-homebrew-openssl \
> --with-intl \
> --with-pgsql
 
...
 
==> make install
==> /usr/local/Cellar/php54/5.4.16/bin/pear config-set php_ini /usr/local/etc/php/5.4/php.ini
==> Caveats
The php.ini file can be found in:
    /usr/local/etc/php/5.4/php.ini
 
✩✩✩✩ PEAR ✩✩✩✩
 
If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
    chmod -R ug+w /usr/local/Cellar/php54/5.4.16/lib/php
    pear config-set php_ini /usr/local/etc/php/5.4/php.ini
 
✩✩✩✩ Extensions ✩✩✩✩
 
If you are having issues with custom extension compiling, ensure that this php is
in your PATH:
    PATH="$(brew --prefix josegonzalez/php/php54)/bin:$PATH"
 
PHP54 Extensions will always be compiled against this PHP. Please install them
using --without-homebrew-php to enable compiling against system PHP.
 
✩✩✩✩✩ INTL Support ✩✩✩✩✩
 
icu4c is broken as of mxcl/homebrew#03ed757c, so you will need to install intl as
a separate extension:
 
    brew install php54-intl
 
✩✩✩✩ FPM ✩✩✩✩
 
To launch php-fpm on startup:
    * If this is your first install:
        mkdir -p ~/Library/LaunchAgents
        cp /usr/local/Cellar/php54/5.4.16/homebrew-php.josegonzalez.php54.plist ~/Library/LaunchAgents/
        launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php54.plist
 
    * If this is an upgrade and you already have the homebrew-php.josegonzalez.php54.plist loaded:
        launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php54.plist
        cp /usr/local/Cellar/php54/5.4.16/homebrew-php.josegonzalez.php54.plist ~/Library/LaunchAgents/
        launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php54.plist
 
The control script is located at /usr/local/Cellar/php54/5.4.16/sbin/php54-fpm
 
Mountain Lion comes with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH:
 
  PATH="/usr/local/sbin:$PATH"
 
You may also need to edit the plist to use the correct "UserName".
 
Please note that the plist was called 'org.php-fpm.plist' in old versions
of this formula.
 
To have launchd start php54 at login:
    ln -sfv /usr/local/opt/php54/*.plist ~/Library/LaunchAgents
Then to load php54 now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php54.plist
Warning: /usr/local/sbin is not in your PATH
You can amend this by altering your ~/.bashrc file
==> Summary
/usr/local/Cellar/php54/5.4.16: 490 files, 38M, built in 5.1 minutes

Pear の設定

% chmod -R ug+w /usr/local/Cellar/php54/5.4.16/lib/php
% pear config-set php_ini /usr/local/etc/php/5.4/php.ini
config-set succeeded

php54-intl のインストール

% brew install php54-intl

[Node.js] 逆引きメモ

Node.js で「あれしたい」というときに振り返る逆引きメモ。

JavaScriptだけに限ったことは、別にまとめてます。

[JavaScript] 逆引きメモ | CodeNote.net


ファイル File

ファイルが存在するかを調べる。

var path = require("path");
path.existsSync("/tmp/upload/some_file.txt");

エラー処理

Node and Test – badatmath/jsdojo

メール配信サービスまとめ (MailChimp, Mad Mimi)

メルマガなどの用途で、HTMLメールを配信できるサービスをまとめてみました。

とりあえず、リンクをメモ。

Send Better Email | MailChimp

Mad Mimi Email Marketing : Create, Send, And Track HTML Email Newsletters

「Path」のTシャツをもらったよ!

Path」のTシャツをもらいました!

path-t-shirt1

path-t-shirt2

Mサイズだとかなりデカめだったので、Sサイズにしました。

アメリカンサイズでかい。

[WordPress] 管理画面の言語設定をユーザ毎に日本語・英語にカンタンに切り替えられるプラグイン「Bogo」

WordPressの管理画面の言語設定を、ユーザ毎に日本語・英語にカンタンに切り替えられるプラグイン「Bogo」が便利だったので、ご紹介します。

WordPress | ワードプレス

続きを読む

[CoffeeScript] @ と => で that = this を無くす

ここを読むんだ!

CoffeeScriptの@について再び | ひげろぐ

[Stripe] Refund のキャンセル/取り消し処理について

Stripeで、Refund のキャンセル/取り消しをする方法をメモ。

Refunds can’t be cancelled. If you’d like to charge your customer for the amount that you have refunded, you can create a new charge for your customer.
If the card that you have refunded is expired or cancelled, the customer’s new card will be credited with the refund. In the rare case that the customer doesn’t have a new card, the bank will usually send the refund to the customer’s bank account.
In the worst case, the bank won’t know what to do, and will send the refund back to us, at which point we’ll contact you via email to ask how you would like to handle the refund.

結論から書くと、Refund のキャンセル処理はできないらしい。

代わりに、Stripeの管理画面から「Create Payment」経由で、新たに Payment を作成することができるので、これを使って、Refundした金額を新たに請求すれば良さそうだ。

参考情報

Can I cancel a refund? : Stripe: Help & Support

[Jade] each で要素だけでなく index も取得する

テンプレートエンジン Jade の each で現在のループ回数 index を取得する方法をメモ。

each item, index in list
  li= item
  if index === 1
    | : First item in list!

参考情報

node.js – Jade template engine – Each Iteration Offset – Stack Overflow

[WordPress] wp-cron を無効化する

WordPress で、wp-cron を無効化するには wp-config.php に下記のコードを追記するだけでOKです。

WordPress | ワードプレス

define('DISABLE_WP_CRON', true);