Skip to content

Instantly share code, notes, and snippets.

View manssorr's full-sized avatar
🏠
Working from home

Mansour Ashraf manssorr

🏠
Working from home
View GitHub Profile
@hirbod
hirbod / clear-stale-persisted-data.ts
Last active May 12, 2025 01:43
React Query Persister: clear stale data on boot (requires react-native-mmkvm runs on iOS, Android and Web)
export const useClearStalePersistedReactQueryData = () => {
useEffect(() => {
const threeDaysAgo = Date.now() - 3 * 24 * 60 * 60 * 1000 // Timestamp of 3 days ago
storage.getAllKeys().forEach((entry) => {
// we only want to clear the data for react-query with the prefix 'my-random-prefix'
if (!entry.startsWith('my-random-prefix')) {
return
}
import * as React from 'react';
import {View, Dimensions, StyleSheet, Platform} from 'react-native';
import Animated, {
Extrapolate,
interpolate,
useAnimatedStyle,
useSharedValue,
} from 'react-native-reanimated';
import Carousel from 'react-native-reanimated-carousel';
@edgardo001
edgardo001 / youtube-dl.md
Created June 21, 2019 20:47
Using youtube-dl to download courses from Pluralsight

Download courses from learning sites with youtube-dl

You can download whole courses from an array of tutorial sites with the CLI tool youtube-dl. In the example further down I'm using my Pluralsight account to get videos from a course at their site. Here is a list of all supported sites that you can download from with this tool

The flags you have to supply may vary depending on which site you make a request to.

You can get a free 3 month trial to Pluralsight by signing up for free to Visual Studio Dev Essentials

Installation

@davidcairuz
davidcairuz / youtube_playlist_time.py
Last active November 13, 2023 15:22
Script that scrolls through all of a YouTube playlist and calculates it's total duration. I'm still learning Python so all of your suggestions will be very appreciated.
from bs4 import BeautifulSoup as soup #used to beautifie the html code
import datetime as dt #sum the video's duration time
from selenium import webdriver #open webdriver for specific browser
from selenium.webdriver.common.keys import Keys #for necessary browser action
import time #used for sleep function
#line 63 must be modified for different languages
#line 35 must be modified for different url
times = []
1) nu-disco in the last day
https://soundcloud.com/search/sounds?q=nu%20disco&filter.created_at=last_day
2) auto-like everything
var list= document.getElementsByClassName("sc-button-like");
for (var i = 0; i < list.length; i++) {
if(!list[i].classList.contains('sc-button-selected')){
list[i].click();
}