[Homebrew] brew upgrade Warning: No developer tools installed. -> Run `xcode-select –install`

Mac OS X Mavericks で brew upgrade したらWarningでた。

% brew upgrade
Warning: No developer tools installed.
You should install the Command Line Tools.
Run `xcode-select --install` to install them.

xcode-select –install すればいいらしい。

% xcode-select --install
xcode-select: note: install requested for command line developer tools

[Android] Bootstrap や Font Awesome などのUIパーツを使える「Android-Bootstrap」

Android にて、Bootstrap や Font Awesome などのUIパーツを使える「Android-Bootstrap」が便利そうなのでご紹介します。

Bearded-Hen/Android-Bootstrap

Bootstrap style buttons with Font Awesome

Android-Bootstrap

Android標準のパーツで物足りないときに、アクセントとして使えそうですね。

プログラマー的には、これを使えばボタンデザインに悩まされることが減りそうなので嬉しいです。

[G Suite]「保留中のメッセージ」の機能をオフに設定する方法

G Suite (旧 Google Apps) のグループ機能で「保留中のメッセージ」をオフに設定する方法をサポートに問い合わせたので、その回答をご紹介します。

G Suite | Google Apps

続きを読む

[SEO] ページネーション対応

ページネーションの SEO についての参考情報をご紹介します。

Google、ページネーション問題を解決するrel=“next”タグとrel=“prev”タグをサポート開始 | 海外SEO情報ブログ

rel=“prev”とrel=“next”のページネーションにおける正しい使い方 | 海外SEO情報ブログ

Google SEO向けのページネーション最適化×9+1 | 海外SEO情報ブログ

rel=“prev” と rel=“next” をちゃんと設定しとけば、とりあえず OK という認識です。

ブラウザでCookieを編集する拡張機能 (Chrome, Firefox)

各種ブラウザでCookieを編集する拡張機能をメモ。

Chrome

Chrome ウェブストア – Edit This Cookie

Firefox

Firebug :: Add-ons for Firefox


参考情報

主要ブラウザでCookieを編集する方法 | Webトピッ

[Mac]「書類 xxx を開くためのアクセス権がありません。」の解決方法

Mac で「書類 xxx を開くためのアクセス権がありません。」というエラーメッセージが表示されたときの解決方法をメモ。

該当するファイルが1つだけだと、Finderから設定を変更すれば済むけど、ファイル数が膨大になるとキツイ。

そういう場合は、chmod コマンドでアクセス権限を一括変更すれば良い。

% chmod -R 777 ~/SomeFolder

参考情報

Mac OS X のアクセス権に関する問題のトラブルシューティング

アクセス権はあるのに画像を表示できません…: Apple サポートコミュニティ

[Github] Error creating pull request: Not Allowed (HTTP 405)

hub コマンドで github へプルリクエストを送ろうとしたらエラーが発生しました。

GitHub

続きを読む

Ruby on Rails4 + Mongoid + RSpec

Ruby on Rails4 + Mongoid + RSpec の環境構築メモ。

gem install rails --version 4.0.1
rails new myapp --skip-active-record --skip-test-unit
cd myapp
# Gemfile
gem 'mongoid', git: 'https://github.com/mongoid/mongoid.git'
rails g mongoid:config
      create  config/mongoid.yml
rails g rspec:install
% git diff
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 943bc19..9b7b0ef 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -13,6 +13,19 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
 ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
 
 RSpec.configure do |config|
+  ## Mongoid
+  config.before(:suite) do
+    DatabaseCleaner[:mongoid].strategy = :truncation
+  end
+
+  config.before(:each) do
+    DatabaseCleaner[:mongoid].start
+  end
+
+  config.after(:each) do
+    DatabaseCleaner[:mongoid].clean
+  end
+
   # ## Mock Framework
   #
   # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
@@ -22,12 +35,12 @@ RSpec.configure do |config|
   # config.mock_with :rr
 
   # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
-  config.fixture_path = "#{::Rails.root}/spec/fixtures"
+  # config.fixture_path = "#{::Rails.root}/spec/fixtures"
 
   # If you're not using ActiveRecord, or you'd prefer not to run each of your
   # examples within a transaction, remove the following line or assign false
   # instead of true.
-  config.use_transactional_fixtures = true
+  # config.use_transactional_fixtures = true
 
   # If true, the base class of anonymous controllers will be inferred
   # automatically. This will be the default behavior in future versions of
diff --git a/config/application.rb b/config/application.rb
index 7c9e566..9694074 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -4,7 +4,7 @@ require File.expand_path('../boot', __FILE__)
 # require "active_record/railtie"
 require "action_controller/railtie"
 require "action_mailer/railtie"
-require "sprockets/railtie"
+# require "sprockets/railtie"
 # require "rails/test_unit/railtie"
 
 # Require the gems listed in Gemfile, including any gems
diff --git a/config/initializers/mongoid.rb b/config/initializers/mongoid.rb
new file mode 100644
index 0000000..e400231
--- /dev/null
+++ b/config/initializers/mongoid.rb
@@ -0,0 +1 @@
+Mongoid.load!(Rails.root.to_s + "/config/mongoid.yml")

参考情報

Mongoid: Installation

Getting Started Rails 4 with MongoDB | Just Some More Dev Ideas

Using Mongoid with Rspec

Mongoid: Installation [Configuration]

[JavaScript] モバイルのタップイベントを高速化するライブラリ「fastclick.js」

モバイルのタップイベントを高速化するJavaScriptライブラリ「fastclick.js」が便利そうなのでメモ。

ftlabs/fastclick

スマートフォンwebのタップイベントを高速化するライブラリ"fastclick.js"をさわってみた – ushisantoasobu's blog

[Jade] partial is deprecated

Jade の最新版だと partial は廃止されてます。

partial 使ってもコードはレンダリングされない

extends layout
 
block content
  h1 Invoices:
  != partial("invoice")

Jade newest version doesn’t support partials. You might be following outdated tutorials. Please read up on jade documentation here

partial 使えないので mixin 使いましょう。


参考情報

node.js – Partial Not Defined in Jade – Stack Overflow