Skip to content

Instantly share code, notes, and snippets.

View juno's full-sized avatar
💰
writing code (almost) every weekday

Junya Ogura juno

💰
writing code (almost) every weekday
View GitHub Profile
@juno
juno / rails_helper.rb
Created June 25, 2015 13:04
Poltergeistを利用したfeature specにおいて、ブラウザの言語設定を明示的に行う
RSpec.configure do |config|
config.before(:each) do |example|
# Poltergeistの言語設定をja,enにする
if example.metadata[:type] == :feature && example.metadata[:js]
page.driver.headers = {
'Accept-Language' => 'ja,en',
}
end
end
end
@juno
juno / how-to-sunset-a-feature.md
Last active August 29, 2015 14:20
機能の提供を終了する手順 / Japanese summary of "How to Sunset a Feature - Inside Intercom" https://blog.intercom.io/how-to-sunset-a-feature/

機能の提供を終了する手順

1. 終了してもよいことを確認する

以下の問いに答えられるようにする。

  • その機能を利用できるのはユーザー何%か?(ユーザーのプランによって利用可否がある場合など)、頻繁に利用されているか?
  • それらのユーザーの生み出す収益は何%か?
@juno
juno / event-sourcing.md
Created May 2, 2015 10:20
Event Sourcing.

Event Sourcing

なぜEvent Sourcingを使うのか

Why use Event Sourcing - Arkency Blog

  • Event Sourcingは「現在の状態を保存する」ということに依存しない
  • 新しいコンセプトというわけではない
    • Event Sourcingのように働く現実世界の問題は沢山ある
  • 銀行口座の状態も現在の状態ではなくドメインイベントのログから成り立っている
@juno
juno / foo_spec.rb
Last active August 29, 2015 14:19
RSpec with ActiveJob
describe Foo do
describe '.process', active_job: true do
it 'キューにジョブを2件保存する' do
expect {
described_class.process
}.to change{ActiveJob::Base.queue_adapter.enqueued_jobs.size}.by(2)
end
end
end
@juno
juno / fetch-pull-id.rb
Created March 3, 2015 11:45
Fetch pull request id by branch name using github api v3
require 'octokit'
owner = 'juno'
repo = 'foo'
branch_name = 'fix-issue-1'
Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN'])
pull_id = client.pulls("#{owner}/#{repo}", head: "#{owner}:#{branch_name}").first.number

プロダクトへのフィードバックを集める際にやりがちな5つの失敗

Original: 5 mistakes we all make with product feedback

1. 「全ユーザー」に話しかけるのをやめる

  • 全ユーザーを対象にした調査では「昨日サインアップしたユーザー」と「長期間利用してくれているユーザー」を同一視してしまう
  • 新規ユーザーの利用ステップを改善したければ、最近サインアップしたユーザーだけに問いかけること
  • ある機能を改善したければ、その機能を使っているユーザーだけに問いかけること
  • ある機能がなぜ利用されないのかを知りたければ、その機能を使っていないユーザーだけに問いかけること
  • ユーザーの感心が高い部分を知りたければ、すべての機能を利用しているアクティブなユーザーだけに問いかけること
@juno
juno / what-to-spend-on-customer-acquisition-in-5-easy-steps-summary.md
Created January 14, 2015 09:13
Summary in Japanese of "What to Spend on Customer Acquisition in 5 Easy Steps"

What to Spend on Customer Acquisition in 5 Easy Steps

Original: https://segment.com/blog/calculating-customer-acquisition-costs/

SaaS企業が新規ユーザー獲得のための予算を決める前に把握しておく必要があること

1. 有料ユーザーがライフサイクルを通じて支払ってくれる金額はどれくらいか (Lifetime Value, LTV)

算出式は以下のとおり。

@juno
juno / capture.md
Last active August 29, 2015 14:12
$ rails c
> puts 'Hello'
Hello
=> nil

> capture(:stdout) { puts 'Hello' }
=> "Hello\n"
@juno
juno / after.rb
Created December 23, 2014 04:34
Using rspec-mocks spy. http://journal.sooey.com/254
it 'Qnyp::Episodes::CalculateEpisodeRatingSummary.process を呼び出す' do
user = FactoryGirl.create(:user)
# Spyによる監視を行うためには、このようにオブジェクトやメソッドを監視するコードは必要
allow(Qnyp::Episodes::CalculateEpisodeRatingSummary).to receive(:process)
get :show
expect(Qnyp::Episodes::CalculateEpisodeRatingSummary)
.to have_received(:process)
.with(user)
end
@juno
juno / before.rb
Last active August 29, 2015 14:11
Using rspec-mocks spy. http://journal.sooey.com/254
it 'Qnyp::Episodes::CalculateEpisodeRatingSummary.process を呼び出す' do
user = FactoryGirl.create(:user)
expect(Qnyp::Episodes::CalculateEpisodeRatingSummary)
.to receive(:process)
.with(user)
get :show
end