Skip to content

Instantly share code, notes, and snippets.

View k33n's full-sized avatar
🎯
Focusing

Michael Keene k33n

🎯
Focusing
View GitHub Profile
@strarsis
strarsis / guide.md
Last active February 19, 2023 00:29
Object caching with Bedrock (and Trellis) using Redis

Object caching with Bedrock (and Trellis) using Redis

What is object caching

While nginx microcaching already solves page caching (as of static, rarely changing WordPress pages), the performance for dynamically generated pages (like WooCommerce shop pages and admin backend in general) can benefit greatly from additionally using an object cache. Object caching allows an application (in this case WordPress with its plugins, theme, etc.) to store prepared objects (mostly database queries) in a database and quickly retrieve them, therefore improving the performance of dynamic page generation. Object caching is (usually) transparent, which means that it shouldn't be noticeable by users and developers (except for the performance improvements of course).

Implementations

/** @wordpress */
import {__} from '@wordpress/i18n'
import {RichText} from '@wordpress/block-editor'
/** Modules */
import PropTypes from 'prop-types'
/** Components */
import Buttons from '@blocks/ndn-page-header/components/Buttons'
@jetsloth
jetsloth / gform_pre_render_custom_image_choices_options.php
Last active August 1, 2020 21:45
Example of dynamic population for image choices options
<?php
add_filter( 'gform_pre_render', 'custom_image_choices_options' );
add_filter( 'gform_pre_validation', 'custom_image_choices_options' );
add_filter( 'gform_pre_submission_filter', 'custom_image_choices_options' );
add_filter( 'gform_admin_pre_render', 'custom_image_choices_options' );
function custom_image_choices_options( $form ) {
if ( $form['id'] != 9999 ) {// set to the form id you want to run this on
@malarkey
malarkey / custom-properties-boilerplate.css
Created March 14, 2019 20:02
CSS Custom Properties boilerplate
/* CSS Custom Properties */
:root {
--font-family: 'Georgia', serif;
--font-family-alt: 'Helvetica', Arial, sans-serif;
--font-weight: 400;
--font-weight-bold: 700;
--font-weight-black: 900;
/* 3:4 perfect fourth scale */
@nicooprat
nicooprat / custom-callback.php
Created October 22, 2018 17:22
Create an ACF block with Sage 9 & Blade
function my_acf_block_render_callback( $block ) {
$slug = str_replace('acf/', '', $block['name']);
$block['slug'] = $slug;
$block['classes'] = implode(' ', [$block['slug'], $block['className'], $block['align']]);
echo \App\template("blocks/${slug}", ['block' => $block]);
}
@nicooprat
nicooprat / testimonial.blade.php
Last active April 2, 2020 02:39
Custom Gutenberg bloc with Roots Sage & Blade
{{--
Title: Témoignage
Description: test
Category: formatting
Icon: admin-comments
Keywords: testimonial quote
--}}
<blockquote data-{{$block['id']}} class="{{$block['classes']}}">
<p>{{the_field('testimonial')}}</p>
@seven1m
seven1m / open_source_church_software.md
Last active April 24, 2024 08:38
List of Open Source Church Software
<script type="text/javascript">
jQuery(document).bind('gform_post_render', function(e, formId, currentFormPage) {
var $form = jQuery('#gform_' + formId);
if ($form.data('configurator-init') === true) {
return;
}
$form.on('click', '.config-layer.image-choices-field .ginput_container_radio input', function (e) {
@bdmason
bdmason / using-sage-9-blade-templates-for-woocommerce.md
Last active October 26, 2022 10:48
Using Sage 9 blade templates for WooCommerce

Using Sage 9 blade templates for WooCommerce

Declare WooCommerce theme support

Open app/setup.php, find the after_setup_theme action and put add_theme_support('woocommerce'); inside the function.

Override the plugin templates

Add the templates you want to override in resources/woocommerce:

theme    
│
@mattez
mattez / bootstrap-4-sass-mixins-cheat-sheet.scss
Last active November 29, 2019 06:15
Bootstrap 4 Sass Mixins [Cheat sheet with examples] #BS4
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// @author http://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/v4-dev/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;