Travis build: 468 [cron]

This commit is contained in:
30secondsofcode
2018-09-15 20:10:55 +00:00
parent e7570ff6a1
commit ddacc1c032
3 changed files with 1644 additions and 1641 deletions

View File

@ -143,14 +143,14 @@
"fileName": "httpDelete.md",
"text": "Makes a `DELETE` request to the passed URL.\n\nUse `XMLHttpRequest` web api to make a `delete` request to the given `url`.\nHandle the `onload` event, by running the provided `callback` function.\nHandle the `onerror` event, by running the provided `err` function.\nOmit the third argument, `err` to log the request to the console's error stream by default.",
"codeBlocks": [
"const httpDelete = (url, callback, err = console.error) => {\n const request = new XMLHttpRequest();\n request.open(\"DELETE\", url, true);\n request.onload = () => callback(request);\n request.onerror = () => err(request);\n request.send();\n};",
"const httpDelete = (url, callback, err = console.error) => {\n const request = new XMLHttpRequest();\n request.open('DELETE', url, true);\n request.onload = () => callback(request);\n request.onerror = () => err(request);\n request.send();\n};",
"httpDelete('https://website.com/users/123', request => {\n console.log(request.responseText);\n}); // 'Deletes a user from the database'"
],
"tags": []
},
"meta": {
"archived": true,
"hash": "552bc0487c1bf8e4ff89a0a439840b32b6688e47c8e9a551bf924f91e856aa5d"
"hash": "0b543697856c3c91e3e0a58d3928d743dbe8a369e7263fbc9806aedf487ff723"
}
},
{
@ -160,14 +160,14 @@
"fileName": "httpPut.md",
"text": "Makes a `PUT` request to the passed URL.\n\nUse `XMLHttpRequest` web api to make a `put` request to the given `url`.\nSet the value of an `HTTP` request header with `setRequestHeader` method.\nHandle the `onload` event, by running the provided `callback` function.\nHandle the `onerror` event, by running the provided `err` function.\nOmit the last argument, `err` to log the request to the console's error stream by default.",
"codeBlocks": [
"const httpPut = (url, data, callback, err = console.error) => {\n const request = new XMLHttpRequest();\n request.open(\"PUT\", url, true);\n request.setRequestHeader('Content-type','application/json; charset=utf-8');\n request.onload = () => callback(request);\n request.onerror = () => err(request);\n request.send(data);\n};",
"const httpPut = (url, data, callback, err = console.error) => {\n const request = new XMLHttpRequest();\n request.open(\"PUT\", url, true);\n request.setRequestHeader('Content-type','application/json; charset=utf-8');\n request.onload = () => callback(request);\n request.onerror = () => err(request);\n request.send(data);\n};",
"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'"
],
"tags": []
},
"meta": {
"archived": true,
"hash": "8ef860126cb08a63458f113653502ee2eb53d42e39128459cad1ebc92ed55639"
"hash": "59572ee267c7f0bc7c4e411ebde24834a2f5e8e928e2e50c16ac787034b1a53a"
}
},
{
@ -194,14 +194,14 @@
"fileName": "isSimilar.md",
"text": "Determines if the `pattern` matches with `str`.\n\nUse `String.toLowerCase()` to convert both strings to lowercase, then loop through `str` and determine if it contains all characters of `pattern` and in the correct order.\nAdapted from [here](https://github.com/forrestthewoods/lib_fts/blob/80f3f8c52db53428247e741b9efe2cde9667050c/code/fts_fuzzy_match.js#L18).",
"codeBlocks": [
"const isSimilar = (pattern, str) =>\n\t[...str].reduce(\n\t\t(matchIndex, char) => char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() ? matchIndex + 1 : matchIndex, 0\n\t) === pattern.length ? true : 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;",
"isSimilar('rt','Rohit'); // true\nisSimilar('tr','Rohit'); // false"
],
"tags": []
},
"meta": {
"archived": true,
"hash": "669cc6d3a6f96a65b6e4bf678bb0b95cde711baaabe206db66d69599f6e93a51"
"hash": "570b1b21e29f3793d7c1f001958ec68a7c27b913d65e37cf5f078b1e6a839437"
}
},
{
@ -228,14 +228,14 @@
"fileName": "levenshteinDistance.md",
"text": "Calculates the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) between two strings.\n\nCalculates the number of changes (substitutions, deletions or additions) required to convert `string1` to `string2`. \nCan also be used to compare two strings as shown in the second example.",
"codeBlocks": [
"``` 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).fill(0).map((x,i) => [i]);\n matrix[0] = Array(string1.length + 1).fill(0).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 }\n else{\n matrix[i][j] = Math.min(matrix[i-1][j-1]+1, matrix[i][j-1]+1, matrix[i-1][j]+1);\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 (%)"
],
"tags": []
},
"meta": {
"archived": true,
"hash": "170ef4eafeb5ac639c721f1a8e02d309e1ad62941c613ce60462fa72274f4c25"
"hash": "3cc34a842404de0aea2752a6b1398b8a0825cb1a359ff36ab5275f7d15eff107"
}
},
{
@ -313,14 +313,14 @@
"fileName": "removeVowels.md",
"text": "Returns all the vowels in a `str` replaced by `repl`.\n\nUse `String.replace()` with a regexp to replace all vowels in `str`.\nOmot `repl` to use a default value of `''`.",
"codeBlocks": [
"const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi,repl);",
"const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi, repl);",
"removeVowels(\"foobAr\"); // \"fbr\"\nremoveVowels(\"foobAr\",\"*\"); // \"f**b*r\""
],
"tags": []
},
"meta": {
"archived": true,
"hash": "00040c26975307a1be29e9a933ef09c2b3d92bc986d8798b56339dbefce4d6fa"
"hash": "5f3ccc861fd5a18aa561957aadb6494402c1b3bdc1ec38b768e524c600ac756b"
}
},
{