l33t-output 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in l33t-output.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Ben Olive
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ L33t Output
2
+ ===========
3
+
4
+ Make your output look l33t
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'l33t-output'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install l33t-output
19
+
20
+ ## Usage
21
+
22
+ ### In your code
23
+
24
+ To make all of your output super l33t, simply add the following line to the top of your program:
25
+
26
+ require 'l33t-output/autoload'
27
+
28
+ ### From the command line
29
+
30
+ To make the output of other programs super l33t, simply pipe them through `l33tcat`
31
+
32
+ echo "The eagle soars at noon" | l33tcat
33
+
34
+ or use it to spice up boring files
35
+
36
+ l33tcat LICENSE.txt
37
+
38
+
39
+ ## Contributing
40
+
41
+ 1. Fork it
42
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
43
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
44
+ 4. Push to the branch (`git push origin my-new-feature`)
45
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ lib = File.expand_path('../../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'l33t-output/autoload'
5
+
6
+ File.open(ARGV.shift || $stdin.fileno) do |file|
7
+ file.each_line {|l| puts l}
8
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'l33t-output/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "l33t-output"
8
+ gem.version = L33tOutput::VERSION
9
+ gem.authors = ["Ben Olive"]
10
+ gem.email = ["ben.olive@gatech.edu"]
11
+ gem.description = %q{Make your output look l33t}
12
+ gem.summary = %q{Make your output look l33t}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
@@ -0,0 +1,5 @@
1
+ require "l33t-output/version"
2
+ require "l33t-output/line"
3
+
4
+ module L33tOutput
5
+ end
@@ -0,0 +1,14 @@
1
+ # WARNING: including this file will globally alter the behavior of `puts`
2
+ require 'l33t-output/line'
3
+
4
+ module Kernel
5
+ undef :puts
6
+ def puts(*args)
7
+ args.each do |arg|
8
+ arg.to_s.each_line do |l|
9
+ L33tOutput::Line.new(l).output
10
+ end
11
+ end
12
+ nil
13
+ end
14
+ end
@@ -0,0 +1,53 @@
1
+ module L33tOutput
2
+ class Line
3
+ LETTERS = ('A'..'Z').to_a
4
+ LAG = 20
5
+ attr_reader :txt, :show, :out
6
+
7
+ def initialize(txt)
8
+ @txt = txt.upcase.strip
9
+ @out = $stdout
10
+ @counter = 0
11
+ @show = []
12
+ end
13
+
14
+ def output
15
+ rotate do
16
+ out.print "\r#{display}"
17
+ out.flush
18
+ sleep 0.01
19
+ end
20
+ out.puts
21
+ end
22
+
23
+ def display
24
+ txt.length.times.map{|i| got(i) or LETTERS.sample }.join
25
+ end
26
+
27
+ def done?
28
+ indices.empty?
29
+ end
30
+
31
+ def incr
32
+ show << indices.shift
33
+ end
34
+
35
+ private :show, :out
36
+
37
+ def indices
38
+ @indices ||= txt.length.times.to_a.shuffle
39
+ end
40
+
41
+ def got(i)
42
+ txt[i] if show.include? i
43
+ end
44
+
45
+ def rotate
46
+ begin
47
+ @counter += 1
48
+ incr if @counter % LAG
49
+ yield
50
+ end while not done?
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,4 @@
1
+ module L33tOutput
2
+ VERSION = "0.0.1"
3
+ end
4
+
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: l33t-output
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ben Olive
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-09 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Make your output look l33t
15
+ email:
16
+ - ben.olive@gatech.edu
17
+ executables:
18
+ - l33tcat
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - bin/l33tcat
28
+ - l33t-output.gemspec
29
+ - lib/l33t-output.rb
30
+ - lib/l33t-output/autoload.rb
31
+ - lib/l33t-output/line.rb
32
+ - lib/l33t-output/version.rb
33
+ homepage: ''
34
+ licenses: []
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 1.8.10
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: Make your output look l33t
57
+ test_files: []