Travis build: 597 [cron]

This commit is contained in:
30secondsofcode
2018-10-04 20:18:24 +00:00
parent 0fa5902940
commit c0f5d12fbe
4 changed files with 1882 additions and 71 deletions

View File

@ -154,7 +154,7 @@
"fileName": "atob.md", "fileName": "atob.md",
"text": "Decodes a string of data which has been encoded using base-64 encoding.\n\nCreate a `Buffer` for the given string with base-64 encoding and use `Buffer.toString('binary')` to return the decoded string.", "text": "Decodes a string of data which has been encoded using base-64 encoding.\n\nCreate a `Buffer` for the given string with base-64 encoding and use `Buffer.toString('binary')` to return the decoded string.",
"codeBlocks": [ "codeBlocks": [
"const atob = str => new Buffer(str, 'base64').toString('binary');", "const atob = str => Buffer.from(str, 'base64').toString('binary');",
"atob('Zm9vYmFy'); // 'foobar'" "atob('Zm9vYmFy'); // 'foobar'"
], ],
"tags": [ "tags": [
@ -166,7 +166,7 @@
}, },
"meta": { "meta": {
"archived": false, "archived": false,
"hash": "b0f4a972f1e217c5f558359fa17693140a8b97a04a48ec1261691f10fb0c2a3e" "hash": "a1cdc6db4c91c17ea5f072fa38f40505a7500c1d142c33a9f7e8280fb9357fb5"
} }
}, },
{ {
@ -383,7 +383,7 @@
"fileName": "btoa.md", "fileName": "btoa.md",
"text": "Creates a base-64 encoded ASCII string from a String object in which each character in the string is treated as a byte of binary data.\n\nCreate a `Buffer` for the given string with binary encoding and use `Buffer.toString('base64')` to return the encoded string.", "text": "Creates a base-64 encoded ASCII string from a String object in which each character in the string is treated as a byte of binary data.\n\nCreate a `Buffer` for the given string with binary encoding and use `Buffer.toString('base64')` to return the encoded string.",
"codeBlocks": [ "codeBlocks": [
"const btoa = str => new Buffer(str, 'binary').toString('base64');", "const btoa = str => Buffer.from(str, 'binary').toString('base64');",
"btoa('foobar'); // 'Zm9vYmFy'" "btoa('foobar'); // 'Zm9vYmFy'"
], ],
"tags": [ "tags": [
@ -395,7 +395,7 @@
}, },
"meta": { "meta": {
"archived": false, "archived": false,
"hash": "ddbab0e7190004d5240469256d66629aa2fcf3c22348818edc01a8beb64831a6" "hash": "021ec24497f79ba1e18b01f1fc5a7498d21adbb4f556ac026afa817f10d46ae9"
} }
}, },
{ {

View File

@ -303,7 +303,7 @@
"const password = \"fooBaz\";\nconst data = JSON.stringify(password);\nhttpPut('https://website.com/users/123', data, request => {\n console.log(request.responseText);\n}); // 'Updates a user's password in database'", "const password = \"fooBaz\";\nconst data = JSON.stringify(password);\nhttpPut('https://website.com/users/123', data, request => {\n console.log(request.responseText);\n}); // 'Updates a user's password in database'",
"const isArmstrongNumber = digits =>\n (arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)(\n (digits + '').split('')\n );", "const isArmstrongNumber = digits =>\n (arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)(\n (digits + '').split('')\n );",
"isArmstrongNumber(1634); // true\nisArmstrongNumber(56); // false", "isArmstrongNumber(1634); // true\nisArmstrongNumber(56); // false",
"const isSimilar = (pattern, str) =>\n [...str].reduce(\n (matchIndex, char) =>\n char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()\n ? matchIndex + 1\n : matchIndex,\n 0\n ) === pattern.length\n ? true\n : false;", "const isSimilar = (pattern, str) =>\n [...str].reduce(\n (matchIndex, char) =>\n char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()\n ? matchIndex + 1\n : matchIndex,\n 0\n ) === pattern.length;",
"isSimilar('rt','Rohit'); // true\nisSimilar('tr','Rohit'); // false", "isSimilar('rt','Rohit'); // true\nisSimilar('tr','Rohit'); // false",
"``` js\nconst levenshteinDistance = (string1, string2) => {\n if (string1.length === 0) return string2.length;\n if (string2.length === 0) return string1.length;\n let matrix = Array(string2.length + 1)\n .fill(0)\n .map((x, i) => [i]);\n matrix[0] = Array(string1.length + 1)\n .fill(0)\n .map((x, i) => i);\n for (let i = 1; i <= string2.length; i++) {\n for (let j = 1; j <= string1.length; j++) {\n if (string2[i - 1] === string1[j - 1]) {\n matrix[i][j] = matrix[i - 1][j - 1];\n } else {\n matrix[i][j] = Math.min(\n matrix[i - 1][j - 1] + 1,\n matrix[i][j - 1] + 1,\n matrix[i - 1][j] + 1\n );\n }\n }\n }\n return matrix[string2.length][string1.length];\n};\n```", "``` js\nconst levenshteinDistance = (string1, string2) => {\n if (string1.length === 0) return string2.length;\n if (string2.length === 0) return string1.length;\n let matrix = Array(string2.length + 1)\n .fill(0)\n .map((x, i) => [i]);\n matrix[0] = Array(string1.length + 1)\n .fill(0)\n .map((x, i) => i);\n for (let i = 1; i <= string2.length; i++) {\n for (let j = 1; j <= string1.length; j++) {\n if (string2[i - 1] === string1[j - 1]) {\n matrix[i][j] = matrix[i - 1][j - 1];\n } else {\n matrix[i][j] = Math.min(\n matrix[i - 1][j - 1] + 1,\n matrix[i][j - 1] + 1,\n matrix[i - 1][j] + 1\n );\n }\n }\n }\n return matrix[string2.length][string1.length];\n};\n```",
"levenshteinDistance('30-seconds-of-code','30-seconds-of-python-code'); // 7\nconst compareStrings = (string1,string2) => (100 - levenshteinDistance(string1,string2) / Math.max(string1.length,string2.length));\ncompareStrings('30-seconds-of-code', '30-seconds-of-python-code'); // 99.72 (%)", "levenshteinDistance('30-seconds-of-code','30-seconds-of-python-code'); // 7\nconst compareStrings = (string1,string2) => (100 - levenshteinDistance(string1,string2) / Math.max(string1.length,string2.length));\ncompareStrings('30-seconds-of-code', '30-seconds-of-python-code'); // 99.72 (%)",
@ -322,7 +322,7 @@
}, },
"meta": { "meta": {
"archived": true, "archived": true,
"hash": "93e8862a89acd7be83ffbbb3f732759a84c9e9e7ebd5763251bcd265f8e7fbce" "hash": "923a1f48f03450680f6150058f7ae52edf8a08a0d00d57cf26aa803f707643c9"
} }
}, },
{ {

View File

@ -396,9 +396,7 @@ const isSimilar = (pattern, str) =>
? matchIndex + 1 ? matchIndex + 1
: matchIndex, : matchIndex,
0 0
) === pattern.length ) === pattern.length;
? true
: false;
``` ```
<details> <details>

File diff suppressed because it is too large Load Diff