Skip to content

Instantly share code, notes, and snippets.

View JunichiIto's full-sized avatar

Junichi Ito JunichiIto

View GitHub Profile
@JunichiIto
JunichiIto / qiita-update-ranking.rb
Created October 16, 2017 00:25
Analyze the update ranking of "随時更新" items.
require 'minitest/autorun'
require 'json'
require 'date'
def execute
# How to create qiita.json
# 1. curl -o qiita.json https://qiita.com/api/v2/items?page=1&per_page=100&query=title%3A%E9%9A%8F%E6%99%82%E6%9B%B4%E6%96%B0
# 2. curl -o qiita.json https://qiita.com/api/v2/items?page=2&per_page=100&query=title%3A%E9%9A%8F%E6%99%82%E6%9B%B4%E6%96%B0
# 3. Merge them manually
path = '/Users/jit/Desktop/qiita.json'
@JunichiIto
JunichiIto / sample_spec.rb
Created June 15, 2017 01:43
Check exception presence in after hook
RSpec.describe 'Sample' do
after do |example|
if example.exception
puts 'Error!'
else
puts 'OK!'
end
end
example 'sample' do
require 'benchmark'
def with_sum
(0..9_999_999)
.map { |n| n * 2 }
.select { |n| n % 3 == 0 }
.sum
end
def with_inject
@JunichiIto
JunichiIto / gist:54f1d0dbb928566f5083b6caf9d8a2b2
Created May 6, 2017 23:28
Syntax error is gone in Ruby 2.4?
➜ ~ ruby -v
ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-darwin16]
➜ ~ irb
irb(main):001:0> [].delete 1 { 'NG' }
SyntaxError: (irb):1: syntax error, unexpected '{', expecting end-of-input
[].delete 1 { 'NG' }
^
from /Users/jit/.rbenv/versions/2.3.4/bin/irb:11:in `<main>'
irb(main):002:0> exit
➜ ~ rbenv shell 2.4.1
@JunichiIto
JunichiIto / turbolinks-issue.md
Last active July 6, 2018 07:22
Turbolinksがうまく動かない理由(推測)とその解決策
@JunichiIto
JunichiIto / answer.sql
Last active February 6, 2017 22:32
【SQL腕試し問題】現在の部署に所属する社員の一覧を取得するSQLを書いて下さいの解答例
-- http://qiita.com/jnchito/items/29e22cc5a73da29f65a3
SELECT
e.id
,e.name
,sh.section_name
,to_char(sh.start_date, 'yyyy/mm/dd') as start_date
FROM
employees e
INNER JOIN
section_histories sh
@JunichiIto
JunichiIto / answer.sql
Last active February 6, 2017 22:32
【SQL腕試し問題!】入会者数と退会者数を日付ごとに集計するSQLを書いてくださいの解答例
-- http://qiita.com/jnchito/items/1d21fa3970b3c76bee43
WITH target_dates AS
(SELECT joined_on AS target_date
FROM users
UNION
SELECT left_on AS target_date
FROM users
WHERE left_on IS NOT NULL ),
joined_counts AS
(SELECT joined_on,
@JunichiIto
JunichiIto / fizz_buzz.rb
Created December 13, 2016 01:40
Rubyで書く変なFizzBuzz (Strange FizzBuzz function in Ruby)
fizz_buzz = -> (n) do
f = -> (cond, ans, nxt, n) { n % cond == 0 ? ans : nxt.(n) }.curry
patterns = [[n, n.to_s], [5, 'Buzz'], [3, 'Fizz'], [15, 'Fizz Buzz']]
patterns.inject(nil) { |nxt, (cond, ans)| f.(cond, ans, nxt) }.(n)
end
(1..20).map(&fizz_buzz)
=begin
[
[ 0] "1",
-- https://gist.github.com/natcl/7a5c98aae8b21475caf9
log "start"
property imageFiles : {"jpg", "pef", "dng", "jpeg"}
tell application "Finder"
set MyFolder to folder POSIX file "/Users/your-path/"
set SubFolders to every folder of MyFolder
end tell
repeat with aFolder in SubFolders

Because Junichi Ito's post was public, I wanted to translate my answer to Japanese before posting it. Here's my English answer:

Thanks for your comments and your support! I realise we should have done a better job at explaining how we arrived at the pricing.

With Doorkeeper, we’re focused on organisers who hold events on a regular basis, not one off events. This is why we’ve chosen to go with monthly pricing, instead of one a one off fee. We think Doorkeeper already provides you some value when you’re not holding events (people can join your community, you can send them messages), and we want look to how we can provide even more continuous value for communities. If you have any ideas how we could make Doorkeeper more valuable to you even when you’re not holding an event, please let us know.

We chose the smallest plan to have five upcoming events number because we thought it would be the largest number a non professional event organiser would have. We think that ¥1,500 per month is a reasonable price even i