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
//// -*- mode: javascript; coding: utf-8 -*- | |
// ==UserScript== | |
// @name Heat the nicovideo up | |
// @author noriaki | |
// @namespace http://blog.fulltext-search.biz/ | |
// @description Visualize comments upsurge for Nicovideo | |
// @license MIT License | |
// @version 0.4.0 | |
// @released 2007-09-11 09:00:00 | |
// @updated 2009-06-07 19:58:00 |
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
require 'aws-sdk' | |
logger = Logger.new('elb_status.log') | |
ACCESS_KEY = 'foo' | |
SECRET_ACCESS_KEY = 'bar' | |
LB = 'baz' | |
health = AWS::ELB.new(access_key_id: ACCESS_KEY, secret_access_key: SECRET_ACCESS_KEY, elb_endpoint: 'elasticloadbalancing.ap-northeast-1.amazonaws.com').load_balancers[LB].instances.health |
NewerOlder