rastam on rails

東京在住のマレーシア人 Rubyist

Ruby Weekly #496: 日本語サマリー

rubyweekly.com

Highlights

Super Bombinhas: An In-Development Platform Game in Ruby

Ruby で実装されたプラットフォーム・ゲーム。

70+ Ruby and Rails Security Best Practices and Vulnerabilities

Rails が提供してくれるセキュリティ機能。

  • X-Frame-Options ヘッダー
  • X-XSS-Protection ヘッダー
  • X-Content-Type-Options ヘッダー
  • X-Download-Options ヘッダー
  • X-Permitted-Cross-Domain-Policies ヘッダー
  • Referrer-Policy ヘッダー
  • Content-Security-Policy ヘッダー
  • Feature-Policy ヘッダー
  • SQL インジェクション防止
  • データサニタイズ
  • CSRF
  • セッション周りセキュリティ
  • SSL 制御

Rails 外セキュリティ機能。

A Few of My Favorite Things

Test Double 社エンジニアが愛用している CLI ツール集。

  • Homebrew brew
  • 簡略化した man ページを提示してくれる tldr
  • 高速検索用 ripgrep rp または The Silver Searcher ag
  • GitHub 操作用 hub または gh
  • localhost の URL 化用 ngrok
  • コピペ用 pbcopy (MacOS) または xclip (Linux)
  • ファジー検索用 fzf
  • ls 代替用 exa
  • cat 代替用 bat
  • 色付きログ出力用 grc
  • curl +αの httpie または curlie
  • JSON フォーマット・フィルター用 jq
  • git ログ閲覧用 tig
  • ポート調査用 lsof
  • xargs

The 'Citadel' Architecture?

AppSignal 社の Citadel アーキテクチャー解説。

  • 本体は Rails モノリス + React フロントエンド。
  • 監視データ収集がネックになるため別アプリ。元々は Sinatra だったが、今は Rust + Kafka。

Articles & Tutorials

Heredocs and How to Use Them

HEREDOC 使い方まとめ。

  • <<HEREDOC
  • <<-HEREDOC
  • <<~HEREDOC
  • <<-HEREDOC.strip_heredoc
  • <<~HEREDOC.squish

Our Rails Upgrade Process: How to Bundle Update Rails

FastRuby 社の Rails バージョンアップ手順。

  1. production.log、test.log の deprecation 撲滅
  2. next_rails gem で dual boot 設置
  3. 各 gem バージョンアップ可否調査
  4. 新規 Rails バージョン用ブランチ・PR 切る
  5. 非互換性 PR は新規 Rails バージョン用ブランチに向ける。それ以外は master。
  6. QA・動作確認
  7. 新規 Rails バージョン用ブランチを master にマージ

Why You (Probably) Don't Need PostGIS

PostgreSQL で位置情報を管理するだけなら、PostGISYAGNI。緯度・経度カラムだけで十分。距離も earth_distance 関数でできちゃう。

How to Restart Sidekiq Automatically for Each Deployment

デプロイ時 Sidekiq 再起動手順。

  1. sidekiq.service ファイル作成・設定
  2. 必要な環境変数を sidekiq.service の EnvironmentFile で設定
  3. systemctl enable sidekiq でサービス登録。
  4. service sidekiq start でサービス起動。

A Hands-On Tutorial to Debugging Your Code with pry-byebug

pry-byebug でデバッグするチュートリアル

  • binding.pry
  • next
  • continue

Code and Tools

Gruff Graphs: A Graphing Library for Ruby

グラフ画像生成用 gem。

amazing_print: Pretty Print Your Ruby Objects with Style

色付きでフォーマットされた Ruby オブジェクトを puts してくれる gem。

Slack-Ruby-Bot: A Generic Slack Bot Framework

Slack ボット用フレームワーク

Brutal: A Code-First Approach to Automate The Writing of Unit Tests

YAML を元にテストを生成せいてくれるテストフレームワーク

CSV Shaper: A DSL for Creating CSV Output

CSV 生成用 DSL を提供してくれる gem。

Chatwoot: Simple, Open Source Live Chat Software

OSS のチャット用 Rails アプリ。