This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# brew install prce2 | |
# RAILS_ENV=test bin/rails r check_unused_factory_bot.rb | |
FactoryBot.factories.each do |factory| | |
command = %!pcregrep -Mr "(build|build_list|create|create_list)\\(\\n? *:#{factory.name}(,|\\))" spec! | |
result = `#{command}` | |
puts factory.name if result.chomp.empty? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Show covered files from SimpleCov result html | |
# | |
# Usage: | |
# | |
# ruby covered-files-from-simplecov.rb index.html | |
# | |
require 'nokogiri' | |
THRESHOLD = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# bundle exec rubocop --only #{cop} --format json | ruby disable_cop_inline.rb | |
# | |
require 'json' | |
require 'tempfile' | |
require 'fileutils' | |
result = JSON.parse($stdin.read) | |
result['files'].each do |res| | |
next if res['offenses'].empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set breakpoint pending on | |
b _wrap_Tagger_parseToNode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'benchmark' | |
class SizeMatters | |
include Comparable | |
attr :str | |
def <=>(other) | |
str.size <=> other.str.size | |
end | |
def initialize(str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
Benchmark.bmbm do |x| | |
v = Random.rand(-10..110) | |
x.report "minmax:" do | |
10000000.times { [99, [0, v].max].min } | |
end | |
x.report "clamp: " do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am kei-s on github. | |
* I am kei_s (https://keybase.io/kei_s) on keybase. | |
* I have a public key whose fingerprint is 6B52 13DA 6F4B 48F5 5B42 AE34 931D 3783 8649 E80C | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@gomobako = 🗑 | |
def gomibako_ni_suteru(gomi) | |
@gomibako.akeru | |
@gomibako.ireru(gomi) | |
@gomibako.shimeru | |
end | |
cd = 💿 | |
if cd.wareta? | |
gomobako_ni_ireru(cd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/ | |
// 1. Enter sheet name where data is to be written below | |
var SHEET_NAME = "購入ログ"; | |
// 2. Run > setup | |
// | |
// 3. Publish > Deploy as web app | |
// - enter Project Version name and click 'Save New Version' | |
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendMail() { | |
var today = new Date(); | |
var MAIL_TO = "メールアドレス"; | |
var cycles = (function() { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("サイクル"); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); | |
var values = rows.getValues(); | |
return values; |
NewerOlder