leet 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b42d3cef35eec387ecfe6c3b9ee085fcc6717a1e
4
+ data.tar.gz: 79cd0f0af257b1569b9696040254f672438cd570
5
+ SHA512:
6
+ metadata.gz: 86f02019a27dfa86f5bdf2e05a0d03fef2ab514c1d9d619a0b5b1bf868b9746c694ac451716957cac800344867ac0162e21eb0b569628092de47825635c662d5
7
+ data.tar.gz: 0b61c8ec72fba6b09b9891a60aed2cf36d7b51d2c5598db8550b6b59f16d6f66f9f8164b7e76ca355c8fdee3fcf48f99a16ccc2c6980a58487e84b55a19087e4
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ pkg/*
4
+
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ leet gem
2
+ ==========
3
+
4
+ A ruby gem that convert string to leet or unleet it.
5
+
6
+ Every leet code only has a source char for unleet.
7
+
8
+ Thanks to the leet table [on wikipedia](https://zh.wikipedia.org/wiki/Leet).
9
+
10
+ # usage
11
+
12
+ ```
13
+ gem install leet
14
+ ```
15
+
16
+ ## bin
17
+
18
+ ```sh
19
+ $ leet "I Love Ruby!"
20
+ $ 3y3 [_<>\|& /2(_)13\|/!
21
+ ```
22
+ ## code
23
+
24
+ ```ruby
25
+ require 'leet'
26
+
27
+ puts "I Love Ruby!".leet
28
+ #=> j 1_p\/|=- .-L|/3`/!
29
+ ```
30
+
31
+ # TODO
32
+
33
+ * unleet
34
+ * han pinyin
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/leet ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/leet'
4
+
5
+ if ARGV.count != 1
6
+ puts "With the given string to leet."
7
+ puts 'usage: leet "I Love Ruby!"'
8
+ exit
9
+ end
10
+
11
+ puts ARGV[0].leet
data/leet.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
+ require 'leet/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'leet'
7
+ s.version = Leet::VERSION
8
+ s.licenses = ['MIT']
9
+ s.date = '2015-12-24'
10
+ s.summary = "Convert string to leet or unleet it."
11
+ s.description = "A ruby gem that convert string to leet or unleet it."
12
+ s.authors = ["Aston Fu"]
13
+ s.email = 'im@fuhao.im'
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.require_paths = ['lib']
17
+ s.executables = %w(leet)
18
+ s.homepage = 'https://github.com/astonfu/leet'
19
+ end
data/lib/leet/leet.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'yaml'
2
+
3
+ module Leet
4
+ LEETS = YAML.load_file File.join(__dir__, 'leets.yml')
5
+
6
+ def str2leet(str)
7
+ result = ""
8
+ str.to_s.each_char do |char|
9
+ leet = char
10
+ tmp = LEETS[char.downcase]
11
+ leet = tmp.sample if tmp != nil
12
+ result << leet
13
+ end
14
+ result
15
+ end
16
+ module_function :str2leet
17
+
18
+ def leet2str(leet)
19
+ "TODO..."
20
+ end
21
+ module_function :leet2str
22
+ end
@@ -0,0 +1,272 @@
1
+ ---
2
+ a:
3
+ - '4'
4
+ - '/\'
5
+ - '@'
6
+ - '/-\'
7
+ - '^'
8
+ - 'aye'
9
+ - '(L'
10
+ - 'Д'
11
+
12
+ b:
13
+ - '8'
14
+ - '13'
15
+ - '|3'
16
+ - 'ß'
17
+ - 'P>'
18
+ - '|:'
19
+ - ' !3'
20
+ - '(3'
21
+ - '/3'
22
+ - ')3'
23
+ - '|-]'
24
+
25
+ c:
26
+ - '['
27
+ - '¢'
28
+ - '<'
29
+ - '('
30
+ - '©'
31
+
32
+ d:
33
+ - ')'
34
+ - '|)'
35
+ - '(|'
36
+ - '|o'
37
+ - '[)'
38
+ - 'I>'
39
+ - '|>'
40
+ - ' ?'
41
+ - 'T)'
42
+ - 'I7'
43
+ - 'cl'
44
+
45
+ e:
46
+ - '3'
47
+ - '&'
48
+ - '£'
49
+ - '€'
50
+ - 'ë'
51
+ - '[-'
52
+ - '|=-'
53
+
54
+ f:
55
+ - '|='
56
+ - 'ƒ'
57
+ - '|#'
58
+ - 'ph'
59
+ - '/='
60
+ - 'v'
61
+
62
+ g:
63
+ - '6'
64
+ - '&'
65
+ - '(_+'
66
+ - '9'
67
+ - 'C-'
68
+ - 'gee'
69
+ - '(?,'
70
+ - '[,'
71
+ - '{,'
72
+ - '<-'
73
+ - '(.'
74
+
75
+ h:
76
+ - '#'
77
+ - '/-/'
78
+ - '[-]'
79
+ - ']-['
80
+ - ')-('
81
+ - '(-)'
82
+ - ' :-:'
83
+ - '|~|'
84
+ - '|-|'
85
+ - ']~['
86
+ - '}{'
87
+ - ' !-!'
88
+ - '1-1'
89
+ - '\-/'
90
+ - 'I+I'
91
+ - ' ?'
92
+ - '}-{'
93
+
94
+ i:
95
+ - '1'
96
+ - '!'
97
+ - '¡'
98
+ - 'j'
99
+ - '|'
100
+ - 'eye'
101
+ - '3y3'
102
+ - ']['
103
+ - ']'
104
+ - '/me'
105
+
106
+ j:
107
+ - '_|'
108
+ - '_/'
109
+ - '¿'
110
+ - '</'
111
+ - '_]'
112
+ - '(/'
113
+
114
+ k:
115
+ - 'X'
116
+ - '|<'
117
+ - '|{'
118
+ - ']{'
119
+ - '|X'
120
+
121
+ l:
122
+ - '£'
123
+ - '1_'
124
+ - '|_'
125
+ - 'el'
126
+ - '[]_'
127
+ - '[_'
128
+ - '7'
129
+
130
+ m:
131
+ - '|v|'
132
+ - '[V]'
133
+ - '{V}'
134
+ - 'em'
135
+ - 'AA'
136
+ - '|\/|'
137
+ - '/\/\'
138
+ - '(u)'
139
+ - '(V)'
140
+ - '(\/)'
141
+ - '/|\'
142
+ - '^^'
143
+ - '/|/|'
144
+ - '//\'
145
+ - '|\|\'
146
+ - ']\/['
147
+
148
+ n:
149
+ - '^/'
150
+ - '|\|'
151
+ - '/\/'
152
+ - '[\]'
153
+ - '<\>'
154
+ - '{\}'
155
+ - '[]\'
156
+ - '//[]'
157
+ - '/V'
158
+ - 'И'
159
+ - '^'
160
+
161
+ o:
162
+ - '0'
163
+ - '()'
164
+ - 'oh'
165
+ - '[]'
166
+ - 'p'
167
+ - '<>'
168
+
169
+ p:
170
+ - '|*'
171
+ - '|o'
172
+ - '|º'
173
+ - ' ?'
174
+ - '|^(o)'
175
+ - '|>'
176
+ - '|"'
177
+ - '9'
178
+ - '[]D'
179
+ - '|°'
180
+ - '|7'
181
+
182
+ q:
183
+ - '(_,)'
184
+ - '()_'
185
+ - '0_'
186
+ - '<|'
187
+
188
+ r:
189
+ - '|`'
190
+ - '|~'
191
+ - '|?'
192
+ - '/2'
193
+ - '|^'
194
+ - 'lz'
195
+ - '|9'
196
+ - '2'
197
+ - '12'
198
+ - '®'
199
+ - '[z'
200
+ - 'Я'
201
+ - '.-'
202
+ - '|2'
203
+ - '|-'
204
+
205
+ s:
206
+ - '5'
207
+ - '$'
208
+ - 'z'
209
+ - '§'
210
+ - 'ehs'
211
+ - 'es'
212
+
213
+ t:
214
+ - '+'
215
+ - '-|-'
216
+ - "']['"
217
+ - '†'
218
+ - '"|"'
219
+
220
+ u:
221
+ - '(_)'
222
+ - '|_|'
223
+ - 'v'
224
+ - 'L|'
225
+ - 'µ'
226
+
227
+ v:
228
+ - '\/'
229
+ - '|/'
230
+ - '\|'
231
+
232
+ w:
233
+ - '\/\/'
234
+ - 'vv'
235
+ - '\N'
236
+ - "'//"
237
+ - "\\'"
238
+ - '\^/'
239
+ - 'dubya'
240
+ - '(n)'
241
+ - '\V/'
242
+ - '\X/'
243
+ - '\|/'
244
+ - '\_|_/'
245
+ - '\_:_/'
246
+ - '?'
247
+ - 'uu'
248
+ - '2u'
249
+
250
+ x:
251
+ - '><'
252
+ - 'Ж'
253
+ - '}{'
254
+ - 'ecks'
255
+ - '×'
256
+ - '?'
257
+ - ')('
258
+ - ']['
259
+ - '}{'
260
+
261
+ y:
262
+ - '`/'
263
+ - 'Ч'
264
+ - '\|/'
265
+ - '¥'
266
+
267
+ z:
268
+ - '7_'
269
+ - '-/_'
270
+ - '%'
271
+ - '>_'
272
+ - 's'
@@ -0,0 +1,13 @@
1
+ require_relative './leet'
2
+
3
+ module Leet
4
+ module String
5
+ def leet
6
+ Leet::str2leet self
7
+ end
8
+
9
+ def unleet
10
+ Leet::leet2str self
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Leet
2
+ VERSION = '0.0.1'
3
+ end
data/lib/leet.rb ADDED
@@ -0,0 +1,6 @@
1
+ require_relative './leet/version'
2
+ require_relative './leet/string'
3
+
4
+ class String
5
+ include Leet::String
6
+ end
data/spec/leet_spec.rb ADDED
@@ -0,0 +1,14 @@
1
+ require_relative '../lib/leet'
2
+ require_relative './spec_helper'
3
+
4
+ describe Leet do
5
+ describe 'a..z' do
6
+ ('a'..'z').to_a.each do |c|
7
+ leet = c.leet
8
+ puts "#{c}: #{leet}"
9
+ it "char should not be it self" do
10
+ expect(c).not_to eq(leet)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,91 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Limits the available syntax to the non-monkey patched syntax that is
54
+ # recommended. For more details, see:
55
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
56
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
57
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
58
+ config.disable_monkey_patching!
59
+
60
+ # This setting enables warnings. It's recommended, but in some cases may
61
+ # be too noisy due to issues in dependencies.
62
+ config.warnings = true
63
+
64
+ # Many RSpec users commonly either run the entire suite or an individual
65
+ # file, and it's useful to allow more verbose output when running an
66
+ # individual spec file.
67
+ if config.files_to_run.one?
68
+ # Use the documentation formatter for detailed output,
69
+ # unless a formatter has already been configured
70
+ # (e.g. via a command-line flag).
71
+ config.default_formatter = 'doc'
72
+ end
73
+
74
+ # Print the 10 slowest examples and example groups at the
75
+ # end of the spec run, to help surface which specs are running
76
+ # particularly slow.
77
+ config.profile_examples = 10
78
+
79
+ # Run specs in random order to surface order dependencies. If you find an
80
+ # order dependency and want to debug it, you can fix the order by providing
81
+ # the seed, which is printed after each run.
82
+ # --seed 1234
83
+ config.order = :random
84
+
85
+ # Seed global randomization in this process using the `--seed` CLI option.
86
+ # Setting this allows you to use `--seed` to deterministically reproduce
87
+ # test failures related to randomization by passing the same `--seed` value
88
+ # as the one that triggered the failure.
89
+ Kernel.srand config.seed
90
+ =end
91
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Aston Fu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-12-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A ruby gem that convert string to leet or unleet it.
14
+ email: im@fuhao.im
15
+ executables:
16
+ - leet
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - .gitignore
21
+ - .rspec
22
+ - README.md
23
+ - Rakefile
24
+ - bin/leet
25
+ - leet.gemspec
26
+ - lib/leet.rb
27
+ - lib/leet/leet.rb
28
+ - lib/leet/leets.yml
29
+ - lib/leet/string.rb
30
+ - lib/leet/version.rb
31
+ - spec/leet_spec.rb
32
+ - spec/spec_helper.rb
33
+ homepage: https://github.com/astonfu/leet
34
+ licenses:
35
+ - MIT
36
+ metadata: {}
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 2.2.2
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: Convert string to leet or unleet it.
57
+ test_files: []
58
+ has_rdoc: