Skip to content

Instantly share code, notes, and snippets.

@ykpythemind
ykpythemind / karabiner.json
Created October 24, 2023 15:54
Ctrl+p/Ctrl+n to arrow up/down (slack) using karabiner
"rules": [
{
"description": "Ctrl+p/Ctrl+n to arrow up/down (slack)",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": ["com.tinyspeck.slackmacgap"],
"type": "frontmost_application_if"
}
@ykpythemind
ykpythemind / find_by_ast.rb
Last active May 29, 2023 07:22
find_by(email: 'xxx')みたいなのを探すやつ
# https://nacl-ltd.github.io/2021/07/02/ruby-ast.html
require 'bundler/inline'
gemfile do
ruby '3.2.2' # 適宜変える
source 'https://rubygems.org'
gem 'parser'
gem 'debug'
end
@ykpythemind
ykpythemind / export.rb
Last active May 31, 2022 16:58
Mac Notes.app to Evernote
# Notes.app -> Evernote
#
# 1. mac app exporterでmdファイルを抽出 ( https://apps.apple.com/jp/app/exporter/id1099120373?mt=12 )
# 2. このスクリプトをmdファイルがあるフォルダに配置して走らせる (要調整)
# % ruby export.rb
# 3. out-xxxxxxフォルダに吐かれる
# 4. evernote -> ファイル -> インポート -> enexファイルたちを選んでインポート
require 'rexml/document'
@ykpythemind
ykpythemind / push zsh
Created December 30, 2021 02:59
push and create pull request
```
function push() {
local result st a
result=$(git push 2>&1 -u origin `git branch | grep \* | cut -d ' ' -f2`)
st=$?
if [ $st = 0 ]; then
a=$(echo "$result" | grep 'Create a pull request for')
if [ -n "$a" ]; then
git brws --pr
RBS::Parser::SyntaxError: parse error on value: #<RBS::Parser::LocatedValue:0x00000040171552a0 @location=#<RBS::Location:97040 @buffer=, @pos=6474...6478, source='type', start_line=151, start_column=34>, @value=:type> (kTYPE)
parser.y:1757:in `on_error'
(eval):3:in `_racc_do_parse_c'
(eval):3:in `do_parse'
parser.y:1458:in `parse_signature'
/bundle/ruby/2.7.0/gems/rbs_rails-0.8.2/lib/rbs_rails/util.rb:19:in `format_rbs'
/bundle/ruby/2.7.0/gems/rbs_rails-0.8.2/lib/rbs_rails/active_record.rb:25:in `generate'
/bundle/ruby/2.7.0/gems/rbs_rails-0.8.2/lib/rbs_rails/active_record.rb:11:in `class_to_rbs'
# frozen_string_literal: true
require 'rails_helper'
require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../config/rubocop/custom_cops/use_save_bang_on_test'
describe CustomCops::UseSaveBangOnTest do
include RuboCop::RSpec::ExpectOffense
@ykpythemind
ykpythemind / spec_splitter.rb
Created May 20, 2021 14:22
GitHub Action + Rails test example
# テストの並列実行用にspecファイルを分割する
require 'optparse'
options = {}
OptionParser.new do |o|
o.on('--glob=OPT', 'glob') { |v| options[:glob] = v }
o.on('--node-index=OPT', 'node-index') { |v| options[:node_index] = v.to_i }
o.on('--node-count=OPT', 'node-count') { |v| options[:node_count] = v.to_i }
end.parse!(ARGV.dup)
@ykpythemind
ykpythemind / test.yml
Last active January 27, 2024 09:30
GitHub Action + Rails test example
# .github/workflows/test.yml
name: test
on: [push]
env:
RUBY_VERSION: 2.7.2
NODE_VERSION: 14.15.5
RAILS_ENV: test
@ykpythemind
ykpythemind / pomプライバシーポリシー.md
Last active September 21, 2021 01:26
pom プライバシーポリシー

pom

本アプリケーションはユーザーの個人情報やその他使用に伴い発生する情報を一切収集しません。 お問い合わせはyukibukiyou[at]gmail.comまでお願いいたします。

{"subscriptions":[{"id":1,"public_id":234658,"customer_id":1,"user_id":2,"merchant_id":3,"product_id":2,"currency":"jpy","custom_price":null,"status":"active","cancel_at_period_end":false,"created_by":"user","created_at":"2020-01-17T19:20:29.000+09:00","current_period_start_at":"2020-01-17T19:20:29.000+09:00","current_period_end_at":"2020-01-31T23:59:59.000+09:00","suspended_at":null,"canceled_at":null,"updated_at":"2020-01-17T19:20:30.000+09:00","deleted_at":null,"product":{"id":2,"public_id":480677,"merchant_id":3,"scheme":"subscription","name":"月謝fuga444222","image":{"url":null,"thumb":{"url":null},"small":{"url":null},"medium":{"url":null},"large":{"url":null}},"description":"piaeeee","price":"2000.0","charge_schedule":"monthly","charge_interval":1,"charge_monthly_anchor":1,"wait_first_anchor":false,"ticket_count":null,"expiration":null,"expiration_unit":null,"provide_as_payment_method":0,"sort_order":0,"published_at":"2020-01-17T19:17:12.000+09:00","created_at":"2020-01-17T19:17:12.000+09:00","updated_at