zalgo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.textile +0 -0
  2. data/bin/zalgo +11 -0
  3. data/lib/zalgo.rb +89 -0
  4. metadata +64 -0
data/README.textile ADDED
File without changes
data/bin/zalgo ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+
5
+ begin
6
+ require 'zalgo'
7
+ rescue LoadError
8
+ require 'lib/zalgo/zalgo'
9
+ end
10
+
11
+ puts Zalgo.he_comes ARGV.join(' ')
data/lib/zalgo.rb ADDED
@@ -0,0 +1,89 @@
1
+ # -*- coding: utf-8 -*-
2
+ $KCODE = 'UTF-8'
3
+
4
+ module Zalgo
5
+ module Characters
6
+ def self.up
7
+ %w{
8
+ ̍ ̎ ̄ ̅
9
+ ̿ ̑ ̆ ̐
10
+ ͒ ͗ ͑ ̇
11
+ ̈ ̊ ͂ ̓
12
+ ̈ ͊ ͋ ͌
13
+ ̃ ̂ ̌ ͐
14
+ ̀ ́ ̋ ̏
15
+ ̒ ̓ ̔ ̽
16
+ ̉ ͣ ͤ ͥ
17
+ ͦ ͧ ͨ ͩ
18
+ ͪ ͫ ͬ ͭ
19
+ ͮ ͯ ̾ ͛
20
+ ͆ ̚
21
+ }
22
+ end
23
+
24
+ def self.down
25
+ %w{
26
+ ̖ ̗ ̘ ̙
27
+ ̜ ̝ ̞ ̟
28
+ ̠ ̤ ̥ ̦
29
+ ̩ ̪ ̫ ̬
30
+ ̭ ̮ ̯ ̰
31
+ ̱ ̲ ̳ ̹
32
+ ̺ ̻ ̼ ͅ
33
+ ͇ ͈ ͉ ͍
34
+ ͎ ͓ ͔ ͕
35
+ ͖ ͙ ͚ ̣
36
+ }
37
+ end
38
+
39
+ def self.mid
40
+ %w{
41
+ ̕ ̛ ̀ ́
42
+ ͘ ̡ ̢ ̧
43
+ ̨ ̴ ̵ ̶
44
+ ͏ ͜ ͝ ͞
45
+ ͟ ͠ ͢ ̸
46
+ ̷ ͡ ҉_
47
+ }
48
+ end
49
+
50
+ def self.all ; up + down + mid ; end
51
+
52
+ def self.is_char?(char)
53
+ all.find { |c| c == char }
54
+ end
55
+ end
56
+
57
+ def self.he_comes(text, options = {})
58
+ result = ''
59
+ options = { :up => true, :mid => true, :down => true }.merge options
60
+
61
+ text.each_char.each do |char|
62
+ next if Characters.is_char? char
63
+
64
+ result << char
65
+ counts = { :up => 0, :mid => 0, :down => 0 }
66
+
67
+ case options[:size]
68
+ when :mini
69
+ counts[:up] = rand(8)
70
+ counts[:mid] = rand(2)
71
+ counts[:down] = rand(8)
72
+ when :maxi
73
+ counts[:up] = rand(16) + 3
74
+ counts[:mid] = rand(4) + 1
75
+ counts[:down] = rand(64) + 3
76
+ else
77
+ counts[:up] = rand(8) + 1
78
+ counts[:mid] = rand(6) / 2
79
+ counts[:down] = rand(8) + 1
80
+ end
81
+
82
+ [:up, :mid, :down].each do |d|
83
+ counts[d].times { result << Characters.send(d)[rand Characters.send(d).size] } if options[d]
84
+ end
85
+ end
86
+
87
+ result
88
+ end
89
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zalgo
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Alex R. Young
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-05-07 00:00:00 +01:00
18
+ default_executable: bin/jschat-server
19
+ dependencies: []
20
+
21
+ description: HE COMES.
22
+ email: alex@alexyoung.org
23
+ executables:
24
+ - zalgo
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - bin/zalgo
31
+ - lib/zalgo.rb
32
+ - README.textile
33
+ has_rdoc: false
34
+ homepage: http://github.com/alexyoung/zalgo
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.3.6
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: Generates zalgo
63
+ test_files: []
64
+