Skip to content

Commit 12f33d7

Browse files
committed
First Commit
1 parent c649e67 commit 12f33d7

15 files changed

+335
-0
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
tab_width = 2
6+
indent_size = 2
7+
indent_style = space
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"eslint.autoFixOnSave": false,
3+
"eslint.validate": [],
4+
5+
"env": {
6+
"browser": false,
7+
"node": true,
8+
"jest": true
9+
},
10+
"parserOptions": {
11+
"ecmaVersion": 2018,
12+
"ecmaFeatures": {
13+
"modules": true,
14+
"impliedStrict": true
15+
}
16+
},
17+
"plugins": [
18+
"node",
19+
"promise",
20+
"jest",
21+
"unicorn"
22+
],
23+
"extends": [
24+
"eslint:recommended",
25+
"plugin:node/recommended",
26+
"plugin:promise/recommended",
27+
"plugin:jest/recommended",
28+
"plugin:unicorn/recommended"
29+
],
30+
"rules": {
31+
"no-console": 0,
32+
"no-process-exit": 0,
33+
"unicorn/no-process-exit": 0,
34+
"semi": ["error", "never"]
35+
}
36+
}

.jshintrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"esversion": 9,
3+
"sub": true,
4+
"asi": false,
5+
"esnext": false,
6+
"moz": true,
7+
"boss": true,
8+
"node": true,
9+
"validthis": true,
10+
"globals": {
11+
"EventEmitter": true,
12+
"Promise": true
13+
}
14+
}

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test/
2+
tmp/
3+
.OLD/

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore all files:
2+
*.*

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"trailingComma": "none",
3+
"prettier.trailingComma": "none",
4+
"tabWidth": 2,
5+
"semi": false,
6+
"singleQuote": true
7+
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"typescript.suggestionActions.enabled": false,
3+
"javascript.suggestionActions.enabled": false
4+
}

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
# THE ABCABC KILLER PATTERN
3+
4+
# findpattern
5+
6+
I am really tired about this s*hit... A lot of assessment for a f*cking job required to make a stupid function ....
7+
thay ask to have the times of repetition of substrings like "ABCABC" ... and the same funtion need to report the length of same chars like 'CCCC'... Please, refuse test or assessment like that... not have any sense... expecially if you looking for a position as font end... Should be a 'creative' position... what is the pourpuse of this test??? ... Know if you are crazy?, stupid?... so... it's my solution for you!
8+
9+
This is the most used test...
10+
11+
[a relative link](https://leetcode.com/problems/repeated-substring-pattern/)
12+
13+
My name is Dario Passariello... you can agree with me or not... but life is short....
14+
15+
```javascript
16+
const findPattern = ( word ) => {
17+
18+
let
19+
replace = word.match( /(.+)(?=.*?\1)/g ),
20+
pattern = new RegExp( replace , "g"),
21+
final = word.match( pattern );
22+
23+
// console.log( replace );
24+
// console.log( pattern );
25+
// console.log( final );
26+
27+
if( final )
28+
return final.length;
29+
else if
30+
return word.length;
31+
32+
};
33+
```
34+
35+
## HOW IT'S WORKS
36+
37+
test it:
38+
39+
```javascript
40+
// 'abcabc' = 2 groups
41+
console.log( findPattern('abcabc') );
42+
43+
// cccc = 4 repeated chars
44+
console.log( findPattern('cccc') );
45+
```

SPA.code-workspace

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"folders": [
3+
{ "path": "./" }
4+
],
5+
"settings": {
6+
7+
"editor.hover.enabled": true,
8+
"editor.hover.delay": 1000,
9+
"editor.quickSuggestions": true,
10+
"editor.quickSuggestionsDelay": 1000,
11+
12+
"editor.tabCompletion": "off",
13+
"editor.renderWhitespace": "all",
14+
"editor.acceptSuggestionOnEnter": "on",
15+
"editor.defaultFormatter": null,
16+
"editor.formatOnSave": false,
17+
"editor.autoClosingBrackets": "always",
18+
"editor.autoClosingOvertype": "always",
19+
"editor.tabSize": 2,
20+
"editor.codeActionsOnSave": { "source.organizeImports": false },
21+
22+
"files.trimTrailingWhitespace": true,
23+
"typescript.format.semicolons": "remove",
24+
"javascript.format.semicolons" : "remove",
25+
26+
"[typescript]": {},
27+
"[markdown]": {},
28+
"[php]": {},
29+
"[css]": {},
30+
"[less]": {},
31+
"[js]": {},
32+
33+
"files.exclude": {
34+
"**/.DS_Store": true,
35+
"**/node_modules": true,
36+
"**/.git": true,
37+
"**/.svg": true,
38+
"**/.xml": true,
39+
"**/node_*": true,
40+
"**/bower_components": true,
41+
"**/.cache": true,
42+
"**/tmp": true,
43+
"*.lnk": true,
44+
"node_modules": true,
45+
".editorconfig": true,
46+
".prettierrc": true,
47+
".prettierignore": true,
48+
"package-lock.json": true,
49+
".babelrc": true,
50+
"babel.config.js": true,
51+
"jest.config.js": true
52+
},
53+
54+
"search.exclude": {
55+
".editorconfig": true,
56+
"**/.cache": true,
57+
"**/.DS_Store": true,
58+
"**/.git": true,
59+
"**/.svg": true,
60+
"**/.xml": true,
61+
"**/bower_components": true,
62+
"**/node_*": true,
63+
"**/node_modules": true,
64+
"**/tmp": true,
65+
"babel.config.js": true,
66+
"jest.config.js": true,
67+
"node_modules": true,
68+
"package-lock.json": true
69+
}
70+
71+
}
72+
73+
}

cmd.exe.lnk

1.26 KB
Binary file not shown.

index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
declare module 'dpfrost';
2+
3+
declare global {
4+
interface Window {
5+
dpfrost:any;
6+
}
7+
}
8+
9+
let dpfrost = window.dpfrost;

index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*!
2+
* findpattern <https://github.com/passariello/findpattern>
3+
*
4+
* Copyright (c) 2021, Dario Passariello.
5+
* Licensed under the Apache-2.0 License.
6+
*/
7+
8+
/***********************************************************************/
9+
10+
'use strict';
11+
12+
module.exports = require('./init.js');

init.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*!
2+
* findpattern <https://github.com/passariello/findpattern>
3+
*
4+
* Copyright (c) 2021, Dario Passariello.
5+
* Licensed under the Apache-2.0 License.
6+
*/
7+
8+
/***********************************************************************/
9+
10+
(function () {
11+
12+
if (typeof window === 'undefined') {
13+
global.window = {};
14+
}
15+
16+
const pjson = require('./package.json');
17+
18+
// CREATE ROOT STORE
19+
window.findpattern = {};
20+
21+
// FIRST MESSAGE
22+
console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
23+
console.debug( `%c${pjson.name} v${pjson.version}%c by Dario Passariello started`,"color:orange","" );
24+
console.debug( `%cType ${pjson.name} in this console to see it`, "color:gray","" );
25+
console.debug( "%cFor help visit: " + pjson.repository.help, "color:gray","" );
26+
console.debug( 'name: %c' + pjson.name,"color:orange","" );
27+
console.debug( 'version: %c' + pjson.version,"color:orange","" );
28+
console.debug( 'description: %c' + pjson.description,"color:orange","" );
29+
console.debug( 'license: %c' + pjson.license,"color:orange","" );
30+
console.debug( 'repository: %c' + pjson.repository.url,"color:orange","" );
31+
console.debug( 'author: %c' + pjson.author.name,"color:orange","" );
32+
console.debug( 'email: %c' + pjson.author.email,"color:orange","" );
33+
console.groupEnd();
34+
35+
// SCRIPT
36+
require('./scripts/findpattern.js');
37+
38+
// test:
39+
// console.log( findPattern('abcabc') );
40+
// console.log( findPattern('cccc') );
41+
42+
})();

package.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "findpattern",
3+
"version": "0.0.1",
4+
"description": "I am tired of this s**t",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"deprecated": false,
10+
"engines": {
11+
"node": ">=0.10.0"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/passariello/findpattern",
16+
"help": "https://github.com/passariello/findpattern#readme"
17+
},
18+
"bugs": {
19+
"url": "https://github.com/passariello/findpattern/issues"
20+
},
21+
"homepage": "https://github.com/passariello/findpattern",
22+
"keywords": [
23+
"find",
24+
"pattern",
25+
"abcabc",
26+
"powerful",
27+
"passariello"
28+
],
29+
"author": {
30+
"name": "Dario Passariello",
31+
"website": "https://dario.passariello.ca",
32+
"email": "[email protected]"
33+
},
34+
"license": "MIT",
35+
"dependencies": {},
36+
"contributors": [
37+
{
38+
"name": "Dario Passariello",
39+
"email": "[email protected]"
40+
},
41+
{
42+
"name": "Valeria Cala Scaglitta",
43+
"email": "[email protected]"
44+
}
45+
]
46+
}

scripts/findpattern.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*!
2+
* findpattern <https://github.com/passariello/findpattern>
3+
*
4+
* Copyright (c) 2021, Dario Passariello.
5+
* Licensed under the Apache-2.0 License.
6+
*/
7+
8+
/***********************************************************************/
9+
10+
const findPattern = ( word ) => {
11+
12+
let
13+
replace = word.match( /(.+)(?=.*?\1)/g ),
14+
pattern = new RegExp( replace , "g"),
15+
final = word.match( pattern );
16+
17+
// console.log( replace );
18+
// console.log( pattern );
19+
// console.log( final );
20+
21+
if( final ){
22+
return final.length;
23+
}else{
24+
return word.length;
25+
}
26+
27+
};
28+
29+

0 commit comments

Comments
 (0)