diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e86f5fa --- /dev/null +++ b/.editorconfig @@ -0,0 +1,32 @@ +; http://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[*.txt] +insert_final_newline = false +trim_trailing_whitespace = false + +[*.py] +indent_size = 4 + +[*.m] +indent_size = 4 + +[Makefile] +indent_style = tab +indent_size = 8 + +[*.{js,json}] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..480fcc4 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,46 @@ +{ + "disallowKeywords": ["with"], + "disallowKeywordsOnNewLine": ["else"], + "disallowMixedSpacesAndTabs": true, + "disallowMultipleVarDecl": "exceptUndefined", + "disallowNewlineBeforeBlockStatements": true, + "disallowQuotedKeysInObjects": true, + "disallowSpaceAfterObjectKeys": true, + "disallowSpaceAfterPrefixUnaryOperators": true, + "disallowSpacesInFunction": { + "beforeOpeningRoundBrace": true + }, + "disallowSpacesInsideParentheses": true, + "disallowTrailingWhitespace": true, + "maximumLineLength": 160, + "requireCamelCaseOrUpperCaseIdentifiers": false, + "requireCapitalizedComments": true, + "requireCapitalizedConstructors": true, + "requireCurlyBraces": true, + "requireSpaceAfterKeywords": [ + "if", + "else", + "for", + "while", + "do", + "switch", + "case", + "return", + "try", + "catch", + "typeof" + ], + "requireSpaceAfterLineComment": true, + "requireSpaceAfterBinaryOperators": true, + "requireSpaceBeforeBinaryOperators": true, + "requireSpaceBeforeBlockStatements": true, + "requireSpaceBeforeObjectValues": true, + "requireSpacesInFunction": { + "beforeOpeningCurlyBrace": true + }, + "requireTrailingComma": false, + "requireEarlyReturn": false, + "validateIndentation": 2, + "validateLineBreaks": "LF", + "validateQuoteMarks": "'" +} diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..375085b --- /dev/null +++ b/.jshintrc @@ -0,0 +1,37 @@ +{ + "predef": [ + "Promise", + "$" + ], + "globals": { + "$": false, + "MicroEvent": false + }, + "node":true, + "browser": true, + "boss": true, + "curly": true, + "debug": false, + "devel": true, + "eqeqeq": true, + "evil": true, + "forin": false, + "immed": false, + "laxbreak": false, + "newcap": true, + "noarg": true, + "noempty": false, + "nonew": false, + "nomen": false, + "onevar": false, + "plusplus": false, + "regexp": false, + "undef": true, + "sub": true, + "strict": false, + "white": false, + "eqnull": true, + "esnext": true, + "unused": true, + "supernew":true +} diff --git a/data/backup/data.json b/data/backup/data.json new file mode 100644 index 0000000..722a3e4 --- /dev/null +++ b/data/backup/data.json @@ -0,0 +1,832 @@ +[ + [ + "2016-10-14", + 7, + 13, + 19, + 31, + 34, + 1, + 11 + ], + [ + "2016-10-11", + 5, + 12, + 20, + 24, + 37, + 4, + 11 + ], + [ + "2016-10-07", + 2, + 12, + 20, + 27, + 30, + 9, + 11 + ], + [ + "2016-10-04", + 4, + 7, + 14, + 34, + 38, + 4, + 11 + ], + [ + "2016-09-30", + 17, + 35, + 37, + 43, + 44, + 2, + 10 + ], + [ + "2016-09-27", + 6, + 9, + 13, + 39, + 41, + 2, + 12 + ], + [ + "2016-09-23", + 14, + 16, + 39, + 42, + 49, + 3, + 9 + ], + [ + "2016-09-20", + 1, + 4, + 10, + 41, + 45, + 6, + 9 + ], + [ + "2016-09-16", + 5, + 8, + 14, + 22, + 32, + 2, + 11 + ], + [ + "2016-09-13", + 4, + 7, + 16, + 35, + 44, + 1, + 3 + ], + [ + "2016-09-09", + 4, + 11, + 15, + 17, + 28, + 1, + 3 + ], + [ + "2016-09-06", + 12, + 24, + 30, + 34, + 45, + 7, + 10 + ], + [ + "2016-09-02", + 8, + 16, + 32, + 40, + 50, + 2, + 11 + ], + [ + "2016-08-30", + 13, + 16, + 29, + 35, + 42, + 6, + 8 + ], + [ + "2016-08-26", + 1, + 9, + 28, + 30, + 48, + 7, + 8 + ], + [ + "2016-08-23", + 2, + 23, + 31, + 37, + 45, + 4, + 8 + ], + [ + "2016-08-19", + 5, + 6, + 22, + 25, + 34, + 5, + 7 + ], + [ + "2016-08-16", + 2, + 26, + 34, + 37, + 46, + 4, + 8 + ], + [ + "2016-08-12", + 2, + 15, + 28, + 36, + 50, + 2, + 11 + ], + [ + "2016-08-09", + 12, + 19, + 43, + 44, + 45, + 5, + 10 + ], + [ + "2016-08-05", + 16, + 19, + 24, + 35, + 37, + 2, + 7 + ], + [ + "2016-08-02", + 2, + 8, + 27, + 38, + 46, + 2, + 6 + ], + [ + "2016-07-29", + 1, + 21, + 26, + 40, + 50, + 2, + 4 + ], + [ + "2016-07-26", + 3, + 10, + 13, + 45, + 49, + 2, + 11 + ], + [ + "2016-07-22", + 7, + 24, + 26, + 37, + 45, + 5, + 9 + ], + [ + "2016-07-19", + 19, + 24, + 28, + 36, + 37, + 3, + 6 + ], + [ + "2016-07-15", + 2, + 11, + 13, + 14, + 21, + 1, + 8 + ], + [ + "2016-07-12", + 3, + 7, + 26, + 33, + 41, + 2, + 10 + ], + [ + "2016-07-08", + 8, + 12, + 18, + 33, + 44, + 4, + 8 + ], + [ + "2016-07-05", + 1, + 10, + 29, + 38, + 48, + 3, + 4 + ], + [ + "2016-07-01", + 2, + 11, + 13, + 40, + 50, + 1, + 10 + ], + [ + "2016-06-28", + 26, + 32, + 37, + 43, + 49, + 4, + 5 + ], + [ + "2016-06-24", + 11, + 19, + 27, + 28, + 39, + 3, + 10 + ], + [ + "2016-06-21", + 5, + 17, + 32, + 35, + 49, + 1, + 5 + ], + [ + "2016-06-17", + 1, + 7, + 18, + 27, + 43, + 4, + 8 + ], + [ + "2016-06-14", + 13, + 34, + 39, + 42, + 50, + 9, + 11 + ], + [ + "2016-06-10", + 14, + 21, + 35, + 42, + 43, + 7, + 9 + ], + [ + "2016-06-07", + 19, + 26, + 35, + 45, + 49, + 2, + 5 + ], + [ + "2016-06-03", + 7, + 23, + 31, + 33, + 39, + 6, + 10 + ], + [ + "2016-05-31", + 6, + 12, + 26, + 30, + 48, + 6, + 7 + ], + [ + "2016-05-27", + 13, + 25, + 27, + 43, + 46, + 4, + 8 + ], + [ + "2016-05-24", + 16, + 17, + 23, + 34, + 37, + 6, + 9 + ], + [ + "2016-05-20", + 9, + 14, + 30, + 41, + 45, + 4, + 9 + ], + [ + "2016-05-17", + 15, + 27, + 32, + 36, + 39, + 3, + 10 + ], + [ + "2016-05-13", + 7, + 15, + 28, + 31, + 42, + 10, + 11 + ], + [ + "2016-05-10", + 2, + 26, + 27, + 40, + 49, + 5, + 10 + ], + [ + "2016-05-06", + 32, + 34, + 40, + 45, + 48, + 1, + 10 + ], + [ + "2016-05-03", + 8, + 23, + 24, + 34, + 38, + 3, + 7 + ], + [ + "2016-04-29", + 4, + 5, + 25, + 28, + 43, + 6, + 11 + ], + [ + "2016-04-26", + 10, + 17, + 31, + 32, + 42, + 2, + 5 + ], + [ + "2016-04-22", + 17, + 26, + 32, + 34, + 43, + 2, + 10 + ], + [ + "2016-04-19", + 11, + 14, + 15, + 27, + 44, + 2, + 7 + ], + [ + "2016-04-15", + 13, + 14, + 32, + 37, + 48, + 1, + 7 + ], + [ + "2016-04-12", + 1, + 5, + 9, + 22, + 38, + 2, + 10 + ], + [ + "2016-04-08", + 6, + 8, + 26, + 43, + 49, + 6, + 10 + ], + [ + "2016-04-05", + 3, + 5, + 9, + 19, + 40, + 2, + 5 + ], + [ + "2016-04-01", + 2, + 16, + 23, + 25, + 49, + 6, + 9 + ], + [ + "2016-03-29", + 1, + 4, + 19, + 25, + 36, + 3, + 11 + ], + [ + "2016-03-25", + 12, + 19, + 36, + 42, + 43, + 5, + 8 + ], + [ + "2016-03-22", + 12, + 15, + 26, + 42, + 49, + 5, + 8 + ], + [ + "2016-03-18", + 14, + 19, + 21, + 24, + 49, + 5, + 11 + ], + [ + "2016-03-15", + 5, + 7, + 10, + 34, + 44, + 2, + 10 + ], + [ + "2016-03-11", + 1, + 21, + 26, + 40, + 43, + 6, + 9 + ], + [ + "2016-03-08", + 1, + 8, + 9, + 14, + 23, + 1, + 7 + ], + [ + "2016-03-04", + 6, + 9, + 14, + 23, + 40, + 1, + 5 + ], + [ + "2016-03-01", + 4, + 7, + 13, + 28, + 37, + 10, + 11 + ], + [ + "2016-02-26", + 5, + 13, + 15, + 33, + 50, + 9, + 11 + ], + [ + "2016-02-23", + 23, + 25, + 32, + 37, + 42, + 1, + 11 + ], + [ + "2016-02-19", + 13, + 14, + 30, + 32, + 39, + 3, + 9 + ], + [ + "2016-02-16", + 3, + 10, + 22, + 37, + 50, + 6, + 10 + ], + [ + "2016-02-12", + 3, + 20, + 28, + 31, + 49, + 2, + 5 + ], + [ + "2016-02-09", + 6, + 9, + 13, + 28, + 37, + 4, + 5 + ], + [ + "05-Feb-2016", + 3, + 27, + 32, + 41, + 46, + 4, + 8 + ], + [ + "02-Feb-2016", + 36, + 21, + 10, + 6, + 9, + 6, + 2 + ], + [ + "29-Jan-2016", + 29, + 32, + 23, + 1, + 5, + 1, + 7 + ], + [ + "26-Jan-2016", + 15, + 40, + 24, + 48, + 38, + 2, + 9 + ], + [ + "22-Jan-2016", + 27, + 10, + 30, + 47, + 12, + 9, + 8 + ], + [ + "19-Jan-2016", + 2, + 30, + 38, + 43, + 46, + 7, + 2 + ], + [ + "15-Jan-2016", + 43, + 38, + 19, + 10, + 46, + 1, + 11 + ], + [ + "12-Jan-2016", + 2, + 10, + 30, + 44, + 1, + 1, + 8 + ], + [ + "08-Jan-2016", + 35, + 33, + 26, + 40, + 5, + 3, + 8 + ], + [ + "05-Jan-2016", + 6, + 10, + 31, + 36, + 39, + 6, + 10 + ], + [ + "01-Jan-2016", + 4, + 37, + 38, + 39, + 44, + 4, + 7 + ] +] \ No newline at end of file diff --git a/data/data.json b/data/data.json index 722a3e4..eada054 100644 --- a/data/data.json +++ b/data/data.json @@ -1,832 +1 @@ -[ - [ - "2016-10-14", - 7, - 13, - 19, - 31, - 34, - 1, - 11 - ], - [ - "2016-10-11", - 5, - 12, - 20, - 24, - 37, - 4, - 11 - ], - [ - "2016-10-07", - 2, - 12, - 20, - 27, - 30, - 9, - 11 - ], - [ - "2016-10-04", - 4, - 7, - 14, - 34, - 38, - 4, - 11 - ], - [ - "2016-09-30", - 17, - 35, - 37, - 43, - 44, - 2, - 10 - ], - [ - "2016-09-27", - 6, - 9, - 13, - 39, - 41, - 2, - 12 - ], - [ - "2016-09-23", - 14, - 16, - 39, - 42, - 49, - 3, - 9 - ], - [ - "2016-09-20", - 1, - 4, - 10, - 41, - 45, - 6, - 9 - ], - [ - "2016-09-16", - 5, - 8, - 14, - 22, - 32, - 2, - 11 - ], - [ - "2016-09-13", - 4, - 7, - 16, - 35, - 44, - 1, - 3 - ], - [ - "2016-09-09", - 4, - 11, - 15, - 17, - 28, - 1, - 3 - ], - [ - "2016-09-06", - 12, - 24, - 30, - 34, - 45, - 7, - 10 - ], - [ - "2016-09-02", - 8, - 16, - 32, - 40, - 50, - 2, - 11 - ], - [ - "2016-08-30", - 13, - 16, - 29, - 35, - 42, - 6, - 8 - ], - [ - "2016-08-26", - 1, - 9, - 28, - 30, - 48, - 7, - 8 - ], - [ - "2016-08-23", - 2, - 23, - 31, - 37, - 45, - 4, - 8 - ], - [ - "2016-08-19", - 5, - 6, - 22, - 25, - 34, - 5, - 7 - ], - [ - "2016-08-16", - 2, - 26, - 34, - 37, - 46, - 4, - 8 - ], - [ - "2016-08-12", - 2, - 15, - 28, - 36, - 50, - 2, - 11 - ], - [ - "2016-08-09", - 12, - 19, - 43, - 44, - 45, - 5, - 10 - ], - [ - "2016-08-05", - 16, - 19, - 24, - 35, - 37, - 2, - 7 - ], - [ - "2016-08-02", - 2, - 8, - 27, - 38, - 46, - 2, - 6 - ], - [ - "2016-07-29", - 1, - 21, - 26, - 40, - 50, - 2, - 4 - ], - [ - "2016-07-26", - 3, - 10, - 13, - 45, - 49, - 2, - 11 - ], - [ - "2016-07-22", - 7, - 24, - 26, - 37, - 45, - 5, - 9 - ], - [ - "2016-07-19", - 19, - 24, - 28, - 36, - 37, - 3, - 6 - ], - [ - "2016-07-15", - 2, - 11, - 13, - 14, - 21, - 1, - 8 - ], - [ - "2016-07-12", - 3, - 7, - 26, - 33, - 41, - 2, - 10 - ], - [ - "2016-07-08", - 8, - 12, - 18, - 33, - 44, - 4, - 8 - ], - [ - "2016-07-05", - 1, - 10, - 29, - 38, - 48, - 3, - 4 - ], - [ - "2016-07-01", - 2, - 11, - 13, - 40, - 50, - 1, - 10 - ], - [ - "2016-06-28", - 26, - 32, - 37, - 43, - 49, - 4, - 5 - ], - [ - "2016-06-24", - 11, - 19, - 27, - 28, - 39, - 3, - 10 - ], - [ - "2016-06-21", - 5, - 17, - 32, - 35, - 49, - 1, - 5 - ], - [ - "2016-06-17", - 1, - 7, - 18, - 27, - 43, - 4, - 8 - ], - [ - "2016-06-14", - 13, - 34, - 39, - 42, - 50, - 9, - 11 - ], - [ - "2016-06-10", - 14, - 21, - 35, - 42, - 43, - 7, - 9 - ], - [ - "2016-06-07", - 19, - 26, - 35, - 45, - 49, - 2, - 5 - ], - [ - "2016-06-03", - 7, - 23, - 31, - 33, - 39, - 6, - 10 - ], - [ - "2016-05-31", - 6, - 12, - 26, - 30, - 48, - 6, - 7 - ], - [ - "2016-05-27", - 13, - 25, - 27, - 43, - 46, - 4, - 8 - ], - [ - "2016-05-24", - 16, - 17, - 23, - 34, - 37, - 6, - 9 - ], - [ - "2016-05-20", - 9, - 14, - 30, - 41, - 45, - 4, - 9 - ], - [ - "2016-05-17", - 15, - 27, - 32, - 36, - 39, - 3, - 10 - ], - [ - "2016-05-13", - 7, - 15, - 28, - 31, - 42, - 10, - 11 - ], - [ - "2016-05-10", - 2, - 26, - 27, - 40, - 49, - 5, - 10 - ], - [ - "2016-05-06", - 32, - 34, - 40, - 45, - 48, - 1, - 10 - ], - [ - "2016-05-03", - 8, - 23, - 24, - 34, - 38, - 3, - 7 - ], - [ - "2016-04-29", - 4, - 5, - 25, - 28, - 43, - 6, - 11 - ], - [ - "2016-04-26", - 10, - 17, - 31, - 32, - 42, - 2, - 5 - ], - [ - "2016-04-22", - 17, - 26, - 32, - 34, - 43, - 2, - 10 - ], - [ - "2016-04-19", - 11, - 14, - 15, - 27, - 44, - 2, - 7 - ], - [ - "2016-04-15", - 13, - 14, - 32, - 37, - 48, - 1, - 7 - ], - [ - "2016-04-12", - 1, - 5, - 9, - 22, - 38, - 2, - 10 - ], - [ - "2016-04-08", - 6, - 8, - 26, - 43, - 49, - 6, - 10 - ], - [ - "2016-04-05", - 3, - 5, - 9, - 19, - 40, - 2, - 5 - ], - [ - "2016-04-01", - 2, - 16, - 23, - 25, - 49, - 6, - 9 - ], - [ - "2016-03-29", - 1, - 4, - 19, - 25, - 36, - 3, - 11 - ], - [ - "2016-03-25", - 12, - 19, - 36, - 42, - 43, - 5, - 8 - ], - [ - "2016-03-22", - 12, - 15, - 26, - 42, - 49, - 5, - 8 - ], - [ - "2016-03-18", - 14, - 19, - 21, - 24, - 49, - 5, - 11 - ], - [ - "2016-03-15", - 5, - 7, - 10, - 34, - 44, - 2, - 10 - ], - [ - "2016-03-11", - 1, - 21, - 26, - 40, - 43, - 6, - 9 - ], - [ - "2016-03-08", - 1, - 8, - 9, - 14, - 23, - 1, - 7 - ], - [ - "2016-03-04", - 6, - 9, - 14, - 23, - 40, - 1, - 5 - ], - [ - "2016-03-01", - 4, - 7, - 13, - 28, - 37, - 10, - 11 - ], - [ - "2016-02-26", - 5, - 13, - 15, - 33, - 50, - 9, - 11 - ], - [ - "2016-02-23", - 23, - 25, - 32, - 37, - 42, - 1, - 11 - ], - [ - "2016-02-19", - 13, - 14, - 30, - 32, - 39, - 3, - 9 - ], - [ - "2016-02-16", - 3, - 10, - 22, - 37, - 50, - 6, - 10 - ], - [ - "2016-02-12", - 3, - 20, - 28, - 31, - 49, - 2, - 5 - ], - [ - "2016-02-09", - 6, - 9, - 13, - 28, - 37, - 4, - 5 - ], - [ - "05-Feb-2016", - 3, - 27, - 32, - 41, - 46, - 4, - 8 - ], - [ - "02-Feb-2016", - 36, - 21, - 10, - 6, - 9, - 6, - 2 - ], - [ - "29-Jan-2016", - 29, - 32, - 23, - 1, - 5, - 1, - 7 - ], - [ - "26-Jan-2016", - 15, - 40, - 24, - 48, - 38, - 2, - 9 - ], - [ - "22-Jan-2016", - 27, - 10, - 30, - 47, - 12, - 9, - 8 - ], - [ - "19-Jan-2016", - 2, - 30, - 38, - 43, - 46, - 7, - 2 - ], - [ - "15-Jan-2016", - 43, - 38, - 19, - 10, - 46, - 1, - 11 - ], - [ - "12-Jan-2016", - 2, - 10, - 30, - 44, - 1, - 1, - 8 - ], - [ - "08-Jan-2016", - 35, - 33, - 26, - 40, - 5, - 3, - 8 - ], - [ - "05-Jan-2016", - 6, - 10, - 31, - 36, - 39, - 6, - 10 - ], - [ - "01-Jan-2016", - 4, - 37, - 38, - 39, - 44, - 4, - 7 - ] -] \ No newline at end of file +[["2016-10-14",7,13,19,31,34,1,11],["2016-10-11",5,12,20,24,37,4,11],["2016-10-07",2,12,20,27,30,9,11],["2016-10-04",4,7,14,34,38,4,11],["2016-09-30",17,35,37,43,44,2,10],["2016-09-27",6,9,13,39,41,2,12],["2016-09-23",14,16,39,42,49,3,9],["2016-09-20",1,4,10,41,45,6,9],["2016-09-16",5,8,14,22,32,2,11],["2016-09-13",4,7,16,35,44,1,3],["2016-09-09",4,11,15,17,28,1,3],["2016-09-06",12,24,30,34,45,7,10],["2016-09-02",8,16,32,40,50,2,11],["2016-08-30",13,16,29,35,42,6,8],["2016-08-26",1,9,28,30,48,7,8],["2016-08-23",2,23,31,37,45,4,8],["2016-08-19",5,6,22,25,34,5,7],["2016-08-16",2,26,34,37,46,4,8],["2016-08-12",2,15,28,36,50,2,11],["2016-08-09",12,19,43,44,45,5,10],["2016-08-05",16,19,24,35,37,2,7],["2016-08-02",2,8,27,38,46,2,6],["2016-07-29",1,21,26,40,50,2,4],["2016-07-26",3,10,13,45,49,2,11],["2016-07-22",7,24,26,37,45,5,9],["2016-07-19",19,24,28,36,37,3,6],["2016-07-15",2,11,13,14,21,1,8],["2016-07-12",3,7,26,33,41,2,10],["2016-07-08",8,12,18,33,44,4,8],["2016-07-05",1,10,29,38,48,3,4],["2016-07-01",2,11,13,40,50,1,10],["2016-06-28",26,32,37,43,49,4,5],["2016-06-24",11,19,27,28,39,3,10],["2016-06-21",5,17,32,35,49,1,5],["2016-06-17",1,7,18,27,43,4,8],["2016-06-14",13,34,39,42,50,9,11],["2016-06-10",14,21,35,42,43,7,9],["2016-06-07",19,26,35,45,49,2,5],["2016-06-03",7,23,31,33,39,6,10],["2016-05-31",6,12,26,30,48,6,7],["2016-05-27",13,25,27,43,46,4,8],["2016-05-24",16,17,23,34,37,6,9],["2016-05-20",9,14,30,41,45,4,9],["2016-05-17",15,27,32,36,39,3,10],["2016-05-13",7,15,28,31,42,10,11],["2016-05-10",2,26,27,40,49,5,10],["2016-05-06",32,34,40,45,48,1,10],["2016-05-03",8,23,24,34,38,3,7],["2016-04-29",4,5,25,28,43,6,11],["2016-04-26",10,17,31,32,42,2,5],["2016-04-22",17,26,32,34,43,2,10],["2016-04-19",11,14,15,27,44,2,7],["2016-04-15",13,14,32,37,48,1,7],["2016-04-12",1,5,9,22,38,2,10],["2016-04-08",6,8,26,43,49,6,10],["2016-04-05",3,5,9,19,40,2,5],["2016-04-01",2,16,23,25,49,6,9],["2016-03-29",1,4,19,25,36,3,11],["2016-03-25",12,19,36,42,43,5,8],["2016-03-22",12,15,26,42,49,5,8],["2016-03-18",14,19,21,24,49,5,11],["2016-03-15",5,7,10,34,44,2,10],["2016-03-11",1,21,26,40,43,6,9],["2016-03-08",1,8,9,14,23,1,7],["2016-03-04",6,9,14,23,40,1,5],["2016-03-01",4,7,13,28,37,10,11],["2016-02-26",5,13,15,33,50,9,11],["2016-02-23",23,25,32,37,42,1,11],["2016-02-19",13,14,30,32,39,3,9],["2016-02-16",3,10,22,37,50,6,10],["2016-02-12",3,20,28,31,49,2,5],["2016-02-09",6,9,13,28,37,4,5],["05-Feb-2016",3,27,32,41,46,4,8],["02-Feb-2016",36,21,10,6,9,6,2],["29-Jan-2016",29,32,23,1,5,1,7],["26-Jan-2016",15,40,24,48,38,2,9],["22-Jan-2016",27,10,30,47,12,9,8],["19-Jan-2016",2,30,38,43,46,7,2],["15-Jan-2016",43,38,19,10,46,1,11],["12-Jan-2016",2,10,30,44,1,1,8],["08-Jan-2016",35,33,26,40,5,3,8],["05-Jan-2016",6,10,31,36,39,6,10],["01-Jan-2016",4,37,38,39,44,4,7]] diff --git a/lot.js b/lot.js index eeb4823..0ed141f 100644 --- a/lot.js +++ b/lot.js @@ -4,6 +4,8 @@ var jsonfile = require('jsonfile'), https = require('https'), UltraSES = require('ultrases'),cron = require('node-cron'); +var Sugar = require('sugar-date'); + var file = 'data/data.json'; var m = [], prev = [], @@ -36,18 +38,41 @@ function $(elm) { } function resultsQuery(callback) { - var options = { + /* var options = { host: 'nunofcguerreiro.com', path: '/api-euromillions-json', port: 443, headers: { - accept: '*/*' - /* 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(data)*/ + accept: '*!/!*' + /!* 'Content-Type': 'application/json', + 'Content-Length': Buffer.byteLength(data)*!/ }, method: 'GET' - }; + };*/ + + var options = { + host: 'euromillions.p.mashape.com', + path: '/ResultsService/FindLast', + //port: 443, + headers: { + accept: "text/plain", + "X-Mashape-Key": "5A0H980jK6mshSFL24ZmfiRrNHV2p1d1fhQjsngtx8QWuO9oe4" + /* 'Content-Type': 'application/json', + 'Content-Length': Buffer.byteLength(data)*/ + + }, + method: 'GET' + }; + + /* + unirest.get("https://euromillions.p.mashape.com/ResultsService/FindLast") + .header("X-Mashape-Key", "5A0H980jK6mshSFL24ZmfiRrNHV2p1d1fhQjsngtx8QWuO9oe4") + .header("Accept", "text/plain") + .end(function (result) { + console.log(result.status, result.headers, result.body); + }); + */ https.request(options).on('response', function (response) { var data = ''; @@ -406,8 +431,8 @@ function sendEmail() { to: 'martind2000@gmail.com', subject: 'Todays numbers' }; - - + + var template = { file: './jade/output.jade', locals: resultsObj }; mailer.sendTemplate(email, template, function(err){ if(err) throw err; @@ -416,27 +441,40 @@ function sendEmail() { } - function processData(data) { + newArray.push(data.drawns[0].date); + + numbers = data.drawns[0].numbers.split(' '); + for (var i = 0; i < numbers.length; ++i) { + numbers[i] = parseInt(numbers[i]); + } + + stars = data.drawns[0].stars.split(' '); + for (var i = 0; i < stars.length; ++i) { + stars[i] = parseInt(stars[i]); + } + newArray = newArray.concat(numbers); + newArray = newArray.concat(stars); + + + re.unshift(newArray); +} +function processDataV2(data) { var newArray = []; - var numbers, stars; + var numbers, stars, date ; - newArray.push(data.drawns[0].date); + console.log(data); - numbers = data.drawns[0].numbers.split(' '); - for (var i = 0; i < numbers.length; ++i) { - numbers[i] = parseInt(numbers[i]); - } - - stars = data.drawns[0].stars.split(' '); - for (var i = 0; i < stars.length; ++i) { - stars[i] = parseInt(stars[i]); - } - newArray = newArray.concat(numbers); - newArray = newArray.concat(stars); +date = /(\/Date\()([0-9]+)([\s\S]+)/.exec(data.Date); + console.log(date[2]); + date = date[2]; +//date = parseInt(date) / 1000; + console.log(new Date(date)); + // date = Date.create(date.toString()); - re.unshift(newArray); + console.log(date); + } @@ -466,9 +504,9 @@ function GO() { prepareResults(); console.log(resultsObj); - + sendEmail(); - + saveData(); }); @@ -482,10 +520,35 @@ function GO() { //sendEmail(); -cron.schedule('1 00 18 * * 2,5', function(){ +cron.schedule('45 17 * * 2,5', function(){ GO(); // console.log('tick'); return -1; }); -// GO(); \ No newline at end of file + processDataV2({ Date: '/Date(1477008000000+0000)/', + Jackpot: 39000000, + NextJackpot: 49000000, + Num1: 9, + Num2: 20, + Num3: 23, + Num4: 44, + Num5: 48, + PrizeCombinations: + [ { Numbers: 5, Prize: 0, Stars: 2, Winners: 0 }, + { Numbers: 5, Prize: 408989.59, Stars: 1, Winners: 3 }, + { Numbers: 5, Prize: 28577.5, Stars: 0, Winners: 10 }, + { Numbers: 4, Prize: 3882.81, Stars: 2, Winners: 36 }, + { Numbers: 4, Prize: 176.24, Stars: 1, Winners: 846 }, + { Numbers: 3, Prize: 130.81, Stars: 2, Winners: 1591 }, + { Numbers: 4, Prize: 65.36, Stars: 0, Winners: 1806 }, + { Numbers: 2, Prize: 21.79, Stars: 2, Winners: 24943 }, + { Numbers: 3, Prize: 15.99, Stars: 1, Winners: 35930 }, + { Numbers: 3, Prize: 12.73, Stars: 0, Winners: 85437 }, + { Numbers: 1, Prize: 11.99, Stars: 2, Winners: 128187 }, + { Numbers: 2, Prize: 8.48, Stars: 1, Winners: 544209 }, + { Numbers: 2, Prize: 4.4, Stars: 0, Winners: 1289660 } ], + RaffleNumber: 0, + Star1: 8, + Star2: 10 } + ); diff --git a/package.json b/package.json index e24e00a..7532d42 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node lot.js" }, "author": "", "license": "ISC", @@ -17,6 +18,8 @@ "lot": "./lot.js" }, "dependencies": { - "jsonfile": "^2.4.0" + "jsonfile": "^2.4.0", + "sugar": "^2.0.1", + "sugar-date": "^2.0.0" } }