iT邦幫忙

DAY 1
1

新奇小玩具系列 第 1

學習 Ruby on Rails 一年來蒐集的好用教學文章

9/20
[SSL CA] 超便宜的 SSL CA 憑證
https://www.ssls.com/

購買安裝流程簡述:(Positive SSL)

  1. 先到 Linux 產生一組網站的 crt 和 key (domain 要與欲設定網站相同)
  2. 下訂單購買,完成後需要填入剛剛的 crt
  3. 填資料、Email 會有幾封驗證信、最後會收到一個 zip 檔案
  4. 需要把這幾個 combine 在一起:

cat your_domain_name.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > bundle.crt

  1. 組合完成的 bundle.crt + 一開始產生的 .key 擋最後要 copy 到 nginx 上做設定 (可以直接用 capistrano 自動設定 SSL)

9/18
[Test] Integration Test with rspec + phantomjs
http://railscasts.com/episodes/391-testing-javascript-with-phantomjs

9/16
[Rails Core] 核心模組 Railtie & Engine

Railtie: 提供開發者從外部增加 rails 載入各種階段的 hook (initializer, prepare, ... etc)
http://api.rubyonrails.org/v4.1.4/classes/Rails/Railtie.html

Engine: 繼承自 Railtie,能夠實作出可掛載的 raills application gem,觀察差異是 Railtie 階段無法取得使用的 app 某些資訊:例如掛載 migration path 等等。
http://edgeapi.rubyonrails.org/classes/Rails/Engine.html

9/16

包 gem 擴充 rails 物件時機點:

a. 需要 application context 則掛在 Railtie 或 Engine 內:
https://github.com/plataformatec/devise/blob/master/lib/devise/rails.rb#L16

b. 不需要 application context 的狀況則可直接掛載:
https://github.com/collectiveidea/awesome_nested_set/blob/f823ffb304ccf5ca9c4f14b60ff1f45ad2c3f440/lib/awesome_nested_set.rb#L3

參考文章:
[RailsCast] 可掛載的 engine: http://railscasts.com/episodes/277-mountable-engines
[RailsGuide] Getting Started with Engines: http://edgeguides.rubyonrails.org/engines.html
[Blog] Leave your migrations in your Rails engines: http://pivotallabs.com/leave-your-migrations-in-your-rails-engines/

9/10

[Gem] 產生報表的 gem
說明: 提供 view helepr 結合 activerecord 在包裝前端的圖表 javascript 物件 (目前可使用 Google Charts, Hight Charts)
http://ankane.github.io/chartkick/

9/4
[UI] bootsnipp - bootstrap snippets
http://bootsnipp.com/snippets/featured/bootstrap-button-dropdowns

9/3
[Gem] memoist
說明:從 ActiveSupport::Memoizable 移植過來的 gem
Blog: http://adz.logdown.com/posts/230645-rails-notes-gem-memoist
Github: https://github.com/matthewrudy/memoist

9/1
[Gem] foreman - Manage Procfile-based applications
RailsCast - http://railscasts.com/episodes/281-foreman
Github - http://ddollar.github.com/foreman

8/22
[Rails Docs] View Helper - Render
說明:Rails 4 以後的寫法更精簡了

  1. render object & collection
  2. render partial with layout
  3. render partial with spacer
    http://api.rubyonrails.org/classes/ActionView/PartialRenderer.html

8/21
[Ruby] Special-Case-Pattern
https://www.codeschool.com/screencasts/rubytapas-special-case-pattern

[Ruby] 用 Catch / Throw 做流程控制
https://www.codeschool.com/screencasts/rubytapas-catch-and-throw

[Rails Guide] Rails App Template
https://www.codeschool.com/screencasts/rails-app-templates-part-1
https://www.codeschool.com/screencasts/rails-app-templates-part-2

[BDD] Behavior-driven Development with Cucumber
說明: 裡面的 spec 寫法不錯、感覺可以搭 User Story,但工具用哪套要在研究
https://www.codeschool.com/screencasts/behavior-driven-development-with-cucumber

[Scrum] Agile Best Practices
https://www.codeschool.com/screencasts/agile-best-practices

[Ruby Convention] Special Character Methods
說明: 較詳細的 bang method (!), boolean method (?) 的使用時機、情境
https://www.codeschool.com/screencasts/special-character-methods

8/13
[教學] 超棒的 rails console 設定
http://ascendbruce.logdown.com/posts/208604-awesome-rails-console-customization-using-pry

[Deployment] Rails 開發的 web interface deploy tool
https://github.com/zendesk/samson

6/16
[Gem] visionbundles
說明:是一個 capistrano 2.x.x 的 deploy solution, 包含 puma, nginx 搭配的基本 + 完整 deploy flow, 目的是用 config + template 就可完成 deploy 任務。
https://github.com/afunction/visionbundles

6/15
[Gem] multi_logger
說明:讓你的 logger 不只有 #{env}.log,可依需求拆出,如 payment.log, sms.log ... etc
https://github.com/lulalala/multi_logger

[Gem] bullet
說明:開發工具,判斷有無 N+1 Query / unused query
http://railscasts.com/episodes/372-bullet

[Rails Core] activesupport::callbacks
說明: 可以在任何 model custom made 自己的 callback
http://api.rubyonrails.org/classes/ActiveSupport/Callbacks.html

6/12
[Gem] redis-objects
說明:低相依 rails,獨立的 redis gem,介於整合與彈性中間,容易自由整合現有 ORM
https://github.com/nateware/redis-objects

[Rails Core] ActionController::Metal
說明:精簡版的 controller, 效能先決
http://api.rubyonrails.org/classes/ActionController/Metal.html

6/8
[Gem] capistrano advance usage (recipes, tasks)
說明:deploy 設定教學,把 nginx / unicorn / database 拆成 recipes 以後 VPS 開好,直接用 capistrano 安裝。
http://railscasts.com/episodes/133-capistrano-tasks-revised?autoplay=true
http://railscasts.com/episodes/337-capistrano-recipes?autoplay=true

6/1
[Gem] Draper - View-Model pattern
說明:此 gem 拿來作為 model 與 view 中間的 layer,該寫在 helper or model 誤寫在這、或太依賴這個 gem,後續會難以維護。
https://github.com/drapergem/draper

5/20
[Gem] awsome_nested_set
說明:輕鬆建立自己關聯自己 (樹狀結構) model,內有特別演算法增進樹狀結構 query 算法
Gem: https://github.com/collectiveidea/awesome_nested_set
算法: http://threebit.net/tutorials/nestedset/tutorial1.html

[Gem] stamp + stamp-i18n
說明:處理時間 format 的 gem 和相對應 i18n gem
stamp: https://github.com/jeremyw/stamp
stamp-i18n: https://github.com/karpiu/stamp-i18n

5/18
[Gem] exceptions_to_hipchat
說明:讓 production 的 exception 即時 push 到 hipchat
https://github.com/darrinholst/exceptions_to_hipchat

[Gem] bootstrap_form
說明:專屬於 bootstrap 表單的 form wrapper
https://github.com/bootstrap-ruby/rails-bootstrap-forms

[Gem] ubuntu-rails-app-installer
說明:一組 shellscripts 安裝腳本
服務:(nginx / percona db / redis / elasticsearch)
設定:(rails deploy user / swap / firewall / 優化 tcp connection / mysql configuration)
https://github.com/afunction/ubuntu-rails-app-installer

4/15
[Gem] public activity
說明: 拿來做類似 facebook timeline 的功能 (用戶對相依 model 做操作的 activity log)
應該也可以拿來做操作 log、內有提供各 model template renderer (create, update, destroy)
http://railscasts.com/episodes/406-public-activity

4/10
[Rails] 4.1 release note
http://docrails-tw.github.io/4_1_release_notes.html

  1. 針對各種 user_agent render view 功能
  2. mailer preview
  3. 輕型 concerns
  4. js csrf protection
  5. spring rails app preloader

4/4
[Database] MySQL Tuning Tool
http://www.sitepoint.com/optimizing-mysql-configuration/

[Gem] shell script story
說明: 一些技巧讓你在開發 rails app 時使用 zsh 更順手 (rake auto completion ... etc)
http://railscasts.com/episodes/309-a-shell-scripting-story?autoplay=true

[Gem] Doorkeeper + oauth2 + omni-auth 封裝自己的站
說明:

  1. 開放網站 API 給 mobile or 其他人存取
  2. 自己的多個 rails application 要做 SSO
  3. 用 oauth2 gem 存取別人的 API
    http://railscasts.com/episodes/353-oauth-with-doorkeeper?autoplay=true

3/31
[Gem] sidekiq-superworker
說明: 可定義 work flow, sub-worker ... 等等
https://github.com/socialpandas/sidekiq-superworker

[Baisc] 很好懂的如何撰寫 threadsafe 程式碼、避免 race condition & deadlock
http://ruby-china.org/topics/10932
http://railscasts.com/episodes/365-thread-safety

3/24
[Basic] Understanding the Object Model
http://www.sitepoint.com/understanding-object-model/?utm_source=rubyweekly&utm_medium=email

[Pattern] Presenter Pattern - 介於 model 與 view, controller 間的裝飾層
http://railscasts.com/episodes/287-presenters-from-scratch

[Pattern] Service Objects
說明: 不適合寫在 model? 也不適合 controller? 那就寫在 service object吧
http://railscasts.com/episodes/398-service-objects

[Pattern] Form Object
說明: 不屬於 Model 的 Form 又需要 validation, callbacks 等功能的解決方案
http://railscasts.com/episodes/416-form-objects

[Tools] 加快 rails command line 的 Gem
http://railscasts.com/episodes/412-fast-rails-commands

3/18

[技巧] around_action - 在 controller 能夠設定包住 action
說明: show action 會執行在 wrap_in_transaction 裡的 yield
參考: http://railscasts.com/episodes/388-multitenancy-with-scopes?autoplay=true

[Tools] 前端 Performance Tuning - 非同步載入, chrome profiles
連結: http://railscasts.com/episodes/369-client-side-performance?autoplay=true

[技巧] 使用 rake middleware 實作 batch API call
說明: 使用 batch API call 取代我們常寫 collection multi update 功能
連結: http://railscasts.com/episodes/414-batch-api-requests

[Tools] Better_Error 進階使用方式 (Chrome Extension + Sublime Text2)
連結: http://railscasts.com/episodes/402-better-errors-railspanel?autoplay=true


系列文
新奇小玩具1
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言