https://golance-dev.notion.site/API-Guide-aae3c3be3fae4d46ab44ba7b3ccd4fa5
- ¯\_(ツ)_/¯
- @alldayalone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useMutation, queryCache } from 'react-query'; | |
| import { useLocation, useHistory } from 'react-router-dom'; | |
| import { UserStatus, api, showSuccessMessage } from 'package'; | |
| const SuccessMessageByStatus = { | |
| [UserStatus.BLOCKED]: 'User blocked', | |
| [UserStatus.PROMOTED]: 'User promoted', | |
| [UserStatus.ACTIVE]: 'User activated', | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useMutation, queryCache } from 'react-query'; | |
| import { useLocation, useHistory } from 'react-router-dom'; | |
| import { UserStatus, api, showSuccessMessage } from 'package'; | |
| const SuccessMessageByStatus = { | |
| [UserStatus.BLOCKED]: 'User blocked', | |
| [UserStatus.PROMOTED]: 'User promoted', | |
| [UserStatus.ACTIVE]: 'User activated', | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Two-way referencing in MongoDB with ChangeStream | |
| 2. Building SaaS with custom subdomains with Kubernetes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function binarySearch(arr, x, index = 0) { | |
| if (arr.length == 0) { | |
| return -1; | |
| } | |
| let halfN = half(arr.length); | |
| if (arr[halfN] == x) { | |
| return index + halfN; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fuzzySearchFirstTry(array, input) { | |
| var halved = [].concat(array); | |
| var output = [].concat(array); | |
| for (var letter of input) { | |
| if (letter === ' ') { | |
| continue; | |
| } | |
| halved = halved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function typeOf(input) { | |
| return Object | |
| .prototype | |
| .toString | |
| .call(input) | |
| .replace(/\[object (\w+)\]/, '$1') | |
| .toLowerCase(); | |
| } | |
| // boolean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function difference(a, b) { | |
| var result = []; | |
| for (var i = 0; i < a.length; i++) { | |
| if (b.indexOf(a[i]) === -1) { | |
| result.push(a[i]); | |
| } | |
| } | |
| return result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function merge(a, b) { | |
| var result = []; | |
| var i = 0; | |
| var j = 0; | |
| while(i + j < a.length + b.length) { | |
| if (j >= b.length || a[i] <= b[j]) { | |
| result.push(a[i]); | |
| i++; | |
| } else { |