Skip to content

Instantly share code, notes, and snippets.

View shyouhei's full-sized avatar

卜部昌平 shyouhei

View GitHub Profile
@shyouhei
shyouhei / -
Created January 17, 2017 22:28
zsh % ./miniruby --dump=insns -ve '[*ary1, *ary2]'
ruby 2.5.0dev (2017-01-17) [x86_64-darwin15]
== disasm: #<ISeq:<main>@-e>============================================
0000 trace 1 ( 1)
0002 putself
0003 opt_send_without_block <callinfo!mid:ary1, argc:0, FCALL|VCALL|ARGS_SIMPLE>, <callcache>
0006 splatarray true
0008 putself
0009 opt_send_without_block <callinfo!mid:ary2, argc:0, FCALL|VCALL|ARGS_SIMPLE>, <callcache>
0012 concatarray
@shyouhei
shyouhei / -
Created January 17, 2017 07:33
zsh % ./miniruby --dump=insns -ve '$~ = 1234'
ruby 2.5.0dev (2017-01-17) [x86_64-darwin15]
== disasm: #<ISeq:<main>@-e>============================================
0000 trace 1 ( 1)
0002 putobject 1234
0004 dup
0005 setglobal $~
0007 leave
@shyouhei
shyouhei / -
Created January 17, 2017 07:21
zsh % ./miniruby --dump=insns -ve '$_'
ruby 2.5.0dev (2017-01-17) [x86_64-darwin15]
-e:1: warning: possibly useless use of a variable in void context
== disasm: #<ISeq:<main>@-e>============================================
0000 trace 1 ( 1)
0002 getglobal $_
0004 leave
-: 0:Source:insns.def
-: 0:Graph:vm.gcno
-: 0:Data:vm.gcda
-: 0:Runs:387
-: 0:Programs:1
-: 1:/** ##skip -*- mode:c; style:ruby; coding: utf-8 -*-
-: 2: insns.def - YARV instruction definitions
-: 3:
-: 4: $Author: $
-: 5: created at: 04/01/01 01:17:55 JST
@shyouhei
shyouhei / -
Created November 16, 2016 10:38
num calls time self name
-----------------------------------------------------------------------------------
1) 9 1845.61 205.07 73.57% 1827.60 203.07 72.85% (anon)
2) 6 196.11 32.69 7.82% 188.84 31.47 7.53% __zplug::core::core::get_interfaces
3) 2 141.01 70.50 5.62% 112.24 56.12 4.47% compinit
4) 1 485.69 485.69 19.36% 72.32 72.32 2.88% __zplug::io::cache::load
5) 2 50.65 25.32 2.02% 50.44 25.22 2.01% __zplug::base::base::git_version
6) 1 44.42 44.42 1.77% 44.30 44.30 1.77% _zsh_highlight_load_highlighters
7) 2 34.01 17.00 1.36% 34.01 17.00 1.36% __zplug::utils::awk::available
8) 2 28.76 14.38 1.15% 28.76 14.38 1.15% compaudit
diff --git a/ChangeLog b/ChangeLog
index d3b2eee..3dece77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8166,8 +8166,8 @@ For the changes before 1.8.0, see doc/ChangeLog-1.8.0
Local variables:
coding: us-ascii
-add-log-time-format: (lambda ()
- (let* ((time (current-time))
  • original: まあRubyの場合ナイスナイスいうわりに女性は増えないし人種も増えないし、なにかの参入障壁はあるんだとおもうよ。そういうのを改善していくこと自体は否定すべきではないよ。各論がいろいろあるのはわかるけど大まかな方向性としてはもっと開かれていくべきというのは正しいと思う。
  • translated: "Well, when it comes to Ruby, they say ``nice'' frequently but the fact is that women are not increasing; also not racial diversity. I guess there are something that prevent variety. I think we should not deny improving this situation. I know there are debates in particular areas but in general, it should become more open."

(translation note: the "Ruby" here points to Ruby's core development, not e.g. Rails.)

n = ARGV.first.to_i
size = n * 4 + 1
spiral = Array.new(size) { Array.new(size) { ' ' } }
def Archimedean_spiral_sequence(n)
if n == 0
yield 0, 0
else
Archimedean_spiral_sequence(n - 1) do |x, y|
yield x + 2, y + 2
def Archimedean_spiral n
if n == 0
return [ [ '#' ] ]
else
inner = Archimedean_spiral(n - 1)
length = inner.size
ret = []
ret << ([ '#', '#' ] + ([ '#' ] * length) + [ '#', '#' ] )
ret << ([ '#', ' ' ] + ([ ' ' ] * length) + [ ' ', ' ' ] )
inner.each do |x|
@shyouhei
shyouhei / gist:0b7dab3e75bfbf96f895
Created March 31, 2015 15:26
新社会人の人が留意すべき事項

新社会人に必須である:

  • 勤務先との書面による「労働契約」。業務委託契約等NG。
  • 多寡を問わず毎月払われる給料。遅配等論外である。
  • 健康保険。
  • 労災保険。
  • 雇用保険。
  • 三六協定。
  • 年次有休。
  • 育児休業の制度があり取得者がいる会社に勤務する。