Skip to content

Instantly share code, notes, and snippets.

View JeffBeltran's full-sized avatar
🍺
it's go time

Jeff Beltran JeffBeltran

🍺
it's go time
View GitHub Profile
@JeffBeltran
JeffBeltran / phpfunction.php
Created September 13, 2023 16:24
API request
public function handle(UserRegistration $userRegistration)
{
Http::withBasicAuth(
config('customer_io.site_id'),
config('customer_io.api_key')
)->post(
"https://track.customer.io/api/v2/entity",
[
'type' => 'person',
'identifiers' => [
@JeffBeltran
JeffBeltran / usePollingLoader.ts
Last active August 26, 2022 19:28
remix polling hook
import { useFetcher, useLoaderData, useLocation } from "@remix-run/react";
import type { UseDataFunctionReturn } from "@remix-run/react/dist/components";
import { isEqual } from "lodash";
import { useEffect, useState } from "react";
import useInterval from "./useInterval"; // https://usehooks-ts.com/react-hook/use-interval
type usePollingLoaderOptions<Type> = {
onShouldPoll?: (arg: Type | UseDataFunctionReturn<Type>) => Boolean;
pollingInterval?: number;
};