sad_squid 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/sad_squid.rb +17 -0
- data/lib/sad_squid/sentance.rb +65 -0
- data/lib/sad_squid/version.rb +3 -0
- data/lib/sad_squid/words.rb +121 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 56b40818c94224ede801b5ae7a91e1c749ffcccd
|
4
|
+
data.tar.gz: 88898377bc32837bfc43b5a42f33daa914e1a824
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 15682bf639c8c902b6d2f4f149cbf4c3616b770d6dfe3ca72d8147a60aa24c53663a7f9793838f10fa3f2b24582d3365c5040d750d04c3753d6db681aa04051b
|
7
|
+
data.tar.gz: d9ddb026dbc7fdfdd8a5e79e76282cfa8e3ca43ff5bfa0250a5da31c738cf2f8e3064653eeb5f505478c426dde70140cd00e7b7fefd3765c68da43b57cc67f8c
|
data/lib/sad_squid.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Copyright 2013 Rickard Dybeck
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'sad_squid/words'
|
16
|
+
require 'sad_squid/sentance'
|
17
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Copyright 2013 Rickard Dybeck
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
module SadSquid
|
16
|
+
class Sentance
|
17
|
+
|
18
|
+
attr_accessor :adjectives, :nouns, :verbs, :adverbs
|
19
|
+
|
20
|
+
def adjectives
|
21
|
+
@adjectives ||= Words.adjectives
|
22
|
+
end
|
23
|
+
|
24
|
+
def nouns
|
25
|
+
@nouns ||= Words.nouns
|
26
|
+
end
|
27
|
+
|
28
|
+
def verbs
|
29
|
+
@verbs ||= Words.verbs
|
30
|
+
end
|
31
|
+
|
32
|
+
def adverbs
|
33
|
+
@adverbs ||= Words.adverbs
|
34
|
+
end
|
35
|
+
|
36
|
+
def generate
|
37
|
+
count = Random.rand(33) + 2
|
38
|
+
adjective = adjectives.sample
|
39
|
+
noun = nouns.sample
|
40
|
+
verb = verbs.sample
|
41
|
+
adverb = adverbs.sample
|
42
|
+
|
43
|
+
[count, adjective, noun, verb, adverb].join(" ");
|
44
|
+
end
|
45
|
+
|
46
|
+
def decode string
|
47
|
+
adjective_factor = 32
|
48
|
+
noun_factor = adjective_factor * nouns.length
|
49
|
+
verb_factor = noun_factor * verbs.length
|
50
|
+
adverb_factor = verb_factor * adverbs.length
|
51
|
+
|
52
|
+
arr = string.split(' ')
|
53
|
+
count = arr[0].to_i
|
54
|
+
adjective = adjectives.index arr[1]
|
55
|
+
noun = nouns.index arr[2]
|
56
|
+
verb = verbs.index arr[3]
|
57
|
+
adverb = adverbs.index arr[4]
|
58
|
+
|
59
|
+
count + adjective * adjective_factor +
|
60
|
+
noun * noun_factor +
|
61
|
+
verb * verb_factor +
|
62
|
+
adverb * adverb_factor
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# Copyright 2013 Rickard Dybeck
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
module SadSquid
|
16
|
+
class Words
|
17
|
+
def self.adjectives
|
18
|
+
[
|
19
|
+
'adorable', 'adventurous', 'alluring', 'amazing',
|
20
|
+
'ambitious', 'amusing', 'astonishing', 'attractive', 'awesome',
|
21
|
+
'bashful', 'bawdy', 'beautiful', 'bewildered', 'bizarre', 'bouncy',
|
22
|
+
'brainy', 'brave', 'brawny', 'burly', 'capricious', 'careful',
|
23
|
+
'caring', 'cautious', 'charming', 'cheerful', 'chivalrous',
|
24
|
+
'classy', 'clever', 'clumsy', 'colossal', 'cool', 'coordinated',
|
25
|
+
'courageous', 'cuddly', 'curious', 'cute', 'daffy', 'dapper',
|
26
|
+
'dashing', 'dazzling', 'delicate', 'delightful', 'determined',
|
27
|
+
'eager', 'embarrassed', 'enchanted', 'energetic', 'enormous',
|
28
|
+
'entertaining', 'enthralling', 'enthusiastic', 'evanescent',
|
29
|
+
'excited', 'exotic', 'exuberant', 'exultant', 'fabulous', 'fancy',
|
30
|
+
'festive', 'finicky', 'flashy', 'flippant', 'fluffy', 'fluttering',
|
31
|
+
'funny', 'furry', 'fuzzy', 'gaudy', 'gentle', 'giddy', 'glamorous',
|
32
|
+
'gleaming', 'goofy', 'gorgeous', 'graceful', 'grandiose', 'groovy',
|
33
|
+
'handsome', 'happy', 'hilarious', 'honorable', 'hulking',
|
34
|
+
'humorous', 'industrious', 'incredible', 'intelligent', 'jazzy',
|
35
|
+
'jolly', 'joyous', 'kind', 'macho', 'magnificent', 'majestic',
|
36
|
+
'marvelous', 'mighty', 'mysterious', 'naughty', 'nimble', 'nutty',
|
37
|
+
'oafish', 'obnoxious', 'outrageous', 'pretty', 'psychedelic',
|
38
|
+
'psychotic', 'puzzled', 'quirky', 'quizzical', 'rambunctious',
|
39
|
+
'remarkable', 'sassy', 'sad', 'smelly', 'sneaky', 'spiffy',
|
40
|
+
'swanky', 'sweet', 'swift', 'talented', 'thundering', 'unkempt',
|
41
|
+
'upbeat', 'uppity', 'wacky', 'waggish', 'whimsical', 'wiggly',
|
42
|
+
'zany'
|
43
|
+
]
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.nouns
|
47
|
+
[
|
48
|
+
'aardvarks', 'alligators', 'alpacas', 'anteaters', 'antelopes',
|
49
|
+
'armadillos', 'baboons', 'badgers', 'bears', 'beavers',
|
50
|
+
'boars', 'buffalos', 'bulls', 'bunnies', 'camels', 'cats',
|
51
|
+
'chameleons', 'cheetahs', 'centaurs', 'chickens', 'chimpanzees',
|
52
|
+
'chinchillas', 'chipmunks', 'cougars', 'cows', 'coyotes', 'cranes',
|
53
|
+
'crickets', 'crocodiles', 'deers', 'dinasaurs', 'dingos', 'dogs',
|
54
|
+
'donkeys', 'dragons', 'elephants', 'elves', 'ferrets', 'flamingos',
|
55
|
+
'foxes', 'frogs', 'gazelles', 'giraffes', 'gnomes', 'gnus', 'goats',
|
56
|
+
'gophers', 'gorillas', 'hamsters', 'hedgehogs', 'hippopotamus',
|
57
|
+
'hobbits', 'hogs', 'horses', 'hyenas', 'ibexes', 'iguanas',
|
58
|
+
'impalas', 'jackals', 'jackalopes', 'jaguars', 'kangaroos',
|
59
|
+
'kittens', 'koalas', 'lambs', 'lemmings', 'leopards', 'lions',
|
60
|
+
'ligers', 'lizards', 'llamas', 'lynxes', 'meerkat', 'moles',
|
61
|
+
'mongooses', 'monkeys', 'moose', 'mules', 'newts', 'okapis',
|
62
|
+
'orangutans', 'ostriches', 'otters', 'oxes', 'pandas', 'panthers',
|
63
|
+
'peacocks', 'pegasuses', 'phoenixes', 'pigeons', 'pigs',
|
64
|
+
'platypuses', 'ponies', 'porcupines', 'porpoises', 'pumas',
|
65
|
+
'pythons', 'rabbits', 'raccoons', 'rams', 'reindeers',
|
66
|
+
'rhinoceroses', 'salamanders', 'seals', 'sheep', 'squid',
|
67
|
+
'sloths', 'slugs', 'snails', 'snakes', 'sphinxes', 'sprites',
|
68
|
+
'squirrels', 'takins', 'tigers', 'toads', 'trolls', 'turtles',
|
69
|
+
'unicorns', 'walruses', 'warthogs', 'weasels', 'wolves',
|
70
|
+
'wolverines', 'wombats', 'woodchucks', 'yaks', 'zebras'
|
71
|
+
]
|
72
|
+
end
|
73
|
+
def self.verbs
|
74
|
+
[
|
75
|
+
'ambled', 'assembled', 'burst', 'babbled', 'charged', 'chewed',
|
76
|
+
'clamored', 'coasted', 'crawled', 'crept', 'danced', 'dashed',
|
77
|
+
'drove', 'flopped', 'galloped', 'gathered', 'glided', 'hobbled',
|
78
|
+
'hopped', 'hurried', 'hustled', 'jogged', 'juggled', 'jumped',
|
79
|
+
'laughed', 'marched', 'meandered', 'munched', 'passed', 'plodded',
|
80
|
+
'pranced', 'ran', 'raced', 'rushed', 'sailed', 'sang', 'sauntered',
|
81
|
+
'scampered', 'scurried', 'skipped', 'snuggle', 'slurped', 'spied',
|
82
|
+
'sprinted', 'spurted', 'squiggled', 'squirmed', 'stretched',
|
83
|
+
'strode', 'strut', 'swam', 'swung', 'traveled', 'trudged',
|
84
|
+
'tumbled', 'twisted', 'wade', 'wandered', 'whistled', 'wiggled',
|
85
|
+
'wobbled', 'yawned', 'zipped', 'zoomed'
|
86
|
+
]
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.adverbs
|
90
|
+
[
|
91
|
+
'absentmindedly', 'adventurously', 'angrily', 'anxiously',
|
92
|
+
'awkwardly', 'bashfully', 'beautifully', 'bleakly', 'blissfully',
|
93
|
+
'boastfully', 'boldly', 'bravely', 'briskly', 'calmly',
|
94
|
+
'carefully', 'cautiously', 'cheerfully', 'cleverly', 'cluelessly',
|
95
|
+
'clumsily', 'coaxingly', 'colorfully', 'coolly', 'courageously',
|
96
|
+
'curiously', 'daintily', 'defiantly', 'deliberately',
|
97
|
+
'delightfully', 'diligently', 'dreamily', 'drudgingly', 'eagerly',
|
98
|
+
'effortlessly', 'elegantly', 'energetically', 'enthusiastically',
|
99
|
+
'excitedly', 'fervently', 'foolishly', 'furiously', 'gallantly',
|
100
|
+
'gently', 'gladly', 'gleefully', 'gracefully', 'gratefully',
|
101
|
+
'happily', 'hastily', 'haphazardly', 'hungrily', 'innocently',
|
102
|
+
'inquisitively', 'intensely', 'jokingly', 'joshingly', 'joyously',
|
103
|
+
'jovially', 'jubilantly', 'kiddingly', 'knavishly', 'knottily',
|
104
|
+
'kookily', 'lazily', 'loftily', 'longingly', 'lovingly', 'loudly',
|
105
|
+
'loyally', 'madly', 'majestically', 'merrily', 'mockingly',
|
106
|
+
'mysteriously', 'nervously', 'noisily', 'obnoxiously', 'oddly',
|
107
|
+
'optimistically', 'overconfidently', 'outside', 'owlishly',
|
108
|
+
'patiently', 'playfully', 'politely', 'powerfully', 'purposefully',
|
109
|
+
'quaintly', 'quarrelsomely', 'queasily', 'quickly', 'quietly',
|
110
|
+
'quirkily', 'quizzically', 'rapidly', 'reassuringly', 'recklessly',
|
111
|
+
'reluctantly', 'reproachfully', 'sadly', 'softly', 'seriously',
|
112
|
+
'shakily', 'sheepishly', 'shyly', 'silently', 'sillily',
|
113
|
+
'sleepily', 'slowly', 'speedily', 'stealthily', 'sternly',
|
114
|
+
'suspiciously', 'sweetly', 'tenderly', 'tensely', 'thoughtfully',
|
115
|
+
'triumphantly', 'unabashedly', 'unaccountably', 'urgently',
|
116
|
+
'vainly', 'valiantly', 'victoriously', 'warmly', 'wearily',
|
117
|
+
'youthfully', 'zestfully'
|
118
|
+
]
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sad_squid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rickard Dybeck
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Sad Squid is an implementation of a unique ID string inspired by Asana.
|
14
|
+
email:
|
15
|
+
- r.dybeck@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/sad_squid.rb
|
21
|
+
- lib/sad_squid/sentance.rb
|
22
|
+
- lib/sad_squid/version.rb
|
23
|
+
- lib/sad_squid/words.rb
|
24
|
+
homepage: http://alde.nu
|
25
|
+
licenses:
|
26
|
+
- Apache 2.0
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.0.3
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Generate unique ID strings.
|
48
|
+
test_files: []
|