INNER CODE UNIT · Ruby

INCOMPLETE_ESCAPE

busyloop/lolcat · lib/lolcat/lol.rb:31

  INCOMPLETE_ESCAPE = /\e(?:[ -\/]*|[\]PX^_][^\a\e]*|\[[0-?]*)$/

  @os = 0
  @paint_init = false

  def self.rainbow(freq, i)
     red   = Math.sin(freq*i + 0) * 127 + 128
     green = Math.sin(freq*i + 2*Math::PI/3) * 127 + 128
     blue  = Math.sin(freq*i + 4*Math::PI/3) * 127 + 128
     "#%02X%02X%02X" % [ red, green, blue ]
  end

  def self.cat(fd, opts={})
    @os = opts[:os]
    print "\e[?25l" if opts[:animate]
    while true do
      buf = ''
      begin

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…