blackstack-core 1.2.3 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d2cf29a80232a4bcbce4f7cea933f27c8204a6af6cc867416e96faca77dd637
4
- data.tar.gz: de60ad61c036a8c3ecb5454e118f67e4dec8f42076e20c4392d40d3f784351e3
3
+ metadata.gz: 1eb4cffe4ce2c4a57e17f89c59dd4e65a89bdf96ec411bb1c930fc388687f8d6
4
+ data.tar.gz: f8cdd423961dcd522e3f155f2aa258f36758f8f23d12001e78fae240d127d2cb
5
5
  SHA512:
6
- metadata.gz: 9e11f416543274890a522d212704e7c28985c48555f34b514cf788e0faff7f02550e8926fa2848b17250ca5397fce49ef1e827eeabf1f9dd0d3bdcc7cd4761db
7
- data.tar.gz: 77bc26cf5a7a8013a050d47860b21095de86f514aa4f4a0b4dbf86a7b4965727fb09100b5200dc84c042c6c13a03b5260f71d4142b9dbb5ccc5d1dbaec1443a1
6
+ metadata.gz: 4d708e8c15d537530d75a1c0f54f37749766d9e2874d18cd6ab52d2c37492af028eedb52e912f84231e7c2748900d393b2ef95d227e7593a7782418b880a2387
7
+ data.tar.gz: 156c970bf50cd2303fedce19a6255a5ed9fb712499c382059a58707d2b2fb9aa415090586be31466868f73bcea736822c95ab45e11d63d4981d08a971aa295b1
@@ -1,300 +1,300 @@
1
- require_relative '../lib/blackstack-core'
2
-
3
- # returns true if the string meets all the security requirements for a password
4
- puts ""
5
- puts "Passwords"
6
- a = ['Hello', 'HelloWorld12$3']
7
- a.each { |s|
8
- print "'#{s}'.password?... "
9
- puts s.password?.to_s
10
- }
11
-
12
- # returns true if the string match with the regex of a GUID
13
- puts ""
14
- puts "GUIDs"
15
- a = [
16
- '{{331a92c3-5fe1-47a2-a31b-cfa439b5b4f9}',
17
- '{331a92c3-5fe1-47a2-a31b-cfa439b5b4f9}',
18
- '331a92c3-5fe1-47a2-a31b-cfa439b5b4f9',
19
- '{331A92C3-5FE1-47A2-A31B-CFA439B5B4F9}',
20
- '{331A92C3-5FE1-47A2-A31B-CFA439B5B4F9}}',
21
- '331A92C3-5FE1-47A2-A31B-CFA439B5B4F9',
22
- '331A92C3-5FE1-47A2-A31B-CFA439B5B4F9-fgf',
23
- '331A92C35FE147A2A31BCFA439B5B4F9',
24
- ]
25
- a.each { |s|
26
- print "'#{s}'.guid?... "
27
- puts s.guid?.to_s
28
- }
29
-
30
- # returns true if the string match with the regex of a filename
31
- puts ""
32
- puts "Filenames"
33
- a = [
34
- 'c:\filename.txt',
35
- 'c:/filename.txt',
36
- 'filename_1.txt',
37
- 'filename-1.txt',
38
- 'filename+1.txt',
39
- 'filename?1.txt',
40
- 'filename*1.txt',
41
- 'filename.txt',
42
- 'filename',
43
- 'filename.txt.rar',
44
- ]
45
- a.each { |s|
46
- print "'#{s}'.filename?... "
47
- puts s.filename?.to_s
48
- }
49
-
50
- # returns true if the string match with the regex of an email
51
- puts ""
52
- puts "Emails"
53
- a = [
54
- 'tango@expandedventure.com',
55
- 'tango@expandedventure.com.ar',
56
- 'tango',
57
- 'tango@',
58
- ]
59
- a.each { |s|
60
- print "'#{s}'.email?... "
61
- puts s.email?.to_s
62
- }
63
-
64
- # returns true if the string match with the regex of a domain
65
- puts ""
66
- puts "Domains"
67
- a = [
68
- 'tango',
69
- 'tango@expandedventure',
70
- 'tango@expandedventure.com',
71
- 'tango@expandedventure.com.ar',
72
- 'expandedventure.com',
73
- 'expandedventure.com.ar',
74
- 'https://expandedventure.com.ar',
75
- 'www.expandedventure.com.ar',
76
- 'https://www.expandedventure.com.ar',
77
- ]
78
- a.each { |s|
79
- print "'#{s}'.domain?... "
80
- puts s.domain?.to_s
81
- }
82
-
83
- # returns true if the string match with the regex of a phone number
84
- puts ""
85
- puts "Domains"
86
- a = [
87
- '+54 9 11 5061 2148',
88
- '545-5561-2148',
89
- '545-561-2148',
90
- '545 561 2148',
91
- '54 545 561 2148',
92
- '+54 545 561 2148',
93
- '+54 545-561-2148',
94
- '+54-545-561-2148',
95
- ]
96
- a.each { |s|
97
- print "'#{s}'.domain?... "
98
- puts s.phone?.to_s
99
- }
100
-
101
- # returns true if the string match with the regex of a URL
102
- puts ""
103
- puts "URLs"
104
- a = [
105
- 'tango',
106
- 'tango@expandedventure',
107
- 'tango@expandedventure.com',
108
- 'tango@expandedventure.com.ar',
109
- 'expandedventure.com',
110
- 'expandedventure.com.ar',
111
- 'https://expandedventure.com.ar',
112
- 'www.expandedventure.com.ar',
113
- 'https://www.expandedventure.com.ar',
114
- ]
115
- a.each { |s|
116
- print "'#{s}'.url?... "
117
- puts s.url?.to_s
118
- }
119
-
120
- # returns true if the string match with the regex of a number
121
- puts ""
122
- puts "Fixnums"
123
- a = [
124
- '5',
125
- '5.5',
126
- '5,5',
127
- '5000',
128
- '5,000',
129
- '5.000',
130
- ]
131
- a.each { |s|
132
- print "'#{s.to_s}'.fixnum?... "
133
- puts s.fixnum?.to_s
134
- }
135
-
136
- # returns true if the string match with the regex of a datetime used in the BlackStack's API
137
- puts ""
138
- puts "SQL DateTimes"
139
- a = [
140
- '20191106215030',
141
- '20191106',
142
- '2019-11-06',
143
- '2019-11-06 21:50:30',
144
- '2019-13-06 21:50:30', # invalid month
145
- '2019-11-06 25:50:30', # invalid hour
146
- '2019-11-06 21:70:30', # invalid minute
147
- '2019-11-06 21:50:70', # invalid second
148
- ]
149
- a.each { |s|
150
- print "'#{s.to_s}'.sql_datetime?... "
151
- puts s.sql_datetime?.to_s
152
- }
153
-
154
- #
155
- puts ""
156
- puts "API DateTimes"
157
- a = [
158
- '20191106215030',
159
- '20191106',
160
- '2019-11-06',
161
- '2019-11-06 21:50:30',
162
- '20191306215030', # invalid month
163
- '20191106255030', # invalid hour
164
- '20191106217030', # invalid minute
165
- '20191106215070', # invalid second
166
- ]
167
- a.each { |s|
168
- print "'#{s.to_s}'.api_datetime?... "
169
- puts s.api_datetime?.to_s
170
- }
171
-
172
- # Convierte un string con formato sql-datatime a un string con formato sql-datetime.
173
- puts ""
174
- puts "SQL DateTime -> API DateTime"
175
- a = [
176
- '2019-11-06 21:50:30',
177
- ]
178
- a.each { |s|
179
- print "'#{s.to_s}'.sql_to_api_datetime... "
180
- puts s.sql_to_api_datetime.to_s
181
- }
182
-
183
- # Convierte un string con formato api-datatime (yyyymmddhhmmss) a un string con formato sql-datetime (yyyy-mm-dd hh:mm:ss).
184
- puts ""
185
- puts "API DateTime -> SQL DateTime"
186
- a = [
187
- '20191106215030',
188
- ]
189
- a.each { |s|
190
- print "'#{s.to_s}'.api_to_sql_datetime... "
191
- puts s.api_to_sql_datetime.to_s
192
- }
193
-
194
- # Rewrite a GUID as a standard (normalized) format.
195
- puts ""
196
- puts "Any GUID -> Normalized Guid"
197
- a = [
198
- '{331a92c3-5fe1-47a2-a31b-cfa439b5b4f9}',
199
- '331a92c3-5fe1-47a2-a31b-cfa439b5b4f9',
200
- '{331A92C3-5FE1-47A2-A31B-CFA439B5B4F9}',
201
- '331A92C3-5FE1-47A2-A31B-CFA439B5B4F9',
202
- ]
203
- a.each { |s|
204
- print "'#{s}'.to_guid... "
205
- puts s.to_guid.to_s
206
- }
207
-
208
- # Escape simple-quotes too add the string into literal-string of a dynamic query build into the Ruby code.
209
- # Example: "I'm BlackStack" -> "I''m BlackStack"
210
- puts ""
211
- puts "Any String -> String with Escaped Quotes"
212
- a = [
213
- "I'm BlackStack",
214
- "Hello World!",
215
- ]
216
- a.each { |s|
217
- print "'#{s}'.to_sql... "
218
- puts s.to_sql.to_s
219
- }
220
-
221
- #
222
- puts ""
223
- puts "Spintax"
224
- a = [
225
- "I'm BlackStack",
226
- "Hello World!",
227
- "{Hello|Hi} World!",
228
- "{Hello|Hi|Good {Morning|Afternoon}} World!", # Nexted spintax. Not supported.
229
- "{Hello|Hi World!", # wrong syntax.
230
- ]
231
- a.each { |s|
232
- print "'#{s}'.spintax?... "
233
- puts s.spintax?.to_s
234
- }
235
-
236
- # Returns a random spin from a spintax
237
- puts ""
238
- puts "Spin"
239
- a = [
240
- "{Hello|Hi|Good Morning|Good Afternoon} World!",
241
- "{Hello|Hi|Good Morning|Good Afternoon} World!",
242
- "{Hello|Hi|Good Morning|Good Afternoon} World!",
243
- "{Hello|Hi|Good Morning|Good Afternoon} World!",
244
- ]
245
- a.each { |s|
246
- print "'#{s}'.spin... "
247
- puts s.spin
248
- }
249
-
250
- # Converts a time object to an SQL friendy string
251
- puts ""
252
- puts "Time object -> SQL"
253
- a = [
254
- Time.new(2019,11,6,15,25,55),
255
- DateTime.new(2019,11,6,15,25,55),
256
- ]
257
- a.each { |o|
258
- print "'#{o.to_s}'.to_sql... "
259
- puts o.to_sql
260
- }
261
-
262
- # Converts number to a string with a format like xx,xxx,xxx.xxxx
263
- puts ""
264
- puts "Fixnum & Floats -> Screen Friendly Text"
265
- a = [
266
- 64443,
267
- 64443.5454,
268
- ]
269
- a.each { |i|
270
- print "'#{i.to_s}'.to_label... "
271
- puts i.to_label
272
- }
273
-
274
- # Converts number to a string with a format like xx,xxx,xxx.xxxx
275
- puts ""
276
- puts "Fixnum Minutes -> Time Spent (days, hours, minutes)"
277
- a = [
278
- 59,
279
- 60,
280
- 61,
281
- 600,
282
- 601,
283
- 1440,
284
- 1441,
285
- 1500,
286
- 1501,
287
- ]
288
- a.each { |i|
289
- print "Minutes '#{i.to_s}'.to_time_spent... "
290
- puts i.to_time_spent
291
- }
292
-
293
-
294
- =begin # TODO: Pending
295
- encode_string
296
- encode_html
297
- encode_exception
298
- encode_period
299
- encode_javascript
1
+ require_relative '../lib/blackstack-core'
2
+
3
+ # returns true if the string meets all the security requirements for a password
4
+ puts ""
5
+ puts "Passwords"
6
+ a = ['Hello', 'HelloWorld12$3']
7
+ a.each { |s|
8
+ print "'#{s}'.password?... "
9
+ puts s.password?.to_s
10
+ }
11
+
12
+ # returns true if the string match with the regex of a GUID
13
+ puts ""
14
+ puts "GUIDs"
15
+ a = [
16
+ '{{331a92c3-5fe1-47a2-a31b-cfa439b5b4f9}',
17
+ '{331a92c3-5fe1-47a2-a31b-cfa439b5b4f9}',
18
+ '331a92c3-5fe1-47a2-a31b-cfa439b5b4f9',
19
+ '{331A92C3-5FE1-47A2-A31B-CFA439B5B4F9}',
20
+ '{331A92C3-5FE1-47A2-A31B-CFA439B5B4F9}}',
21
+ '331A92C3-5FE1-47A2-A31B-CFA439B5B4F9',
22
+ '331A92C3-5FE1-47A2-A31B-CFA439B5B4F9-fgf',
23
+ '331A92C35FE147A2A31BCFA439B5B4F9',
24
+ ]
25
+ a.each { |s|
26
+ print "'#{s}'.guid?... "
27
+ puts s.guid?.to_s
28
+ }
29
+
30
+ # returns true if the string match with the regex of a filename
31
+ puts ""
32
+ puts "Filenames"
33
+ a = [
34
+ 'c:\filename.txt',
35
+ 'c:/filename.txt',
36
+ 'filename_1.txt',
37
+ 'filename-1.txt',
38
+ 'filename+1.txt',
39
+ 'filename?1.txt',
40
+ 'filename*1.txt',
41
+ 'filename.txt',
42
+ 'filename',
43
+ 'filename.txt.rar',
44
+ ]
45
+ a.each { |s|
46
+ print "'#{s}'.filename?... "
47
+ puts s.filename?.to_s
48
+ }
49
+
50
+ # returns true if the string match with the regex of an email
51
+ puts ""
52
+ puts "Emails"
53
+ a = [
54
+ 'tango@expandedventure.com',
55
+ 'tango@expandedventure.com.ar',
56
+ 'tango',
57
+ 'tango@',
58
+ ]
59
+ a.each { |s|
60
+ print "'#{s}'.email?... "
61
+ puts s.email?.to_s
62
+ }
63
+
64
+ # returns true if the string match with the regex of a domain
65
+ puts ""
66
+ puts "Domains"
67
+ a = [
68
+ 'tango',
69
+ 'tango@expandedventure',
70
+ 'tango@expandedventure.com',
71
+ 'tango@expandedventure.com.ar',
72
+ 'expandedventure.com',
73
+ 'expandedventure.com.ar',
74
+ 'https://expandedventure.com.ar',
75
+ 'www.expandedventure.com.ar',
76
+ 'https://www.expandedventure.com.ar',
77
+ ]
78
+ a.each { |s|
79
+ print "'#{s}'.domain?... "
80
+ puts s.domain?.to_s
81
+ }
82
+
83
+ # returns true if the string match with the regex of a phone number
84
+ puts ""
85
+ puts "Domains"
86
+ a = [
87
+ '+54 9 11 5061 2148',
88
+ '545-5561-2148',
89
+ '545-561-2148',
90
+ '545 561 2148',
91
+ '54 545 561 2148',
92
+ '+54 545 561 2148',
93
+ '+54 545-561-2148',
94
+ '+54-545-561-2148',
95
+ ]
96
+ a.each { |s|
97
+ print "'#{s}'.domain?... "
98
+ puts s.phone?.to_s
99
+ }
100
+
101
+ # returns true if the string match with the regex of a URL
102
+ puts ""
103
+ puts "URLs"
104
+ a = [
105
+ 'tango',
106
+ 'tango@expandedventure',
107
+ 'tango@expandedventure.com',
108
+ 'tango@expandedventure.com.ar',
109
+ 'expandedventure.com',
110
+ 'expandedventure.com.ar',
111
+ 'https://expandedventure.com.ar',
112
+ 'www.expandedventure.com.ar',
113
+ 'https://www.expandedventure.com.ar',
114
+ ]
115
+ a.each { |s|
116
+ print "'#{s}'.url?... "
117
+ puts s.url?.to_s
118
+ }
119
+
120
+ # returns true if the string match with the regex of a number
121
+ puts ""
122
+ puts "Fixnums"
123
+ a = [
124
+ '5',
125
+ '5.5',
126
+ '5,5',
127
+ '5000',
128
+ '5,000',
129
+ '5.000',
130
+ ]
131
+ a.each { |s|
132
+ print "'#{s.to_s}'.fixnum?... "
133
+ puts s.fixnum?.to_s
134
+ }
135
+
136
+ # returns true if the string match with the regex of a datetime used in the BlackStack's API
137
+ puts ""
138
+ puts "SQL DateTimes"
139
+ a = [
140
+ '20191106215030',
141
+ '20191106',
142
+ '2019-11-06',
143
+ '2019-11-06 21:50:30',
144
+ '2019-13-06 21:50:30', # invalid month
145
+ '2019-11-06 25:50:30', # invalid hour
146
+ '2019-11-06 21:70:30', # invalid minute
147
+ '2019-11-06 21:50:70', # invalid second
148
+ ]
149
+ a.each { |s|
150
+ print "'#{s.to_s}'.sql_datetime?... "
151
+ puts s.sql_datetime?.to_s
152
+ }
153
+
154
+ #
155
+ puts ""
156
+ puts "API DateTimes"
157
+ a = [
158
+ '20191106215030',
159
+ '20191106',
160
+ '2019-11-06',
161
+ '2019-11-06 21:50:30',
162
+ '20191306215030', # invalid month
163
+ '20191106255030', # invalid hour
164
+ '20191106217030', # invalid minute
165
+ '20191106215070', # invalid second
166
+ ]
167
+ a.each { |s|
168
+ print "'#{s.to_s}'.api_datetime?... "
169
+ puts s.api_datetime?.to_s
170
+ }
171
+
172
+ # Convierte un string con formato sql-datatime a un string con formato sql-datetime.
173
+ puts ""
174
+ puts "SQL DateTime -> API DateTime"
175
+ a = [
176
+ '2019-11-06 21:50:30',
177
+ ]
178
+ a.each { |s|
179
+ print "'#{s.to_s}'.sql_to_api_datetime... "
180
+ puts s.sql_to_api_datetime.to_s
181
+ }
182
+
183
+ # Convierte un string con formato api-datatime (yyyymmddhhmmss) a un string con formato sql-datetime (yyyy-mm-dd hh:mm:ss).
184
+ puts ""
185
+ puts "API DateTime -> SQL DateTime"
186
+ a = [
187
+ '20191106215030',
188
+ ]
189
+ a.each { |s|
190
+ print "'#{s.to_s}'.api_to_sql_datetime... "
191
+ puts s.api_to_sql_datetime.to_s
192
+ }
193
+
194
+ # Rewrite a GUID as a standard (normalized) format.
195
+ puts ""
196
+ puts "Any GUID -> Normalized Guid"
197
+ a = [
198
+ '{331a92c3-5fe1-47a2-a31b-cfa439b5b4f9}',
199
+ '331a92c3-5fe1-47a2-a31b-cfa439b5b4f9',
200
+ '{331A92C3-5FE1-47A2-A31B-CFA439B5B4F9}',
201
+ '331A92C3-5FE1-47A2-A31B-CFA439B5B4F9',
202
+ ]
203
+ a.each { |s|
204
+ print "'#{s}'.to_guid... "
205
+ puts s.to_guid.to_s
206
+ }
207
+
208
+ # Escape simple-quotes too add the string into literal-string of a dynamic query build into the Ruby code.
209
+ # Example: "I'm BlackStack" -> "I''m BlackStack"
210
+ puts ""
211
+ puts "Any String -> String with Escaped Quotes"
212
+ a = [
213
+ "I'm BlackStack",
214
+ "Hello World!",
215
+ ]
216
+ a.each { |s|
217
+ print "'#{s}'.to_sql... "
218
+ puts s.to_sql.to_s
219
+ }
220
+
221
+ #
222
+ puts ""
223
+ puts "Spintax"
224
+ a = [
225
+ "I'm BlackStack",
226
+ "Hello World!",
227
+ "{Hello|Hi} World!",
228
+ "{Hello|Hi|Good {Morning|Afternoon}} World!", # Nexted spintax. Not supported.
229
+ "{Hello|Hi World!", # wrong syntax.
230
+ ]
231
+ a.each { |s|
232
+ print "'#{s}'.spintax?... "
233
+ puts s.spintax?.to_s
234
+ }
235
+
236
+ # Returns a random spin from a spintax
237
+ puts ""
238
+ puts "Spin"
239
+ a = [
240
+ "{Hello|Hi|Good Morning|Good Afternoon} World!",
241
+ "{Hello|Hi|Good Morning|Good Afternoon} World!",
242
+ "{Hello|Hi|Good Morning|Good Afternoon} World!",
243
+ "{Hello|Hi|Good Morning|Good Afternoon} World!",
244
+ ]
245
+ a.each { |s|
246
+ print "'#{s}'.spin... "
247
+ puts s.spin
248
+ }
249
+
250
+ # Converts a time object to an SQL friendy string
251
+ puts ""
252
+ puts "Time object -> SQL"
253
+ a = [
254
+ Time.new(2019,11,6,15,25,55),
255
+ DateTime.new(2019,11,6,15,25,55),
256
+ ]
257
+ a.each { |o|
258
+ print "'#{o.to_s}'.to_sql... "
259
+ puts o.to_sql
260
+ }
261
+
262
+ # Converts number to a string with a format like xx,xxx,xxx.xxxx
263
+ puts ""
264
+ puts "Fixnum & Floats -> Screen Friendly Text"
265
+ a = [
266
+ 64443,
267
+ 64443.5454,
268
+ ]
269
+ a.each { |i|
270
+ print "'#{i.to_s}'.to_label... "
271
+ puts i.to_label
272
+ }
273
+
274
+ # Converts number to a string with a format like xx,xxx,xxx.xxxx
275
+ puts ""
276
+ puts "Fixnum Minutes -> Time Spent (days, hours, minutes)"
277
+ a = [
278
+ 59,
279
+ 60,
280
+ 61,
281
+ 600,
282
+ 601,
283
+ 1440,
284
+ 1441,
285
+ 1500,
286
+ 1501,
287
+ ]
288
+ a.each { |i|
289
+ print "Minutes '#{i.to_s}'.to_time_spent... "
290
+ puts i.to_time_spent
291
+ }
292
+
293
+
294
+ =begin # TODO: Pending
295
+ encode_string
296
+ encode_html
297
+ encode_exception
298
+ encode_period
299
+ encode_javascript
300
300
  =end
@@ -1,3 +1,3 @@
1
- require_relative '../lib/blackstack-core'
2
-
3
- BlackStack::Netting::api_call('https://connectionsphere.com/api1.3/pampa/ping.json')
1
+ require_relative '../lib/blackstack-core'
2
+
3
+ BlackStack::Netting::api_call('https://connectionsphere.com/api1.3/pampa/ping.json')
@@ -1,27 +1,27 @@
1
- require 'pry'
2
- require 'content_spinning'
3
- require 'uri'
4
- require 'json'
5
- require 'net/http'
6
- require 'openssl'
7
- require 'time'
8
- require 'faraday'
9
- =begin
10
- require 'html_to_plain_text'
11
- require "RedCloth"
12
- require 'cgi'
13
- require 'httpclient'
14
- require 'open-uri'
15
- require 'date'
16
- require 'rest-client'
17
- require 'net/ssh'
18
- require 'digest/md5'
19
- require 'domainatrix'
20
- =end
21
- require_relative './functions'
22
- require_relative './extend_string'
23
- require_relative './extend_time'
24
- require_relative './extend_datetime'
25
- require_relative './extend_fixnum'
26
- require_relative './extend_float'
27
- require_relative './extend_exception'
1
+ require 'pry'
2
+ require 'content_spinning'
3
+ require 'uri'
4
+ require 'json'
5
+ require 'net/http'
6
+ require 'openssl'
7
+ require 'time'
8
+ require 'faraday'
9
+ =begin
10
+ require 'html_to_plain_text'
11
+ require "RedCloth"
12
+ require 'cgi'
13
+ require 'httpclient'
14
+ require 'open-uri'
15
+ require 'date'
16
+ require 'rest-client'
17
+ require 'net/ssh'
18
+ require 'digest/md5'
19
+ require 'domainatrix'
20
+ =end
21
+ require_relative './functions'
22
+ require_relative './extend_string'
23
+ require_relative './extend_time'
24
+ require_relative './extend_datetime'
25
+ require_relative './extend_fixnum'
26
+ require_relative './extend_float'
27
+ require_relative './extend_exception'