Skip to content

Instantly share code, notes, and snippets.

View tadd's full-sized avatar

Tadashi Saito tadd

View GitHub Profile
@tadd
tadd / steep-check-0701.log
Created July 1, 2020 03:28
[7/1日版] Mastodonのapp/model/user.rbをsteep checkした結果
app/models/user.rb:187:28: UnexpectedSuper: method=inactive_message (super)
app/models/user.rb:198:4: UnexpectedSuper: method=update_tracked_fields! (super)
app/models/user.rb:252:45: NoMethodError: type=singleton(::SecureRandom), method=hex (SecureRandom.hex)
app/models/user.rb:277:4: UnexpectedSuper: method=password_required? (super)
app/models/user.rb:290:4: UnexpectedSuper: method=send_reset_password_instructions (super)
app/models/user.rb:296:4: UnexpectedSuper: method=reset_password! (super)
@tadd
tadd / steep-check.log
Created June 24, 2020 04:15
Mastodonのapp/model/user.rbをsteep checkした途中経過・動的ファイル生成版
$ be steep check app/models/user.rb
[Steep 0.17.1] [target=app] [target#type_check(target_sources: [app/models/user.rb], validate_signatures: true)] [synthesize:(45:1)] [synthesize:(46:3)] [synthesize:(249:3)] [synthesize:(249:24)] Unknown arg type: (arg request@10)
#<RuntimeError: Unexpected type for interface: untyped>
/home/tadashi/git/steep/lib/steep/ast/types/factory.rb:540:in `interface'
/home/tadashi/git/steep/lib/steep/type_construction.rb:1702:in `block (2 levels) in synthesize'
/home/tadashi/git/steep/lib/steep/type_construction.rb:1695:in `yield_self'
/home/tadashi/git/steep/lib/steep/type_construction.rb:1695:in `block in synthesize'
/home/tadashi/git/mastodon/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.4.3/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/home/tadashi/git/mastodon/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.4.3/lib/active_support/tagged_logging.rb:28:in `tagged'
/home/tadashi/git/mastodon/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.4.3/lib/active_support/
@tadd
tadd / steep-check.log
Last active June 24, 2020 04:14
Mastodonのapp/model/user.rbをsteep checkした途中経過・rbs prototype rb版
$ be steep check app/models/user.rb
#<RuntimeError: Unexpected type for interface: untyped>
/home/tadashi/git/steep/lib/steep/ast/types/factory.rb:540:in `interface'
/home/tadashi/git/steep/lib/steep/type_construction.rb:1702:in `block (2 levels) in synthesize'
/home/tadashi/git/steep/lib/steep/type_construction.rb:1695:in `yield_self'
/home/tadashi/git/steep/lib/steep/type_construction.rb:1695:in `block in synthesize'
/home/tadashi/git/mastodon/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.4.3/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/home/tadashi/git/mastodon/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.4.3/lib/active_support/tagged_logging.rb:28:in `tagged'
/home/tadashi/git/mastodon/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.4.3/lib/active_support/tagged_logging.rb:71:in `tagged'
/home/tadashi/git/steep/lib/steep/type_construction.rb:527:in `synthesize'
@tadd
tadd / pdftextdiff
Last active May 24, 2020 05:49
Visualize two pdfs as text files using pdftotext(1) and docdiff(1)
#!/bin/sh
set -ue
progname=`basename $0`
template="$progname.XXXXXXXXXX"
textfrom=`mktemp --tmpdir $template`
textto=`mktemp --tmpdir $template`
@tadd
tadd / mocha-native-esm.patch
Last active September 29, 2019 04:00
Short patch to load *.mjs from Mocha; run like `mocha test/*.mjs`
--- a/node_modules/mocha/lib/mocha.js
+++ b/node_modules/mocha/lib/mocha.js
@@ -321,15 +321,15 @@ Mocha.prototype.ui = function(ui) {
* @see {@link Mocha#unloadFiles}
* @param {Function} [fn] - Callback invoked upon completion.
*/
-Mocha.prototype.loadFiles = function(fn) {
+Mocha.prototype.loadFiles = async function(fn) {
var self = this;
var suite = this.suite;
@tadd
tadd / error.log
Created June 30, 2018 11:43
erb_with_resultのERB#result_with_hashがNetlify上のRuby2.4.3でうまく行かなかった
8:41:14 PM: NameError: undefined local variable or method `binding' for #<BasicObject:0x0000000001ee2b08>
8:41:14 PM: (erb):6:in `block in create_empty_binding'
8:41:14 PM: /opt/build/cache/bundle/ruby/2.4.0/bundler/gems/erb_with_hash-325afbd25abc/lib/erb_with_hash.rb:18:in `result_with_hash'
8:41:14 PM: /opt/build/repo/Rakefile:60:in `erb'
8:41:14 PM: /opt/build/repo/Rakefile:108:in `block (2 levels) in <top (required)>'
8:41:14 PM: /opt/build/cache/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
8:41:14 PM: /opt/buildhome/.rvm/gems/ruby-2.4.3/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `load'
8:41:14 PM: /opt/buildhome/.rvm/gems/ruby-2.4.3/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
8:41:14 PM: /opt/buildhome/.rvm/gems/ruby-2.4.3/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:28:in `run'
8:41:14 PM: /opt/buildhome/.rvm/gems/ruby-2.4.3/gems/bundler-1.16.2/lib/bundler/cli.rb:424:in `exec'
@tadd
tadd / test_undump.rb
Last active December 9, 2017 15:54
Tests for String#undump (based on the testcases in `string_undump` gem)
require 'test-unit'
class TestUndump < Test::Unit::TestCase
def test_undump
assert_equal('foo', '"foo"'.undump)
assert_equal('foo#$bar#@baz#{quxx}', '"foo\#$bar\#@baz\#{quxx}"'.undump)
assert_equal('\\', '"\\\\"'.undump)
assert_equal(%(\\"), '"\\\\\""'.undump)
assert_equal("\n", '"\n"'.undump)
assert_equal(%(\\"\n), '"\\\\\"\n"'.undump)
@tadd
tadd / ruby23.log
Created November 13, 2016 14:55
rational benchmark, Ruby 2.3 vs 2.4
Warming up --------------------------------------
rat + fix 134.525k i/100ms
rat + big 72.034k i/100ms
rat + flt 186.444k i/100ms
rat + rat 116.875k i/100ms
rat - fix 134.165k i/100ms
rat - big 65.282k i/100ms
rat - flt 182.951k i/100ms
rat - rat 153.479k i/100ms
rat * big 80.963k i/100ms
@tadd
tadd / hitokage.log
Last active June 11, 2016 07:52
Hitokage benchmark
$ ruby benchmark.rb
🐉 Small float numbers, count=5000000, range=0.0...1.0
user system total real
Float#to_s 5.420000 0.000000 5.420000 ( 5.414845)
Float#hitokage_to_s 1.340000 0.000000 1.340000 ( 1.345971)
Verifying results...👍
🐉 Usual float numbers, count=5000000, range=0.0...10000000.0
user system total real
Float#to_s 5.240000 0.010000 5.250000 ( 5.243546)
@tadd
tadd / Makefile
Created November 3, 2015 07:12
ruby trunk build failed
RUBY_RELEASE_DATE = 2015-11-03
SHELL = /bin/sh
NULLCMD = :
n=$(NULLCMD)
ECHO1 = $(V:1=$n)
RUNCMD = $(SHELL)
CDPATH = .
CHDIR = cd -P
exec = exec
NULL = /dev/null