Skip to content

Instantly share code, notes, and snippets.

View bluerabbit's full-sized avatar
🤠
spark joy

Akira Kusumoto bluerabbit

🤠
spark joy
View GitHub Profile
@bluerabbit
bluerabbit / processlist.md
Last active February 20, 2024 04:43
MySQLでプロセスリストから遅いクエリのセッションをKILLするSQLを生成するSQL
SELECT
  *,
  CONCAT(CONCAT('KILL ', id), ';') AS KILL_SQL,
  CONCAT(CONCAT('CALL mysql.rds_kill(', id), ');') AS KILL_SQL_FOR_RDS
FROM
  INFORMATION_SCHEMA.PROCESSLIST
WHERE
  db = 'your_db'
 AND info LIKE '%probrem_query%'
@bluerabbit
bluerabbit / .haml-lint.yml
Last active August 2, 2023 04:14
rubocop config
linters:
LineLength:
enabled: false
SpaceInsideHashAttributes:
enabled: false
ViewLength:
enabled: false
InlineStyles:
enabled: false
ClassesBeforeIds:
@bluerabbit
bluerabbit / gist:5916445
Created July 3, 2013 08:50
Railsでurlを作ってnginxがheaderのX-Accel-Redirectに再アクセスして、リクエスト先はX-Reproxy-URLになってダウンロードしてレスポンスを返す

下記はhttp://www.google.co.jpにnginxがアクセスしてレスポンスする

Rails

response.headers['X-Accel-Redirect'] = '/reproxy/'
response.headers['X-Reproxy-URL'] = 'http://www.google.co.jp'
head :ok
@bluerabbit
bluerabbit / github_pull_request.rb
Last active October 26, 2022 01:05
CircleCIにてrspecでテストが落ちてたらGitHubのPull RequestのDescriptionに落ちたテストファイルを列挙する
require "octokit"
require "json"
class GithubPullRequest
def initialize(access_token: ENV["GITHUB_TOKEN"], repository:)
@client = Octokit::Client.new(access_token: access_token)
@repository = repository
end
def update_description!(rspec_examples:, pull_request_number:, ci_build_url:)
@bluerabbit
bluerabbit / gist:6227860
Last active April 22, 2022 01:01
capybaraのAPIメモ

操作

  • ページに移動
visit '/pages/new'
  • フォームに値を入力
@bluerabbit
bluerabbit / gist:8ee1b6ac7ff0c15e47bc
Created August 1, 2014 01:33
ふりかえりのグランドルールとKPT法

ふりかえりのグランドルール

1. 積極的に参加すること

  • 当事者意識を持つ
  • 議題に集中すること

2. 一人で話しすぎないこと

  • 人の発言をさえぎらない
@bluerabbit
bluerabbit / calculator.rb
Last active January 13, 2021 04:56
rspecはシンプルなスタイルを好んだ方が読みやすいことが多い
# gem install rspec
# rspec calculator.rb
require "rspec"
class Calculator
def sum(value1, value2)
value1 + value2
end
end
@bluerabbit
bluerabbit / gist:9064116
Created February 18, 2014 03:20
空コミットでpull requestを作る
git checkout -b topic_branch
git commit --allow-empty -m 'Make a pull request'
git push --set-upstream origin topic_branch
hub pull-request -b develop
hub browse -- pull/{pull_request_id}
@bluerabbit
bluerabbit / wait_for_url_change.md
Created July 28, 2015 07:19
capybaraでURLが変更されるまで待つhelper method
  # urlが変更されるまで待つ
  # 登録ボタンをクリックして登録処理が完了すると画面遷移する場合などで画面遷移するまで待つようにできる
  # 例) wait_for_url_change { click_on '登録' }
  #     登録して画面遷移が終わるまでwait_for_url_changeでsleepされる
  def wait_for_url_change(timeout_sec = 3)
    current_path = page.current_path

    yield
%cat /usr/local/bin/rubymine
#!/bin/sh

open -na /Applications/RubyMine.app --args "$@"
chmod +x/usr/local/bin/rubymine