namey 0.0.2 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/Gemfile +22 -1
  2. data/README.markdown +105 -0
  3. data/Rakefile +54 -0
  4. data/api/Gemfile +10 -0
  5. data/api/config.ru +8 -0
  6. data/api/namey_app.rb +50 -0
  7. data/api/public/LICENSE +176 -0
  8. data/api/public/Makefile +30 -0
  9. data/api/public/README.md +105 -0
  10. data/api/public/api.js +76 -0
  11. data/api/public/bootstrap.css +2467 -0
  12. data/api/public/bootstrap.min.css +356 -0
  13. data/api/public/docs/assets/css/docs.css +317 -0
  14. data/api/public/docs/assets/ico/bootstrap-apple-114x114.png +0 -0
  15. data/api/public/docs/assets/ico/bootstrap-apple-57x57.png +0 -0
  16. data/api/public/docs/assets/ico/bootstrap-apple-72x72.png +0 -0
  17. data/api/public/docs/assets/ico/favicon.ico +0 -0
  18. data/api/public/docs/assets/img/bird.png +0 -0
  19. data/api/public/docs/assets/img/browsers.png +0 -0
  20. data/api/public/docs/assets/img/example-diagram-01.png +0 -0
  21. data/api/public/docs/assets/img/example-diagram-02.png +0 -0
  22. data/api/public/docs/assets/img/example-diagram-03.png +0 -0
  23. data/api/public/docs/assets/img/grid-18px.png +0 -0
  24. data/api/public/docs/assets/img/twitter-logo-no-bird.png +0 -0
  25. data/api/public/docs/assets/js/application.js +52 -0
  26. data/api/public/docs/assets/js/google-code-prettify/prettify.css +94 -0
  27. data/api/public/docs/assets/js/google-code-prettify/prettify.js +28 -0
  28. data/api/public/docs/index.html +2037 -0
  29. data/api/public/docs/javascript.html +798 -0
  30. data/api/public/examples/container-app.html +119 -0
  31. data/api/public/examples/fluid.html +122 -0
  32. data/api/public/examples/hero.html +79 -0
  33. data/api/public/js/bootstrap-alerts.js +113 -0
  34. data/api/public/js/bootstrap-buttons.js +62 -0
  35. data/api/public/js/bootstrap-dropdown.js +55 -0
  36. data/api/public/js/bootstrap-modal.js +260 -0
  37. data/api/public/js/bootstrap-popover.js +86 -0
  38. data/api/public/js/bootstrap-scrollspy.js +107 -0
  39. data/api/public/js/bootstrap-tabs.js +80 -0
  40. data/api/public/js/bootstrap-twipsy.js +310 -0
  41. data/api/public/js/tests/index.html +40 -0
  42. data/api/public/js/tests/unit/bootstrap-alerts.js +41 -0
  43. data/api/public/js/tests/unit/bootstrap-buttons.js +42 -0
  44. data/api/public/js/tests/unit/bootstrap-dropdown.js +52 -0
  45. data/api/public/js/tests/unit/bootstrap-modal.js +151 -0
  46. data/api/public/js/tests/unit/bootstrap-popover.js +76 -0
  47. data/api/public/js/tests/unit/bootstrap-scrollspy.js +31 -0
  48. data/api/public/js/tests/unit/bootstrap-tabs.js +77 -0
  49. data/api/public/js/tests/unit/bootstrap-twipsy.js +81 -0
  50. data/api/public/js/tests/vendor/qunit.css +232 -0
  51. data/api/public/js/tests/vendor/qunit.js +1510 -0
  52. data/api/public/lib/bootstrap.less +26 -0
  53. data/api/public/lib/forms.less +479 -0
  54. data/api/public/lib/mixins.less +222 -0
  55. data/api/public/lib/patterns.less +1060 -0
  56. data/api/public/lib/reset.less +141 -0
  57. data/api/public/lib/scaffolding.less +137 -0
  58. data/api/public/lib/tables.less +224 -0
  59. data/api/public/lib/type.less +187 -0
  60. data/api/public/lib/variables.less +60 -0
  61. data/api/public/ui.js +42 -0
  62. data/api/views/index.erb +211 -0
  63. data/bin/{load-data → namey-load-data} +7 -1
  64. data/bin/random-name +4 -1
  65. data/data/dist.all.last +88799 -0
  66. data/data/names.db +0 -0
  67. data/lib/namey.rb +12 -5
  68. data/lib/namey/generator.rb +79 -10
  69. data/lib/namey/parser.rb +79 -16
  70. data/lib/namey/version.rb +2 -1
  71. data/namey.gemspec +8 -2
  72. data/spec/generator_spec.rb +54 -0
  73. data/spec/spec_helper.rb +19 -0
  74. metadata +95 -9
@@ -0,0 +1,187 @@
1
+ /* Typography.less
2
+ * Headings, body text, lists, code, and more for a versatile and durable typography system
3
+ * ---------------------------------------------------------------------------------------- */
4
+
5
+
6
+ // BODY TEXT
7
+ // ---------
8
+
9
+ p {
10
+ #font > .shorthand(normal,@basefont,@baseline);
11
+ margin-bottom: @baseline / 2;
12
+ small {
13
+ font-size: @basefont - 2;
14
+ color: @grayLight;
15
+ }
16
+ }
17
+
18
+
19
+ // HEADINGS
20
+ // --------
21
+
22
+ h1, h2, h3, h4, h5, h6 {
23
+ font-weight: bold;
24
+ color: @grayDark;
25
+ small {
26
+ color: @grayLight;
27
+ }
28
+ }
29
+ h1 {
30
+ margin-bottom: @baseline;
31
+ font-size: 30px;
32
+ line-height: @baseline * 2;
33
+ small {
34
+ font-size: 18px;
35
+ }
36
+ }
37
+ h2 {
38
+ font-size: 24px;
39
+ line-height: @baseline * 2;
40
+ small {
41
+ font-size: 14px;
42
+ }
43
+ }
44
+ h3, h4, h5, h6 {
45
+ line-height: @baseline * 2;
46
+ }
47
+ h3 {
48
+ font-size: 18px;
49
+ small {
50
+ font-size: 14px;
51
+ }
52
+ }
53
+ h4 {
54
+ font-size: 16px;
55
+ small {
56
+ font-size: 12px;
57
+ }
58
+ }
59
+ h5 {
60
+ font-size: 14px;
61
+ }
62
+ h6 {
63
+ font-size: 13px;
64
+ color: @grayLight;
65
+ text-transform: uppercase;
66
+ }
67
+
68
+
69
+ // COLORS
70
+ // ------
71
+
72
+ // Unordered and Ordered lists
73
+ ul, ol {
74
+ margin: 0 0 @baseline 25px;
75
+ }
76
+ ul ul,
77
+ ul ol,
78
+ ol ol,
79
+ ol ul {
80
+ margin-bottom: 0;
81
+ }
82
+ ul {
83
+ list-style: disc;
84
+ }
85
+ ol {
86
+ list-style: decimal;
87
+ }
88
+ li {
89
+ line-height: @baseline;
90
+ color: @gray;
91
+ }
92
+ ul.unstyled {
93
+ list-style: none;
94
+ margin-left: 0;
95
+ }
96
+
97
+ // Description Lists
98
+ dl {
99
+ margin-bottom: @baseline;
100
+ dt, dd {
101
+ line-height: @baseline;
102
+ }
103
+ dt {
104
+ font-weight: bold;
105
+ }
106
+ dd {
107
+ margin-left: @baseline / 2;
108
+ }
109
+ }
110
+
111
+ // MISC
112
+ // ----
113
+
114
+ // Horizontal rules
115
+ hr {
116
+ margin: 20px 0 19px;
117
+ border: 0;
118
+ border-bottom: 1px solid #eee;
119
+ }
120
+
121
+ // Emphasis
122
+ strong {
123
+ font-style: inherit;
124
+ font-weight: bold;
125
+ }
126
+ em {
127
+ font-style: italic;
128
+ font-weight: inherit;
129
+ line-height: inherit;
130
+ }
131
+ .muted {
132
+ color: @grayLight;
133
+ }
134
+
135
+ // Blockquotes
136
+ blockquote {
137
+ margin-bottom: @baseline;
138
+ border-left: 5px solid #eee;
139
+ padding-left: 15px;
140
+ p {
141
+ #font > .shorthand(300,14px,@baseline);
142
+ margin-bottom: 0;
143
+ }
144
+ small {
145
+ display: block;
146
+ #font > .shorthand(300,12px,@baseline);
147
+ color: @grayLight;
148
+ &:before {
149
+ content: '\2014 \00A0';
150
+ }
151
+ }
152
+ }
153
+
154
+ // Addresses
155
+ address {
156
+ display: block;
157
+ line-height: @baseline;
158
+ margin-bottom: @baseline;
159
+ }
160
+
161
+ // Inline and block code styles
162
+ code, pre {
163
+ padding: 0 3px 2px;
164
+ font-family: Monaco, Andale Mono, Courier New, monospace;
165
+ font-size: 12px;
166
+ .border-radius(3px);
167
+ }
168
+ code {
169
+ background-color: lighten(@orange, 40%);
170
+ color: rgba(0,0,0,.75);
171
+ padding: 1px 3px;
172
+ }
173
+ pre {
174
+ background-color: #f5f5f5;
175
+ display: block;
176
+ padding: (@baseline - 1) / 2;
177
+ margin: 0 0 @baseline;
178
+ line-height: @baseline;
179
+ font-size: 12px;
180
+ border: 1px solid #ccc;
181
+ border: 1px solid rgba(0,0,0,.15);
182
+ .border-radius(3px);
183
+ white-space: pre;
184
+ white-space: pre-wrap;
185
+ word-wrap: break-word;
186
+
187
+ }
@@ -0,0 +1,60 @@
1
+ /* Variables.less
2
+ * Variables to customize the look and feel of Bootstrap
3
+ * ----------------------------------------------------- */
4
+
5
+
6
+ // Links
7
+ @linkColor: #0069d6;
8
+ @linkColorHover: darken(@linkColor, 15);
9
+
10
+ // Grays
11
+ @black: #000;
12
+ @grayDark: lighten(@black, 25%);
13
+ @gray: lighten(@black, 50%);
14
+ @grayLight: lighten(@black, 75%);
15
+ @grayLighter: lighten(@black, 90%);
16
+ @white: #fff;
17
+
18
+ // Accent Colors
19
+ @blue: #049CDB;
20
+ @blueDark: #0064CD;
21
+ @green: #46a546;
22
+ @red: #9d261d;
23
+ @yellow: #ffc40d;
24
+ @orange: #f89406;
25
+ @pink: #c3325f;
26
+ @purple: #7a43b6;
27
+
28
+ // Baseline grid
29
+ @basefont: 13px;
30
+ @baseline: 18px;
31
+
32
+ // Griditude
33
+ // Modify the grid styles in mixins.less
34
+ @gridColumns: 16;
35
+ @gridColumnWidth: 40px;
36
+ @gridGutterWidth: 20px;
37
+ @extraSpace: (@gridGutterWidth * 2); // For our grid calculations
38
+ @siteWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
39
+
40
+ // Color Scheme
41
+ // Use this to roll your own color schemes if you like (unused by Bootstrap by default)
42
+ @baseColor: @blue; // Set a base color
43
+ @complement: spin(@baseColor, 180); // Determine a complementary color
44
+ @split1: spin(@baseColor, 158); // Split complements
45
+ @split2: spin(@baseColor, -158);
46
+ @triad1: spin(@baseColor, 135); // Triads colors
47
+ @triad2: spin(@baseColor, -135);
48
+ @tetra1: spin(@baseColor, 90); // Tetra colors
49
+ @tetra2: spin(@baseColor, -90);
50
+ @analog1: spin(@baseColor, 22); // Analogs colors
51
+ @analog2: spin(@baseColor, -22);
52
+
53
+
54
+
55
+ // More variables coming soon:
56
+ // - @basefont to @baseFontSize
57
+ // - @baseline to @baseLineHeight
58
+ // - @baseFontFamily
59
+ // - @primaryButtonColor
60
+ // - anything else? File an issue on GitHub
@@ -0,0 +1,42 @@
1
+ $(document).ready(function() {
2
+ $("input[name=frequency]").change(function() {
3
+ console.log("HI!");
4
+ if ( $("input[name=frequency]:checked").val() == "custom" ) {
5
+ $("#min_freq,#max_freq").removeClass("disabled").removeAttr("disabled");
6
+ }
7
+ else {
8
+ $("#min_freq,#max_freq").addClass("disabled").attr("disabled", true); ;
9
+ }
10
+
11
+ });
12
+
13
+ $('#name-params').submit(function() {
14
+
15
+ var opts = {
16
+ count: $("select[name=count]").val(),
17
+ with_surname: $("input[name=with_surname]:checked").val() === "true"
18
+ };
19
+
20
+ var frequency = $("input[name=frequency]:checked").val();
21
+ if ( frequency == "custom" ) {
22
+ opts.min_freq = $("input[name=min_freq]").val();
23
+ opts.max_freq = $("input[name=max_freq]").val();
24
+ }
25
+ else {
26
+ opts.frequency = frequency;
27
+ }
28
+
29
+
30
+ var type = $("input[name=type]:checked").val();
31
+ if ( type != "both" ) {
32
+ opts.type = type;
33
+ }
34
+
35
+ opts.callback = function(r) {
36
+ $("#nameList").val(r);
37
+ }
38
+ namey.get(opts);
39
+
40
+ return false;
41
+ });
42
+ });
@@ -0,0 +1,211 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <!-- shamelessly stolen from view-source:http://twitter.github.com/bootstrap/examples/hero.html -->
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>Namey</title>
7
+ <meta name="description" content="">
8
+ <meta name="author" content="">
9
+
10
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
11
+ <!--[if lt IE 9]>
12
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <script type="text/javascript" src="https://www.google.com/jsapi"></script>
15
+ <script>
16
+ google.load("jquery", "1.6.4");
17
+ </script>
18
+ <script type="text/javascript" src="/api.js"></script>
19
+ <script type="text/javascript" src="/ui.js"></script>
20
+
21
+ <!-- Le styles -->
22
+ <link href="/bootstrap.css" rel="stylesheet">
23
+ <style type="text/css">
24
+ body {
25
+ padding-top: 10px;
26
+ }
27
+ .hero-unit {
28
+ padding-top: 10px;
29
+ padding-bottom: 10px;
30
+ }
31
+ .hero-unit h1 {
32
+ font-size: 48px;
33
+ }
34
+ .hero-unit p {
35
+ font-size: 16px;
36
+ line-height: 18px;
37
+ font-weight: 100;
38
+ }
39
+
40
+ </style>
41
+
42
+ <!---
43
+ <link rel="shortcut icon" href="images/favicon.ico">
44
+ --->
45
+ </head>
46
+
47
+ <body>
48
+ <div class="container">
49
+
50
+ <!-- Main hero unit for a primary marketing message or call to action -->
51
+ <div class="hero-unit">
52
+ <h1>Namey!</h1>
53
+ <h2>A random name generator</h1>
54
+ <p>Welcome to Namey, the random name generator, powered by the ruby
55
+ gem of the same name. It uses the
56
+ <a href="http://www.census.gov/genealogy/names/">US Census
57
+ Bureau database</a> of first and last names to generate random
58
+ names. You can specify gender, whether you want a common or
59
+ rare name, and so on. It's pretty easy, so...</p>
60
+ </div>
61
+
62
+ <section id="forms">
63
+ <div class="page-header">
64
+ <h1>Lets make some names!</h1>
65
+ </div>
66
+ <div class="row">
67
+ <div>
68
+ <form id="name-params">
69
+ <fieldset>
70
+ <div class="clearfix">
71
+ <label id="type-opts">Name Type</label>
72
+ <div class="input">
73
+ <ul class="inputs-list">
74
+ <li>
75
+ <label>
76
+ <input type="radio" checked name="type" value="both" />
77
+ <span>Any Gender</span>
78
+ </label>
79
+ </li>
80
+ <li>
81
+ <label>
82
+ <input type="radio" name="type" value="female" />
83
+ <span>Female</span>
84
+ </label>
85
+ </li>
86
+ <li>
87
+ <label>
88
+ <input type="radio" name="type" value="male" />
89
+ <span>Male</span>
90
+ </label>
91
+ </li>
92
+ <li>
93
+ <label>
94
+ <input type="radio" name="type" value="surname" />
95
+ <span>Just a surname</span>
96
+ </label>
97
+ </li>
98
+ </ul>
99
+ </div>
100
+ </div><!-- /clearfix -->
101
+
102
+ <div class="clearfix">
103
+ <div class="input">
104
+ <ul class="inputs-list">
105
+ <li>
106
+ <label>
107
+ <input type="checkbox" name="with_surname" value="true" checked />
108
+ <span>Include a surname?</span>
109
+ </label>
110
+ </li>
111
+ </ul>
112
+ <span class="help-block">
113
+ <strong>Note:</strong> If you uncheck this, you'll only get a first name.
114
+ </span>
115
+ </div>
116
+ </div><!-- /clearfix -->
117
+
118
+ <div class="clearfix">
119
+ <label id="optionsRadio">Name Frequency</label>
120
+ <div class="input">
121
+ <ul class="inputs-list">
122
+ <li>
123
+ <label>
124
+ <input type="radio" checked name="frequency" value="common" />
125
+ <span>'Common' names</span>
126
+ </label>
127
+ </li>
128
+ <li>
129
+ <label>
130
+ <input type="radio" name="frequency" value="rare" />
131
+ <span>Rare names</span>
132
+ </label>
133
+ </li>
134
+ <li>
135
+ <label>
136
+ <input type="radio" name="frequency" value="all" />
137
+ <span>All names</span>
138
+ </label>
139
+ </li>
140
+ <li>
141
+ <label>
142
+ <input type="radio" name="frequency" value="custom" />
143
+ <span>Custom range: </span>
144
+ From: <input class="span2 disabled" id="min_freq" name="min_freq" type="text" placeholder="(0-100)" disabled />
145
+ To: <input class="span2 disabled" id="max_freq" name="max_freq" type="text" placeholder="(0-100)" disabled />
146
+ </label>
147
+ </li>
148
+ </ul>
149
+ </div>
150
+ </div><!-- /clearfix -->
151
+
152
+
153
+ <div class="clearfix">
154
+ <label for="count">How many names to generate?</label>
155
+ <div class="input">
156
+ <select name="count" id="count">
157
+ <option>1</option>
158
+ <option>2</option>
159
+ <option>3</option>
160
+ <option>4</option>
161
+ <option>5</option>
162
+ </select>
163
+ </div>
164
+ </div><!-- /clearfix -->
165
+
166
+ <div class="clearfix">
167
+ <label for="disabledInput">Results:</label>
168
+ <div class="input">
169
+ <textarea class="xxlarge" name="nameList" id="nameList" rows="5"></textarea>
170
+ </div>
171
+ </div><!-- /clearfix -->
172
+
173
+ <div class="actions">
174
+ <input type="submit" class="btn primary" value="Gimme a name!">
175
+ </div>
176
+ </fieldset>
177
+ </form>
178
+ </div>
179
+ </div><!-- /row -->
180
+
181
+ </section>
182
+
183
+ <!-- Example row of columns -->
184
+ <div class="row">
185
+ <div class="span5">
186
+ <h2>Open Source</h2>
187
+ <p>The code for namey is totally open source, do what you
188
+ like with it! <a href="https://github.com/muffinista/namey">Check it out on github</a></p>
189
+ </div>
190
+ <div class="span6">
191
+ <h2>API Available</h2>
192
+ <p>Are you a nerd? Do you like APIs? You're in luck! Namey
193
+ has a <a href="/api.js">Javascript API</a> available so
194
+ you can generate names however you would like.</p>
195
+ </div>
196
+ <div class="span5">
197
+ <h2>Muffinlabs</h2>
198
+ <p>Namey is
199
+ a <a href="http://muffinlabs.com">muffinlabs</a>
200
+ production. Please visit!</p>
201
+ </div>
202
+ </div>
203
+
204
+ <footer>
205
+ <p>&copy; Colin Mitchell 2011, <a href="http://muffinlabs.com">http://muffinlabs.com</a></p>
206
+ </footer>
207
+
208
+ </div> <!-- /container -->
209
+
210
+ </body>
211
+ </html>