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 | |
// Get the PHP helper library from https://twilio.com/docs/libraries/php | |
require_once '/path/to/vendor/autoload.php'; // Loads the library | |
use Twilio\Rest\Client; | |
// Your Account Sid and Auth Token from twilio.com/user/account | |
$sid = "YOU_ACCOUNT_SID"; | |
$token = "YOUR_AUTH_TOKEN"; | |
$client = new Client($sid, $token); |
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("Services/Twilio.php"); | |
require("database.php"); | |
// require POST request | |
if ($_SERVER['REQUEST_METHOD'] != "POST") die; | |
// generate "random" 6-digit verification code | |
$code = rand(100000, 999999); |
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 | |
namespace Twilio; | |
use GuzzleHttp\Client as HttpClient; | |
use GuzzleHttp\Collection; | |
use GuzzleHttp\Command\Guzzle\GuzzleClient; | |
use GuzzleHttp\Command\Guzzle\Description; | |
use GuzzleHttp\Command\Model; | |
use GuzzleHttp\Subscriber\Retry\RetrySubscriber; |
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
function twilioSendSMS($params = [], $endpoint = 'Messages.json'){ | |
$sid = 'SID HERE'; | |
$token = 'TOKEN HERE'; | |
$request = wp_remote_get("https://api.twilio.com/2010-04-01/Accounts/{$sid}/{$endpoint}", [ | |
'headers' => [ | |
'Authorization' => 'Basic ' . base64_encode($sid . ':' . $token), | |
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8', | |
], | |
'body' => $params | |
]); |
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
// Configuration | |
const whitelistOrigins = [".*"]; // regexp for whitelisted origins | |
const blacklistUrls = []; // regexp for blacklisted urls | |
// Helper function to check if a URI or origin is whitelisted | |
function isListedInWhitelist(uri, listing) { | |
if (!uri) return true; // Allow null origins by default | |
return listing.some(pattern => new RegExp(pattern).test(uri)); | |
} |
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
/* | |
An event listener for the FetchEvent tells the script to listen for any request coming to your Worker. | |
The event handler is passed the event object, which includes event.request, a Request object | |
which is a representation of the HTTP request that triggered the FetchEvent. | |
*/ | |
addEventListener("fetch", event => { | |
// The call to .respondWith() lets the Workers runtime intercept the request in order to send back a custom response. | |
event.respondWith(handleRequest(event.request)) | |
}) |
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
addEventListener('fetch', (event) => { | |
event.respondWith( | |
handleRequest(event.request).catch( | |
(err) => new Response(err.stack, { status: 500 }) | |
) | |
); | |
}); | |
const ID_LEN = 6 | |
const SEC_PER_DAY = 60 * 60 * 24 |
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
addEventListener('fetch', event => { | |
event.respondWith(fetchAndApply(event.request)) | |
}); | |
/* WARNING: | |
Anything starting with REPLACEABLE_SECRET_VDB12_ shouldn't be renamed, | |
because they are used in deployment transformations. | |
Do not remove the comment below, | |
it is required to timestamp workers on upload. | |
Sent from npm. |
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 { PrismaClient } from "@prisma/client"; | |
import { PrismaPg as PrismaPgWorker } from "@prisma/adapter-pg-worker"; | |
import { Pool } from "@prisma/pg-worker"; | |
let _db: PrismaClient | null = null; | |
export async function getPrismaClient(env: Env): Promise<PrismaClient> { | |
if (_db) return _db; | |
if (import.meta.env.DEV) { | |
const { default: pg } = await import("pg"); |
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
// ==UserScript== | |
// @name Print element as PDF | |
// @namespace http://tampermonkey.net/ | |
// @version 2025-06-12 | |
// @description Adds a function to Window to print a html element as a PDF | |
// @author Noah Martinez | |
// @match *://*/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=acrobat.adobe.com | |
// @grant none | |
// ==/UserScript== |