Skip to content

Instantly share code, notes, and snippets.

@CrandellWS
CrandellWS / Drive.php
Created June 25, 2022 20:43 — forked from bshaffer/Drive.php
Google Drive API (v3) - PHP
<?php
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');
if (isset($_POST['dbhost'])) {
preg_match( '/^((?!-)[a-z0-9-]{1,63}(?<!-)(\.){0,1})+([a-z]{0,9})(?<!\.)((;port=){1}[0-9]{2,6}){0,1}$/i', $_POST['dbhost'], $matches);
echo "<pre>".print_r($matches, true)."</pre>";
die();
$DB_HOST = $_POST['dbhost'];
$DB_DATABASE = $_POST['dbname'];
$DB_USERNAME = $_POST['dbuser'];
@CrandellWS
CrandellWS / Paintable.cs
Last active March 20, 2023 03:41 — forked from ditzel/Paintable.cs
Drawing Canvas
using System.Collections;
using System.IO;
using UnityEngine;
using UnityEngine.InputSystem;
public class SignatureCapture : MonoBehaviour
{
[SerializeField] private GameObject brushPrefab;
[SerializeField] private float brushSize = 0.1f;
[SerializeField] private RenderTexture renderTexture;
@CrandellWS
CrandellWS / html2canvas.js
Last active September 14, 2023 20:17
html2canvas cors & cache workaround
/*!
* html2canvas 1.0.0-alpha.12-rc2 <https://html2canvas.hertzen.com>
* Copyright (c) 2018 Niklas von Hertzen <https://hertzen.com>
* Released under MIT License
* Editted By William Crandell
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
@CrandellWS
CrandellWS / wp_head_hide_billing_fields_for_registered_users.php
Last active November 22, 2023 00:10 — forked from strangerstudios/wp_head_hide_billing_fields.php
Hide Paid Memberships Pro billing address fields and make them optional. Meant to be used with the Braintree gateway.
add_action('pmpro_checkout_before_submit_button', 'my_pmp_jquery');
function my_pmp_jquery() {
global $current_user;
get_currentuserinfo();
if ($current_user->user_login) {
//script will hide billing fields and prefill name and email from WP account
?>
<script>
jQuery( document ).ready(function($) {