Travis build: 468 [cron]
This commit is contained in:
@ -143,14 +143,14 @@
|
|||||||
"fileName": "httpDelete.md",
|
"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.",
|
"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": [
|
"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'"
|
"httpDelete('https://website.com/users/123', request => {\n console.log(request.responseText);\n}); // 'Deletes a user from the database'"
|
||||||
],
|
],
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": true,
|
"archived": true,
|
||||||
"hash": "552bc0487c1bf8e4ff89a0a439840b32b6688e47c8e9a551bf924f91e856aa5d"
|
"hash": "0b543697856c3c91e3e0a58d3928d743dbe8a369e7263fbc9806aedf487ff723"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -167,7 +167,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": true,
|
"archived": true,
|
||||||
"hash": "8ef860126cb08a63458f113653502ee2eb53d42e39128459cad1ebc92ed55639"
|
"hash": "59572ee267c7f0bc7c4e411ebde24834a2f5e8e928e2e50c16ac787034b1a53a"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -194,14 +194,14 @@
|
|||||||
"fileName": "isSimilar.md",
|
"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).",
|
"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": [
|
"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"
|
"isSimilar('rt','Rohit'); // true\nisSimilar('tr','Rohit'); // false"
|
||||||
],
|
],
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": true,
|
"archived": true,
|
||||||
"hash": "669cc6d3a6f96a65b6e4bf678bb0b95cde711baaabe206db66d69599f6e93a51"
|
"hash": "570b1b21e29f3793d7c1f001958ec68a7c27b913d65e37cf5f078b1e6a839437"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -228,14 +228,14 @@
|
|||||||
"fileName": "levenshteinDistance.md",
|
"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.",
|
"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": [
|
"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 (%)"
|
"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": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": true,
|
"archived": true,
|
||||||
"hash": "170ef4eafeb5ac639c721f1a8e02d309e1ad62941c613ce60462fa72274f4c25"
|
"hash": "3cc34a842404de0aea2752a6b1398b8a0825cb1a359ff36ab5275f7d15eff107"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -320,7 +320,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": true,
|
"archived": true,
|
||||||
"hash": "00040c26975307a1be29e9a933ef09c2b3d92bc986d8798b56339dbefce4d6fa"
|
"hash": "5f3ccc861fd5a18aa561957aadb6494402c1b3bdc1ec38b768e524c600ac756b"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const httpPut = (url, data, callback, err = console.error) => {
|
const httpPut = (url, data, callback, err = console.error) => {
|
||||||
const request = new XMLHttpRequest();
|
const request = new XMLHttpRequest();
|
||||||
request.open('PUT', url, true);
|
request.open("PUT", url, true);
|
||||||
request.setRequestHeader('Content-type','application/json; charset=utf-8');
|
request.setRequestHeader('Content-type','application/json; charset=utf-8');
|
||||||
request.onload = () => callback(request);
|
request.onload = () => callback(request);
|
||||||
request.onerror = () => err(request);
|
request.onerror = () => err(request);
|
||||||
|
|||||||
3261
test/testlog
3261
test/testlog
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user