This file contains 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
/* Add to functions.php file. Refresh wordpress admin, then remove this code */ | |
// OR run /wp-admin/?clear_lead_custom_field_cache=1 and it will flush the cache | |
add_action('init', 'manual_flush_inbound_form_map_transient') | |
if (!function_exists('manual_flush_inbound_form_map_transient')) { | |
// Refresh transient | |
function manual_flush_inbound_form_map_transient(){ | |
delete_transient('wp-lead-fields'); | |
} | |
} |
This file contains 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
//dequeue css from plugins | |
add_action('wp_print_styles', 'inbound_dequeue_css', 100); | |
function inbound_dequeue_css() { | |
wp_dequeue_style( 'inbound-shortcodes' ); | |
} |
This file contains 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 create_onetime_nonce( $action = -1 ) { | |
$time = time(); | |
$nonce = wp_create_nonce( $time . $action ); | |
set_transient( '_nonce_' . $time, 1, 60*60 ); // adjust the lifetime of the transient | |
return $nonce . '-' . $time; | |
} | |
function verify_onetime_nonce( $_nonce, $action = -1 ) { | |
@list( $nonce, $time ) = explode( '-', $_nonce ); |
This file contains 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
/** Add jquery script for responsive slider | |
This is for use with a child theme! | |
If not use: get_template_directory_uri() instead | |
*/ | |
function fws_add_the_scripts() { | |
wp_enqueue_script( | |
'custom_script', | |
get_stylesheet_directory_uri() . '/js/responsiveslides.min.js', | |
array('jquery') | |
); |
This file contains 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 | |
/** | |
* Using transients on a single loop inside WordPress | |
* | |
* @link http://speckyboy.com/2011/12/14/website-speed-part-3-caching-wordpress/ | |
* / | |
$loop = get_transient( 'loop' ); | |
if ( false === $loop ) { | |
// Show the last 100 tweets from the custom post type tweets. |
This file contains 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
// eslint-disable-next-line import/no-extraneous-dependencies | |
const { argv } = require('yargs'); | |
let { stage = 'dev' } = argv; | |
module.exports.getDomainName = () => new Promise((resolve, reject) => { | |
stage = `${stage}`.toLowerCase(); | |
if (!stage || stage == null || stage === 'dev') { | |
return resolve('dev-api.yourdomain.com'); |
This file contains 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
functions: | |
TriggerFunc: | |
handler: handlers.main | |
resources: | |
Resources: | |
# Bucket 'TriggeredBucket' | |
TriggeredBucket: | |
Type: AWS::S3::Bucket |
This file contains 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 () { | |
var results, currentWindow, | |
// create an iframe and append to body to load a clean window object | |
iframe = document.createElement('iframe'); | |
iframe.style.display = 'none'; | |
document.body.appendChild(iframe); | |
// get the current list of properties on window | |
currentWindow = Object.getOwnPropertyNames(window); |
This file contains 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
const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
const asyncForEach = (array, callback) => { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array) | |
} | |
} | |
const start = async () => { | |
await asyncForEach([1, 2, 3], async (num) => { | |
await waitFor(50) |
This file contains 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
const refreshToken = async () => { | |
const refreshPromise = new Promise(async (resolve) => { | |
const user = await Auth.currentAuthenticatedUser(); | |
const session = await Auth.currentSession(); | |
user.refreshSession(session.refreshToken, async (res, newSession) => { | |
if (newSession) { | |
await Auth.currentUserCredentials(); | |
} | |
resolve('ok'); |
OlderNewer