Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
A Bit Git!

Morteza man4toman

:octocat:
A Bit Git!
View GitHub Profile
@thenbrent
thenbrent / create-test-scheduled-actions.php
Last active Dec 2, 2022
Snippet to create scheduled actions with Action Scheduler via $_GET params.
View create-test-scheduled-actions.php
<?php
/**
* Check for $_GET params on admin pages and use them to create corresponding actions.
*
* Example URL string to append to any admin page: &as_add_actions=single&hook=my_action&time=1563420973
*/
function as_test_schedule_async_action() {
if ( ! isset( $_GET['as_add_actions'] ) ) {
return;
}
@thenbrent
thenbrent / wc-queue-docs.md
Last active Dec 2, 2022
WooCommerce 3.5 introduced a new scalable, traceable job queue. This queue can be leveraged by extensions for processing large sets of jobs in the background. The default handler can also be replaced for custom requirements.
View wc-queue-docs.md

Job Queue API

WooCommerce 3.5 introduced a new scalable, traceable job queue. This queue can be used by extensions and custom code to process large sets of jobs in the background, and track the lifecycle of those jobs. The default handler can also be replaced.

This guide explains how to use the queue APIs for adding jobs, and how to replace the default queue handler.

Jobs are Actions

For flexibility and simplicity, each job is defined by an action hook.

@melvinstanly
melvinstanly / woo-checkout-order-review.php
Created Sep 12, 2018
Add custom field or html to review order table in WooCommerce Checkout
View woo-checkout-order-review.php
<?php
/* To add custom field in order review table in checkout page, you will have to use some of the hooks listed below.
do_action( 'woocommerce_review_order_before_cart_contents' );
do_action( 'woocommerce_review_order_after_cart_contents' );
do_action( 'woocommerce_review_order_before_shipping' );
do_action( 'woocommerce_review_order_after_shipping' );
do_action( 'woocommerce_review_order_before_order_total' );
do_action( 'woocommerce_review_order_after_order_total' );
@shgysk8zer0
shgysk8zer0 / README.md
Created Feb 10, 2017
Generate random images in PHP
View README.md

Generate random images in PHP

sample

Why?

  • Because you can
  • Because you have time to spare
  • Maybe you think they look cool or want to save them for wallpapers or something
  • Maybe it reminds you of that one time... You know which time I'm talking about

Requirements

@tbranyen
tbranyen / _usage.md
Last active Nov 16, 2022
OpenWeatherMap / Weather Icons integration
View _usage.md
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');