Skip to content

Instantly share code, notes, and snippets.

View ilyahuman's full-sized avatar
:electron:
Tinkering about...

Ilya Human ilyahuman

:electron:
Tinkering about...
View GitHub Profile
@ilyahuman
ilyahuman / gist:c44a939af8afcd700bea1ce684563218
Last active April 27, 2025 21:10
Instagram check own followers/unfollowers
// --- Constants ---
const INSTAGRAM_URL = "https://www.instagram.com";
const IG_APP_ID = "936619743392459";
const fetchOptions = {
credentials: "include",
headers: { "X-IG-App-ID": IG_APP_ID },
method: "GET",
};
// Function will wait until needed time but will block your eventloop
function sleep(time = 0) {
const wakeUpTime = Date.now() + time
while (Date.now() < wakeUpTime) {}
}
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
interface Timer {
name: string;
delay: number;
interval: boolean;
cb: Function;
}
interface TimerForCalling {
name: string;
interval: boolean;
let timerId = setTimeout(function tick() {
timerId = setTimeout(tick, 2000) // here you can pass any timeout and dynamically change next calls
}, 1000);
// Example
let call = 1;
let timerId = setTimeout(function tick() {
timerId = setTimeout(tick, 2000 * call);
call++;
const makeDeepClone = (obj) => {
let newObject = {};
Object.keys(obj).map(key => {
if(typeof obj[key] === 'object'){
newObject[key] = makeDeepClone(obj[key]);
} else {
newObject[key] = obj[key];
}
});