Skip to content

Instantly share code, notes, and snippets.

@josh-hernd
josh-hernd / functions.php
Created May 22, 2023 18:42
Zonos delayed POST request
<?php
function zonos_get_product_from_id() {
if (isset($_POST['prodid'])) {
$product_id = (int) $_POST['prodid'];
$product = wc_get_product($product_id);
if ($product) {
// Delay between requests (in seconds)
$delay = 10;
sleep($delay);
@josh-hernd
josh-hernd / index.svelte
Created March 9, 2022 20:26
Cors Blocked
<script context="module">
export const load = async ({ fetch }) => {
let ref = `${import.meta.env.VITE_PLACE_ID}`; // Place ID
let key = `${import.meta.env.VITE_MAPS_KEY}`; // Google Maps API key
const reviews = await fetch(
`https://maps.googleapis.com/maps/api/place/details/json?reference=${ref}&key=${key}`
);
if (reviews.status === 404) {
const error = new Error(`Oops! not found`);
@josh-hernd
josh-hernd / fix_exfat_drive.md
Created December 21, 2021 17:33 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?