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
| { | |
| "tpb": "https://thpibay.xyz/search", | |
| "bitsearch": "https://bitsearch.to/search" | |
| } |
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
| /** | |
| Sometimes with a lot of dependencies it becomes tedious to track what changed. | |
| In such cases `useEffect` can be replaced with this during dev to monitor changes in state. | |
| **/ | |
| const useUsEffectWithChangeLogs = ( | |
| callback, | |
| dependency, | |
| id = "Changes for anonymous effect" | |
| ) => { | |
| const last = useRef(dependency); |
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
| /* | |
| * Run this in your console with the desired latitude and longitude values just before the page requests location / after the page loads.. | |
| * | |
| * getCurrentPosition takes a callback function which is normally called when the user gives persmission to access location. | |
| * Here we shim the function with our own implementation which resolves after sometime with the fake coordinate data. | |
| * | |
| * we're no-op'ing the watchPosition function because websites can use this to track changes in the location which can be used | |
| * to detect the last position. | |
| */ | |
| navigator.geolocation.getCurrentPosition = (fn) => { |
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
| // Draws a binary tree representation on the console / terminal | |
| #include <iostream> | |
| #define LOG(x) std::cout << x; | |
| class Tree | |
| { | |
| private: | |
| struct _Tree | |
| { |
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
| // Recursive flatten function (Doesn't flatten arrays) | |
| function flatten(obj, target){ | |
| for(const key in obj){ | |
| if(obj.hasOwnProperty(key)){ | |
| if(!Array.isArray(key) && typeof(obj[key]) === "object" && obj[key] !== null){ | |
| flatten(obj[key], target); | |
| }else{ | |
| target[key] = obj[key]; | |
| } | |
| } |