うちのいぬ Tech Blog

Tech Blog of Uchinoinu/My dog

2015-01-01から1年間の記事一覧

Crafting Rails 4 Applications - capter 1-3 - Understanding the Rails Rendering Stack

こちらの続きです。 Crafting Rails 4 Applications - capter 1-2 - Writing the Renderer - Satomi's Daily Notestsumekoara.hateblo.jp 1-3. Rails Rendering Stackを理解する Action MailerとAction Controller はいくつかの共通機能を持っています。例え…

Crafting Rails 4 Applications - capter 1-4 - Talking It to the Next Level

こちらの記事の続きです。 Crafting Rails 4 Applications - capter 1-3 - Understanding the Rails Rendering Stack - Satomi's Daily Notestsumekoara.hateblo.jp 1.4 次のレベルへ rendererの実装に話を戻します。以下の様なcontrollerでないが起きるか勉…

Crafting Rails 4 Applications - capter 1-5 - Wrapping Up

こちらの記事の続きです。 Crafting Rails 4 Applications - capter 1-4 - Talking It to the Next Level - Satomi's Daily Notestsumekoara.hateblo.jp 1.5 まとめ この章ではPDFフォーマット用のrendererを作りました。このアイデアを使えば、csvやatomと…

Introduction: PART 1: Generate Project using template. Watch app at localhost, iOS simulator, heroku

Condition Yosemite Install read: http://ionicframework.com/getting-started/ $ npm install -g cordova ionic Select Project Template read: http://ionicframework.com/getting-started/ $ ionic start myApp sidemenu run ionic command localhost $ …

Crafting Rails 4 Applications - capter 1-2 - Writing the Renderer

↓のつづきです。 Crafting Rails 4 Applications - capter 1-1 - Satomi's Daily Notestsumekoara.hateblo.jp 1.2 Rendererを書く まずはじめに、render()メソッドと許容されるいくつかのオプションについて話をしましょう。rendererとは何かということを正…

Crafting Rails 4 Applications - capter 1-2 - Writing the Renderer

↓のつづきです。 Crafting Rails 4 Applications - capter 1-1 - Satomi's Daily Notestsumekoara.hateblo.jp 1.2 Rendererを書く まずはじめに、render()メソッドと許容されるいくつかのオプションについて話をしましょう。rendererとは何かということを正…

英語のリファレンスを読むときに困った単語やイディオムなど

随時追記していきますー 単数形だとか複数形だとかこだわらず、よく見る形のままリストしています。 Word / Idiom 英語 日本語 使い方など sanity 整合性のある、正当な assert 断言する dependencies 依存関係 gemとかに使う configure 構成する、設定する…

英語のリファレンスを読むときに困った単語やイディオムなど

随時追記していきますー 単数形だとか複数形だとかこだわらず、よく見る形のままリストしています。 Word / Idiom 英語 日本語 使い方など sanity 整合性のある、正当な assert 断言する dependencies 依存関係 gemとかに使う configure 構成する、設定する…

Crafting Rails 4 Applications - capter 1-1

p1 第一章 Rendererを自作する 多くのWebフレームワークと同様に、RailsもMVC(model-view-controller)アーキテクチャをコードの組織化に用いています。Controllerはモデルから情報を収集し、レンダリングの為にViewにそのデータを渡すことを担当します。対し…

Crafting Rails 4 Applications - capter 1-1

p1 第一章 Rendererを自作する 多くのWebフレームワークと同様に、RailsもMVC(model-view-controller)アーキテクチャをコードの組織化に用いています。Controllerはモデルから情報を収集し、レンダリングの為にViewにそのデータを渡すことを担当します。対し…

Git trouble: commit file size become too bigger

Git

Generating Rails project, and come to phase to commit it. The file size is even more than my expectation. $ git push origin master Counting objects: 26593, done. Delta compression using up to 4 threads. Compressing objects: 100% (24906/249…

Git trouble: commit file size become too bigger

Generating Rails project, and come to phase to commit it. The file size is even more than my expectation. $ git push origin master Counting objects: 26593, done. Delta compression using up to 4 threads. Compressing objects: 100% (24906/249…

annotate gem: write schema or routing on model file, routes file

(source: http://whyzat.com/wp-content/uploads/2014/04/Useful-Dog.jpg) Version Ruby # 2.2.1 Rails # 4.2.0 Install $ vi Gemfile -------- # add gem 'annotate' -------- $ bundle install Make Config File(Task File) $ bundle exec rails g annotat…

annotate gem: write schema or routing on model file, routes file

(source: http://whyzat.com/wp-content/uploads/2014/04/Useful-Dog.jpg) Version Ruby # 2.2.1 Rails # 4.2.0 Install $ vi Gemfile -------- # add gem 'annotate' -------- $ bundle install Make Config File(Task File) $ bundle exec rails g annotat…

Review AND, OR, XOR to shorten code

def check true if hoge.present? && fuga.present? end ↑this above can be improved. def check hoge.present? && fuga.present? end Review AND, OR, XOR def hoge # AND false && false #=> false false && true #=> false true && false #=> false true…

Screen-capture with wkhtmltoimage(wkhtmltopdf) onLinux

In many cases, phantom.js is used to get screen capture. But wkhtmltoimage can be alternative. Install http://wkhtmltopdf.org/downloads.html $ sudo yum install -y openssl libX11 libXext libXext.so.6 $ cd /usr/local/src $ wget http://downlo…

try update_all as bulk update like bulk insert

to use bulk insert on Rails, add gem below. gem 'activerecord-import' In MySQL, bulk update can be used by this gem, but postgres..... sqlite..... update_all solution! # make all records with open: false to open: true Shop.where(open: fals…

try update_all as bulk update like bulk insert

to use bulk insert on Rails, add gem below. gem 'activerecord-import' In MySQL, bulk update can be used by this gem, but postgres..... sqlite..... update_all solution! # make all records with open: false to open: true Shop.where(open: fals…

Screen-capture with wkhtmltoimage(wkhtmltopdf) onLinux

In many cases, phantom.js is used to get screen capture. But wkhtmltoimage can be alternative. Install http://wkhtmltopdf.org/downloads.html $ sudo yum install -y openssl libX11 libXext libXext.so.6 $ cd /usr/local/src $ wget http://downlo…

Review AND, OR, XOR to shorten code

def check true if hoge.present? && fuga.present? end ↑this above can be improved. def check hoge.present? && fuga.present? end Review AND, OR, XOR def hoge # AND false && false #=> false false && true #=> false true && false #=> false true…

My First Neobundle

NeoBundle is ... read this. Install $ mkdir -p ~/.vim/bundle $ git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim Setup write configuration at ~/.vimrc for NeoBundle "--------------------------- " Neobundle Setti…

My First Neobundle

NeoBundle is ... read this. Install $ mkdir -p ~/.vim/bundle $ git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim Setup write configuration at ~/.vimrc for NeoBundle "--------------------------- " Neobundle Setti…

Devise 3.x, Rails4.x で create時に、ActionController::UnknownFormat in Devise::RegistrationsController#new が出るとき

Deviseを使ってユーザー登録を使用としたら、Devise::RegistrationsControllerの方のrespond_withのあたりでActionController::UnknownFormatエラーが吐かれました。 ルーティングはこんな感じ devise_for :users, :controllers => { :sessions => "users/se…

Devise 3.x, Rails4.x で create時に、ActionController::UnknownFormat in Devise::RegistrationsController#new が出るとき

Deviseを使ってユーザー登録を使用としたら、Devise::RegistrationsControllerの方のrespond_withのあたりでActionController::UnknownFormatエラーが吐かれました。 ルーティングはこんな感じ devise_for :users, :controllers => { :sessions => "users/se…

Rails4.x で simple_formを使って、create(登録)とupdate(編集)で同じformを使う際の注意

simple_formを使っています。 同じformを使ってcreateとupdateをすることが多いと思います。 症状 updateを叩いたつもりが、こんなエラーに出くわしました。 Routing Error No route matches [PATCH] “/hoge" ちなみにroutingは POST /hoge(.:format) hoge#c…

Using Elasticsearch on Yosemite and Heroku at Rails4.2 Project

Install elasticsearch to Yosemite! Yosemite $ brew install elasticsearch # Elasticsearch Client gem 'elasticsearch-model' gem 'elasticsearch-rails' gem 'bonsai-elasticsearch-rails' $ bundle install Plugin Japanese Character Adaptor The Jap…

Mac Yosemite に RMagick を入れてみました

Rails4で作っているプロジェクトで、Carrierwaveを使おうとすると、RMagickも一緒に使うことが多いかと思います。 それらのセットアップ時のトラブルです。 エラーたち bundle installが落ちる $ bundle install --path vendor/bundle ---- An error occurre…

Mac Yosemite に RMagick を入れてみました

Rails4で作っているプロジェクトで、Carrierwaveを使おうとすると、RMagickも一緒に使うことが多いかと思います。 それらのセットアップ時のトラブルです。 エラーたち bundle installが落ちる $ bundle install --path vendor/bundle ---- An error occurre…

Using Elasticsearch on Yosemite and Heroku at Rails4.2 Project

Install elasticsearch to Yosemite! Yosemite $ brew install elasticsearch # Elasticsearch Client gem 'elasticsearch-model' gem 'elasticsearch-rails' gem 'bonsai-elasticsearch-rails' $ bundle install Plugin Japanese Character Adaptor The Jap…

Rails4.x で simple_formを使って、create(登録)とupdate(編集)で同じformを使う際の注意

simple_formを使っています。 同じformを使ってcreateとupdateをすることが多いと思います。 症状 updateを叩いたつもりが、こんなエラーに出くわしました。 Routing Error No route matches [PATCH] “/hoge" ちなみにroutingは POST /hoge(.:format) hoge#c…