Skip to content

Instantly share code, notes, and snippets.

Avatar
🌈
It's complicated?

Ryan Davis zenspider

🌈
It's complicated?
View GitHub Profile
View release_branch.rb
#!/usr/bin/env ruby -ws
$y ||= false
require "thread"
require "pry"
require "octokit"
require "zip"
require "fileutils"
View reopen_github_prs.rb
#!/usr/bin/env ruby
# require_relative "octokit_extensions"
require "thread"
require "pry"
require "octokit"
require "zip"
require "fileutils"
github_token = `git config github.oauth-token`.chomp
View commit_by_owner.rb
#!/usr/bin/env ruby -ws
$y ||= false
require "pp"
abort "need a commit message" if ARGV.empty?
msg = ARGV.join " "
@zenspider
zenspider / clean_by_date.rb
Last active Apr 12, 2021
My clean_by_X scripts
View clean_by_date.rb
#!/usr/bin/env ruby -ws
$t ||= false
require 'fileutils'
system 'find . -maxdepth 1 -empty -type d -exec rmdir {} \;'
format = "%Y-%m"
now = Time.now.strftime(format)
View owner.rb
#!/usr/bin/env ruby -w
owners = File.readlines(".github/CODEOWNERS")
.map(&:chomp)
.reject { |s| s =~ /^\s*#/ }
.map { |s|
glob, *rest = s.split
glob += "**" if glob.end_with? "/"
[glob, *rest]
}
View allowed_plugin.rb
module Minitest
def self.plugin_allowed_options opts, _options # :nodoc:
opts.on "-a", "--allowed=path", String, "Allow listed tests to fail." do |f|
require "yaml"
@allowed = YAML.load File.read f
end
opts.on "-A", "--save-allowed=path", String, "Save failing tests." do |f|
require "yaml"
@allowed_save = f
View update_rubies
#!/usr/bin/env ruby -w
require "open-uri"
require "net/http" # avoid require issues in threads
require "net/https"
versions = %w[ 2.3 2.4 2.5 2.6 2.7 3.0 ]
versions = %w[ 2.5 2.6 2.7 3.0 ]
my_gems = %w[
View utf5.rb
#!/usr/bin/env ruby -w
# Given a wearable computer with a 5 button 1-handed keyboard:
#
# [tmb] [idx] [mid] [rng] [pnk]
#
# How do you input text?
#
# UTF-5:
#
View wtf.rb
class Clevar
def self.method_missing m
p MM:m, SELF:self
self.class_eval <<-CODE
def self.#{m}
p :new_#{m}
end
CODE
end
end
View ar_sti_assoc_create_type_check.rb
raise "remove me: this bug has been fixed in rails 6" if RAILS6
module PatchPolymorphicCheck
ON_BAD_CREATE = :log
POOP = "💩".freeze
def _handle_create_type(inst, meth, &block)
klass = inst.class
actual = klass.name
expect = inst[klass.inheritance_column]