Skip to content

Instantly share code, notes, and snippets.

@onwp
onwp / list-of-curl-flags.txt
Last active December 30, 2022 13:17 — forked from eneko/list-of-curl-options.txt
List of curl flags
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
<?php
add_filter('acf/pre_load_reference', 'hwk_bypass_get_field_ref', 10, 3);
function hwk_bypass_get_field_ref($return, $field_name, $post_id){
if(is_int($post_id))
$return = acf_get_field($field_name, $post_id);
return $return;
}
Regarding why the write operation was of poor throughput it would depend on the amount of data that would be inserted by the operation along with any deadlocks or wait events waiting for a lock it may need to take hold off as well. To that end if possible you could run those write operations to check for any deadlocks(by checking the output of the show engine innodb status) they may be causing , further you can also run profile on them to see what stage of the execution is slowing down the whole query. The explain plan will also provide us with insights on the query execution plan allowing you to make changes to improve efficiency.
https://dev.mysql.com/doc/refman/5.7/en/show-profile.html
https://dev.mysql.com/doc/refman/5.7/en/show-engine.html
https://dev.mysql.com/doc/refman/5.7/en/explain.html
>>Do we have to look at using managed Aurora cluster with read replicas, connection pooling for better throughput?
It is indeed an alternative that you can consider, your workload contains both read and writ
@onwp
onwp / Exclude groups
Created November 17, 2021 16:36 — forked from lukecav/Exclude groups
Groups to exclude in Redis object caching for LearnDash
comment
counts
plugins
learndash_reports
learndash_admin_profile
wc_session_id
@onwp
onwp / github-commit-emoji-message.md
Created November 3, 2021 23:40
Github commit emoji message
Commit type Emoji
Initial commit 🎉 :tada:
Readme 👀 :eyes:
Add or update a .gitignore file 🙈 :see_no_evil:
Add or update snapshots 📸 :camera_flash:
Folder .github :octocat: :octocat:
Version tag 🔖 :bookmark:
New feature :sparkles:
Introduce breaking changes 💥 :boom:
@onwp
onwp / ld-auto-mark-complete.php
Created September 9, 2021 21:47 — forked from weismannweb/ld-auto-mark-complete.php
Auto complete learndash topics and lessons
//thanks to https://gist.github.com/sultann/24baa5483b4632c3cf214a8de5648204#file-ld-auto-mark-complete-php-L17 for most of
//this code, i just corrected it to work with ld_lesson_tag to grab the tags as the original version returned empty
//array since it was looking for standard wp tags
function ld_is_tagged($postId) {
//get all learndash tags on post
$tags = wp_get_post_terms($postId,'ld_lesson_tag');
foreach ($tags as $tag) {
//need to check for auto-mark-complete tag exists on this post
@onwp
onwp / snippet.php
Created September 9, 2021 21:46 — forked from lelandf/snippet.php
Add custom field support to LearnDash post types
// https://developer.wordpress.org/reference/functions/add_post_type_support/
add_action( 'init', 'lelandf_custom_fields_support_learndash' );
function lelandf_custom_fields_support_learndash() {
$post_types = [
'sfwd-courses',
'sfwd-lessons',
'sfwd-topic',
];
@onwp
onwp / ld-gb-user-grade.php
Created August 27, 2021 00:17 — forked from joelworsham/ld-gb-user-grade.php
LearnDash Gradebook User Grade @ 1.3.6
<?php
/**
* Contains the grade for a given user.
*
* @since 1.0.0
*
* @package LearnDash_Gradebook
* @subpackage LearnDash_Gradebook/includes
*/
@onwp
onwp / simple.ses.php
Created August 6, 2021 14:49 — forked from xeoncross/simple.ses.php
Simple SendEmail wrapper for Amazon SES API (does not support SendRawEmail)
<?php
class SES
{
public $accessKey = NULL;
public $accessKeyID = NULL;
public $host = 'https://email.us-east-1.amazonaws.com/';
public $userAgent = 'Test SES Class / v1.0';
public $data = array();