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
// ... | |
window.addEventListener('load', () => { | |
if('serviceWorker' in navigator) { | |
navigator.serviceWorker.register( './sw.min.js', { scope: "./" } ) | |
.then( registration => { | |
const newWorker = registration.installing; | |
if (newWorker) { | |
newWorker.onstatechange = function() { | |
if (newWorker.state == 'activated' && !navigator.serviceWorker.controller) { |
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
/* | |
* | |
* Web Application Firewall built with Cloudflare workers | |
* | |
* Author: < https://twitter.com/dustyfresh > | |
* | |
* License: GPLv3 < https://www.gnu.org/licenses/gpl-3.0.en.html > | |
* | |
* Cloudflare worker documentation: | |
* < https://developers.cloudflare.com/workers/about/ > |
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 | |
/** | |
* Manually override shipping taxability in TaxJar for WooCommerce | |
* Tweak class-wc-taxjar-integration.php around line 332 | |
* https://github.com/taxjar/taxjar-woocommerce-plugin/blob/1.6.1/includes/class-wc-taxjar-integration.php#L332 | |
*/ | |
// Make shipping taxable | |
if ( 'AZ' == $to_state ) { | |
$taxes['freight_taxable'] = 1; |
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
#!/bin/bash | |
# | |
# https://support.1password.com/command-line-getting-started/ | |
# | |
# Full docs: https://support.1password.com/command-line/ | |
# | |
# gpg --receive-keys 3FEF9748469ADBE15DA7CA80AC2D62742012EA22 | |
# gpg --verify op.sig op | |
# |
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 | |
function handle_remote_cache_requests_for_local() { | |
global $_wp_using_ext_object_cache; | |
if ( | |
empty( $_wp_using_ext_object_cache ) | |
|| ! isset( $_REQUEST['check'], $_REQUEST['command'] ) | |
|| ! function_exists( 'wp_cache_' . $_REQUEST['command'] ) | |
|| str_replace( ABSPATH, '', __FILE__ ) !== $_REQUEST['check'] | |
) { |
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
exports.transaction = function transaction (req, res) { | |
// Imports the Google Cloud client library | |
const Datastore = require('@google-cloud/datastore'); | |
// Your Google Cloud Platform project ID | |
const projectId = 'moneypenny-dabc6'; | |
// Instantiates a client | |
const datastore = Datastore({ | |
projectId: projectId |
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
'use strict'; | |
const Datastore = require('@google-cloud/datastore'); | |
// Instantiates a client | |
const datastore = Datastore(); | |
/** | |
* Gets a Datastore key from the kind/key pair in the 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
<?php | |
/** | |
* Hubspot Integration for Ninja Forms. | |
* | |
* @package Nano | |
*/ | |
class NF_Hubspot { | |
// Hooks into ninja_forms_after_submission | |
public function init() { |
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
// https://developers.cloudflare.com/workers/about/ | |
// https://tutorial.cloudflareworkers.com | |
// | |
// A Service Worker which adds Security Headers. | |
// Checks: | |
// https://securityheaders.io/ | |
// https://observatory.mozilla.org/ | |
// https://csp-evaluator.withgoogle.com/ | |
// https://hstspreload.org/ | |
// https://www.ssllabs.com/ssltest/ |
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
-- This will show you the size of post, revision, attachment and other fields in `wp_posts` | |
-- this method can be applied to any WordPress table to get a breakdown of clutter and data use | |
-- this will not get you index size, but WP indexes are typically a small fraction of overall table size | |
SELECT post_type | |
COUNT(*) AS NUM, -- adds a column with the number of rows for each key value for comparison | |
SELECT post_type, COUNT(*) AS NUM, | |
(SUM(LENGTH(ID) -- add all column data together to group the total row data by post_type | |
+LENGTH(post_author) | |
+LENGTH(post_date) | |
+LENGTH(post_date_gmt) |