lolcat 42.0.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # lolcat (c)2011 moe@busyloop.net
5
+ #
6
+
7
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
8
+ # Version 2, December 2004
9
+ #
10
+ # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
11
+ #
12
+ # Everyone is permitted to copy and distribute verbatim or modified
13
+ # copies of this license document, and changing it is allowed as long
14
+ # as the name is changed.
15
+ #
16
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
17
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
18
+ #
19
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
20
+
21
+ require "lolcat/version"
22
+ require "lolcat/cat"
23
+
24
+ Lol.cat!
@@ -0,0 +1,21 @@
1
+ #
2
+ # lolcat (c)2011 moe@busyloop.net
3
+ #
4
+
5
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
6
+ # Version 2, December 2004
7
+ #
8
+ # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
9
+ #
10
+ # Everyone is permitted to copy and distribute verbatim or modified
11
+ # copies of this license document, and changing it is allowed as long
12
+ # as the name is changed.
13
+ #
14
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
15
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
16
+ #
17
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
18
+
19
+ require "lolcat/version"
20
+ require "lolcat/lol"
21
+ require "lolcat/cat"
@@ -0,0 +1,64 @@
1
+ #
2
+ # lolcat (c)2011 moe@busyloop.net
3
+ #
4
+
5
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
6
+ # Version 2, December 2004
7
+ #
8
+ # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
9
+ #
10
+ # Everyone is permitted to copy and distribute verbatim or modified
11
+ # copies of this license document, and changing it is allowed as long
12
+ # as the name is changed.
13
+ #
14
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
15
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
16
+ #
17
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
18
+
19
+ require "lolcat/version"
20
+ require "lolcat/lol"
21
+
22
+ require 'optparse'
23
+
24
+ module Lol
25
+ def self.cat!
26
+ if ['-h','--help','--halp','--version'].include? ARGV[0]
27
+ begin
28
+ puts
29
+ Lol.whut "Usage: lolcat [[file] [[file] [[file] [[file] [file]]]] [...]]", 20
30
+ puts
31
+ Lol.whut "Concatenate FILE(s), or standard input, to standard output.", 19
32
+ Lol.whut "With no FILE, or when FILE is -, read standard input.", 18
33
+ puts
34
+ Lol.whut " -h, --help, --halp, --version display this help and exit", 17
35
+
36
+ puts
37
+ Lol.whut "Examples:"
38
+ Lol.whut " lolcat f - g Output f's contents, then standard input, then g's contents.", 16
39
+ Lol.whut " lolcat Copy standard input to standard output.", 15
40
+ Lol.whut " fortune | lolcat Display a rainbow cookie.", 14
41
+
42
+ puts
43
+ Lol.whut "Report lolcat bugs to <http://www.github.org/busyloop/lolcat/>", 13
44
+ Lol.whut "lolcat home page: <http://www.github.org/busyloop/lolcat/>", 12
45
+ Lol.whut "Report lolcat translation bugs to <http://speaklolcat.com/>", 11
46
+ Lol.whut "For complete documentation, read the source!", 10
47
+ puts
48
+ rescue Interrupt
49
+ end
50
+ exit 1
51
+ end
52
+
53
+ begin
54
+ fds = ARGV.empty? ? [ARGF] : ARGV[0..-1]
55
+ fds.each do |file|
56
+ file = ARGF if file == '-'
57
+ file = File.open file unless file == ARGF
58
+ Lol.cat file,8
59
+ end
60
+ rescue Interrupt
61
+ end
62
+ end
63
+ end
64
+
@@ -0,0 +1,55 @@
1
+ #
2
+ # lolcat (c)2011 moe@busyloop.net
3
+ #
4
+
5
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
6
+ # Version 2, December 2004
7
+ #
8
+ # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
9
+ #
10
+ # Everyone is permitted to copy and distribute verbatim or modified
11
+ # copies of this license document, and changing it is allowed as long
12
+ # as the name is changed.
13
+ #
14
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
15
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
16
+ #
17
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
18
+
19
+ require "lolcat/version"
20
+
21
+ require 'paint'
22
+
23
+ module Lol
24
+ def self.rainbow(freq, i)
25
+ red = Math.sin(freq*i + 0) * 127 + 128
26
+ green = Math.sin(freq*i + 2*Math::PI/3) * 127 + 128
27
+ blue = Math.sin(freq*i + 4*Math::PI/3) * 127 + 128
28
+ "#%02X%02X%02X" % [ red, green, blue ]
29
+ end
30
+
31
+ def self.whut(text, duration=12, delay=0.05, spread=8)
32
+ (1..duration).each do |i|
33
+ print "\e[#{text.length}D"
34
+ text.chars.each_with_index do |c,j|
35
+ print Paint[c, rainbow(0.3, i+j/spread)]
36
+ end
37
+ sleep delay
38
+ end
39
+ puts
40
+ end
41
+
42
+ def self.lput(str, offset, spread)
43
+ print Paint[str, rainbow(0.3, offset/spread)]
44
+ end
45
+
46
+ def self.cat(fd, spread)
47
+ i=0
48
+ fd.each do |line|
49
+ line.chars.each_with_index do |c,j|
50
+ lput c, i+j, spread
51
+ end
52
+ i+=1
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,3 @@
1
+ module Lolcat
2
+ VERSION = "42.0.18"
3
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "lolcat/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "lolcat"
7
+ s.version = Lolcat::VERSION
8
+ s.authors = ["Moe"]
9
+ s.email = ["moe@busyloop.net"]
10
+ s.homepage = "https://github.com/busyloop/lolcat"
11
+ s.summary = %q{Rainbows and unicorns!}
12
+ s.description = %q{Okay, no unicorns. But rainbows!!}
13
+
14
+ #s.rubyforge_project = "lolcat"
15
+ s.add_dependency "paint", "~> 0.8.3"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lolcat
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 42
7
+ - 0
8
+ - 18
9
+ version: 42.0.18
10
+ platform: ruby
11
+ authors:
12
+ - Moe
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-08-10 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: paint
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 8
31
+ - 3
32
+ version: 0.8.3
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Okay, no unicorns. But rainbows!!
36
+ email:
37
+ - moe@busyloop.net
38
+ executables:
39
+ - lolcat
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - Rakefile
48
+ - bin/lolcat
49
+ - lib/lolcat.rb
50
+ - lib/lolcat/cat.rb
51
+ - lib/lolcat/lol.rb
52
+ - lib/lolcat/version.rb
53
+ - lolcat.gemspec
54
+ has_rdoc: true
55
+ homepage: https://github.com/busyloop/lolcat
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Rainbows and unicorns!
86
+ test_files: []
87
+