Skip to content

Instantly share code, notes, and snippets.

View ydah's full-sized avatar
🏠
Working from home

Yudai Takada ydah

🏠
Working from home
View GitHub Profile
@tompng
tompng / regexp_test.rb
Created December 27, 2023 12:05
regexp
class Generator
def generate_paren(level)
regexp, producer = multi(level - 1)
[['(', '(?:', '(?<a>'].sample + regexp + ')', producer]
end
ALPHABET = ('a'..'z').to_a
def generate_alphabet(_level)
c = ALPHABET.sample
@kakutani
kakutani / ruby-advent-20221211_kakutani.md
Last active December 12, 2022 22:26
日本Rubyの会のほうから来ました

日本Rubyの会のほうから来ました

この記事はRuby Advent Calendar 2022の第11日の記事です。前日の記事は@taichi-ishitaniさんによる「YAML 上の位置を取得する」でした。

日本Rubyの会の理事の@kakutaniです。この記事はあくまで個人の見解であり、会の公式見解ではありません。

in-person開催のイベントが「帰って」きましたね

ここ2年ほどのコロナ禍のなか、日本Rubyの会の活動はいつも以上に元気がありませんでしたが、2022年にRubyKaigiがin-personで開催されのは、なんか日本のRubyコミュニティの活動を再始動させるきっかけになった気がします。参加した皆さんは楽しんでくれたようでしたし、オンライン参加だった方がたからも「次はやっぱり現地に行こうと思った」という声を少ならからず聞いています。RubyKaigi 2022以降、ふりかえってみると国内でも毎月のようにRuby関連イベントは開催されていたのでした。

@kddnewton
kddnewton / latexify.rb
Last active November 7, 2022 14:45
LaTeXify Ruby methods
#!/usr/bin/env ruby
# frozen_string_literal: true
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "syntax_tree"
end
@ymmt2005
ymmt2005 / howto-tech-docs.md
Last active May 10, 2024 03:46
技術文書の書き方

技術文書の書き方

このメモは、私(@ymmt2005)が長年にわたってソフトウェアプロダクト開発に関わってきて 2022年現在こうしたほうが良いと考えているベストプラクティスです。

科学的な分析等に基づくわけではない経験則であるため、今後も随時見直すことがありますし、 ここに書いてあることが常に正しいわけでもあらゆるソフトウェア開発に適するわけでもありません。

しかしながら、実務経験が豊富で、モダンな技術スタックに明るいエンジニアの経験則は一定の 役に立つのではないかと考えて記します。

@sasasin
sasasin / esa-stop-sharing.rb
Last active May 24, 2022 06:16
esa の外部公開ページを一括で非公開にするやつ
#!/usr/bin/env ruby
# 意図せず外部公開にしてたり、用が済んだのに外部公開のままにしてたり、
# そういう esa の外部公開ページを一括で非公開にするやつ
# 参考:
# https://docs.esa.io/posts/102
# https://github.com/esaio/esa-ruby
require 'esa'
# set esa team name.
# https://${ESA_TEAM_NAME}.esa.io
@willnet
willnet / should_have_length_validations.rb
Last active May 13, 2022 02:42
string型もしくはtext型なのに最大長のバリデーションをかけていないものを出力するスクリプト
ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |model|
string_or_text_columns = model.columns.select { |column| column.type == :string || column.type == :text }
columns_with_maximum_length_validation = model.validators.select {|v| v.is_a? ActiveRecord::Validations::LengthValidator }.select {|v| v.options[:maximum] || v.options[:within] }.map(&:attributes).flatten.uniq
string_or_text_columns.each do |column|
if columns_with_maximum_length_validation.include?(column.name.to_sym)
puts "#{model.name}##{column.name} is OK"
else
puts "#{model.name}##{column.name} is NG"
end
end
@kat0h
kat0h / quine_clock.rb
Created May 9, 2021 00:51
[Quine] Clock.rb
eval$s=%w' t="e val$
s=% w"<< 39<< ($s*
3);s =?0 ;b=[ ""]*
7;Ti me .now .str
ftim e( "%H: %M")
.spl it(" ").e
ach{ |n|c =[12
6,48 ,109 ,121
,51,9 1,95 ,112
,127, 123] [n.to_ i];h= ->(i ){n=
@JunichiIto
JunichiIto / alias_matchers.md
Last active June 24, 2024 21:02
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@raven38
raven38 / 0.0.markdown
Last active July 6, 2023 09:32
『コンパイラ 原理・技法・ツール』読書メモ

#コンパイラ 原理 技法 ツール


######著者

  • Alfred V. Aho
  • Jeffrey D. Ullman

コンパイラ 原理 技法 ツール、通称ドラゴン本の訳書です。 出版社が培風館で情報処理シリーズのうちの一巻なので表紙がドラゴンじゃない