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
export function useConsoleOverride() { | |
const originalLog = useRef(console.log); | |
const [output, setOutput] = useState(""); | |
const override = () => { | |
originalLog.current = console.log; | |
console.log = (...args) => { | |
originalLog.current.apply(console, args); | |
const formattedArgs = args.map(arg => |
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 { shopifyApi, LATEST_API_VERSION, Session } from '@shopify/shopify-api'; | |
const shopifyConfig = { | |
apiKey: process.env.SHOPIFY_API_KEY, | |
apiSecretKey: process.env.SHOPIFY_API_SECRET, | |
scopes: ['read_products', 'write_products'], | |
hostName: '127.0.0.1:3000', | |
apiVersion: LATEST_API_VERSION, | |
isPrivateApp: true, | |
isEmbeddedApp: false, |
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
const API_URL = process.env.WORDPRESS_API_URL; | |
async function fetchAPI(query = "", { variables }: Record<string, any> = {}) { | |
if (!API_URL) { | |
console.error('WORDPRESS_API_URL is not defined'); | |
throw new Error('WORDPRESS_API_URL is not defined'); | |
} | |
const headers = { "Content-Type": "application/json" }; |
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
<?php | |
require_once(ABSPATH . 'wp-admin/includes/file.php'); | |
require_once(ABSPATH . 'wp-admin/includes/media.php'); | |
require_once(ABSPATH . 'wp-admin/includes/image.php'); | |
/** | |
* Assigns an attachment URL to a post, setting it as the featured image. | |
* | |
* @param int $post_id The ID of the post. |
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 { File } from 'formidable'; | |
import fs from 'fs'; | |
import path from 'path'; | |
const BUNNY_API_URL = process.env.BUNNY_API_URL || ''; | |
const BUNNY_API_KEY = process.env.BUNNY_API_KEY || ''; | |
const BUNNY_STORAGE_ZONE_NAME = process.env.BUNNY_STORAGE_ZONE_NAME || ''; | |
const BUNNY_PULL_ZONE = process.env.BUNNY_PULL_ZONE || ''; | |
export const uploadToBunny = async (file: File): Promise<string> => { |
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 puppeteer from 'puppeteer-core'; | |
import chrome from '@sparticuz/chromium'; | |
const production = process.env.NODE_ENV === 'production'; | |
export default async function handler(req, res) { | |
try { | |
const browser = await puppeteer.launch( | |
production ? { | |
args: chrome.args, |