This file contains 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 { Innertube, Platform } from "youtubei.js"; | |
import axios from 'axios'; | |
import { HttpsProxyAgent } from 'https-proxy-agent'; | |
const proxyAgent = new HttpsProxyAgent( | |
`http://${SMARTPROXY_USERNAME}:${SMARTPROXY_PASSWORD}@gate.smartproxy.com:10001` | |
); | |
const youtube = await Innertube.create({ | |
lang: "en", |
This file contains 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
/** | |
* HTML scraping code | |
* | |
* Steps to use: | |
* 2. Open the browser console, paste in the entire contents of this file and hit <Enter>. | |
* 3. Copy the console output and paste it into a text editor. Save it with a .csv extension. | |
*/ | |
(function() { | |
const removeCommas = (string) => string.replace(/,/g, ``); |
This file contains 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 generateIdFromString(input) { | |
return input | |
.toLowerCase() // Convert the string to lowercase | |
.replace(/[^a-z0-9\s-]/g, '') // Remove all non-alphanumeric characters except spaces and hyphens | |
.trim() // Remove leading and trailing spaces | |
.replace(/\s+/g, '-') // Replace spaces with hyphens | |
.replace(/-+/g, '-'); // Replace multiple hyphens with a single hyphen | |
} | |
// Example usage: |
This file contains 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 { formatDistance, parseISO } from 'date-fns'; | |
// Example string date | |
const dateString: string = "2023-05-23"; | |
// Parse the string date into a JavaScript Date object | |
const date: Date = parseISO(dateString); | |
// Get the current date | |
const currentDate: Date = new Date(); |
This file contains 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
<?php | |
/** | |
* Plugin Name: WPGraphQL Previous / Next Pagination | |
* Description: Enables Previous / Next Pagination via WPGraphQL | |
* Version: 0.1.0 | |
* Author: Kellen Mace | |
* Author URI: https://kellenmace.com/ | |
* License: GPLv2 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ |
This file contains 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
Autos & Vehicles | |
Comedy | |
Education | |
Entertainment | |
Film & Animation | |
Gaming | |
Howto & Style | |
Music | |
News & Politics | |
Nonprofits & Activism |
This file contains 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
<?php | |
/** | |
* Plugin Name: Pagination Fields | |
* Description: Adds next & prev post data to WPGraphQL schema | |
* Version: 0.1.0 | |
* Author: Kellen Mace | |
* Author URI: https://kellenmace.com/ | |
* License: GPLv2 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
This file contains 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 { supabase } from '$lib/supabaseClient'; | |
import type { AuthUser } from '@supabase/supabase-js'; | |
import { writable } from 'svelte/store'; | |
import type { Profile } from '../types/supabase'; | |
interface User extends Omit<AuthUser, 'email'>, Profile {}; | |
export const user = writable<User | undefined>(undefined); | |
supabase.auth.onAuthStateChange(async (event, session) => { |
This file contains 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 { useState, useMemo } from "react"; | |
import { getNextStaticProps } from '@faustjs/next'; | |
import { GetStaticPropsContext } from 'next'; | |
import { client } from '../../client'; | |
import debounce from "just-debounce-it"; | |
export default function Blog() { | |
const { usePosts, useQuery } = client; | |
const [selectedCategory, setSelectedCategory] = useState(undefined); | |
const [selectedAuthor, setSelectedAuthor] = useState(undefined); |
This file contains 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
<?php | |
namespace MyCoolApp; | |
use WPGraphQL\Model\User; | |
class UserFields { | |
public function register_hooks() { | |
add_action( 'graphql_register_types', [ $this, 'register_fields' ] ); | |
} |
NewerOlder