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 / 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:7e03257ea193886cd8858b3be3f94997
Created October 30, 2018 08:05
CIでテストが落ちたらGitHub Pull RequestのDescriptionに落ちたファイルの情報で更新する

.circleci/config.yml

  - run: bundle exec rspec --format json --out rspec.json
  - run:
      name: Create CircleCI Test Summary
      when: always
      command: |
        gem install circleci-test_report
        circleci-test_report -f rspec.json -o /tmp/test-results/rspec.xml
@bluerabbit
bluerabbit / create_link.md
Created January 19, 2017 05:43
Chrome extention Create Linkの設定
@bluerabbit
bluerabbit / render_sjis.md
Created December 8, 2016 10:38
Railsで文字エンコードShift-JISでレンダリングする方法
class YourController < ApplicationController
  after_action :change_charset_to_sjis, only: [:index]

  def index
  end

  private

 def change_charset_to_sjis
SELECT
  requesting_ps.user AS requesting_user,
  requesting_ps.host AS requesting_host,
  requesting_ps.db AS requesting_db,
  requesting_lock.lock_mode AS requesting_lock_mode,
  requesting_lock.lock_type AS requesting_lock_type,
  requesting_lock.lock_table AS requesting_lock_table,
  requesting_lock.lock_index AS requesting_lock_index,
default: &default
adapter: mysql2
encoding: utf8mb4
charset: utf8mb4
collation: utf8mb4_general_ci
pool: 5
username: your_name
password: your_password
variables:
sql_mode: 'STRICT_ALL_TABLES'
@bluerabbit
bluerabbit / circle.yml
Created February 3, 2016 01:10
circleciで未使用のサービスを止める
machine:
post:
- sudo service mongodb stop
- sudo service postgresql stop
- sudo service couchdb stop
- sudo service zookeeper stop
- sudo -u rabbitmq rabbitmqctl stop
@bluerabbit
bluerabbit / gist:c2d505c49fa1b5cc625c
Created October 8, 2015 13:57
herokuでbrowserify-railsを使って動かす

React.jsを使いたいRailsおじさんがJavaScriptライブラリをそれっぽく管理しながら入門するを試したらエラーになったのでメモ

http://ppworks.hatenablog.jp/entry/2015/08/10/212937

herokuの設定

下記が必要でした。

%heroku buildpacks:set https://github.com/heroku/heroku-buildpack-ruby
@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