Skip to content

Instantly share code, notes, and snippets.

View ajitbohra's full-sized avatar
🎯
Scaling Operations @lubusIN

Ajit Bohra ajitbohra

🎯
Scaling Operations @lubusIN
View GitHub Profile
<?php
/*
* TinyMCE: Add Tailwind CSS style
*/
add_editor_style('/assets/css/tailwind.min.css');
/*
* TinyMCE: Remove WP styles
*/
@yanknudtskov
yanknudtskov / functions.php
Created May 23, 2020 23:44
Extend the output of the WooCommerce REST API for order line items
<?php
/**
* Example: Add order meta to the REST API
* WC 2.6+
*
* @param \WP_REST_Response $response The response object.
* @param \WP_Post $post Post object.
* @param \WP_REST_Request $request Request object.
* @return object updated response object
@llagerlof
llagerlof / print_r_reverse.php
Last active May 28, 2024 03:19
Convert the output string of print_r to array again.
<?php
// original author: https://www.php.net/manual/en/function.print-r.php#93529
// another dev said it was fixed for null values, but I don't encountered errors with null values for Matt's: https://www.php.net/manual/en/function.print-r.php#121259
// Matt
function print_r_reverse($in) {
$lines = explode("\n", trim($in));
if (trim($lines[0]) != 'Array') {
// bottomed out to something that isn't an array
return $in;
.animated-placeholder {
background: linear-gradient(-90deg, #eef2f6, #ffffff, #bcbfc3);
background-size: 400% 400%;
-webkit-animation: left-to-right 3s ease infinite;
-moz-animation: left-to-right 3s ease infinite;
animation: left-to-right 3s ease infinite;
}
@-webkit-keyframes left-to-right {
@ericmann
ericmann / Fortress.Options.php
Last active September 20, 2023 04:13
Encrypted Options
<?php
/**
* Encryption operations for working with WordPress options to store data
* in the options table. Not all options will be encrypted. You will need
* to wire up selection of options to be protected separately.
*
* @package Fortress
*/
namespace DisplaceTech\Fortress\Options;
@raftaar1191
raftaar1191 / custom-woocommerce-weebhook.php
Last active December 12, 2019 08:08
Custom WooCommerce Webhook
<?php
/**
* Plugin Name: Custom WooCommerce Webhook
* Plugin URI: https://raftaar1191.com/
* Description: This plugin provided a demo of Custom WooCommerce Webhook
* Author: raftaar1191
* Author URI: https://profiles.wordpress.org/raftaar1191/
* Version: 1.0.0
*/
<?php
/**
* This file houses the class that Extends the Yoast Schema Graph for course events
*
* @package ef/inc
*/
if ( interface_exists( 'WPSEO_Graph_Piece' ) ) {
/**
* The class that extends WPSEO_Graph_Piece to display event schema for courses.

Install Zsh and Oh-my-zsh on CentOS 7

Based on this article

ALL INSTALLATIONS ASSUME YES WHEN PROMPTED, that's what -y does

This script can be copy paste to ssh as is. No hands installation. :-)

yum install zsh -y
@WebReflection
WebReflection / custom-elements-pattern.md
Last active May 17, 2024 23:30
Handy Custom Elements' Patterns

Handy Custom Elements' Patterns

Ricardo Gomez Angel Photo by Ricardo Gomez Angel on Unsplash

This gist is a collection of common patterns I've personally used here and there with Custom Elements.

These patterns are all basic suggestions that could be improved, enriched, readapted, accordingly with your needs.

@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active January 31, 2023 13:12
[Wordpress Default link image media] in Gutenberg set default in image link media #wp #wordpress #gutenberg
function setDefaultHrefImage() {
wp_enqueue_script(
'modify-image-link-destination-default',
get_template_directory_uri() . '/js/setDefaultHrefImage.js',
array('wp-hooks')
);
}
add_action('enqueue_block_editor_assets', 'setDefaultHrefImage');