Skip to content

Instantly share code, notes, and snippets.

@EvanHerman
EvanHerman / config.yml
Last active Nov 3, 2020
WordPress Plugin CircleCI 2.0 Config - PHPCS, PHPUnit and rsync Deployment
View config.yml
workflows:
version: 2
main:
jobs:
- php56-build
- php70-build
- php71-build
- php72-build
- deploy:
requires:
@operatino
operatino / MySQL_5-7_macOS.md
Last active Jun 15, 2021 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL 5.7 on macOS using Homebrew
View MySQL_5-7_macOS.md

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@gaearon
gaearon / modern_js.md
Last active Jun 20, 2021
Modern JavaScript in React Documentation
View modern_js.md

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
View boxy_theme_settings.js
{
// Goes inside Preference.sublime-settings -- User
//
// First "theme" line defines which Boxy theme you've selected
// Rest of the lines are configuration of Boxy theme itself.
//
// Boxy theme full settings: https://github.com/ihodev/sublime-boxy/wiki/Settings#accent
"theme": "Boxy Tomorrow.sublime-theme",
"theme_accent_purple": true,
"theme_bar": true,
View edd-sendowl-webhook-handler.php
class EDD_Sendowl_Webhook_Handler extends EDD_Webhook_Handler {
function get_hook_id() {
return 'sendowl';
}
function get_hook_name() {
return 'SendOwl';
}
function get_webhook_params( $request ) {
View edd-webhook-handler.php
<?php
/*
Plugin Name: EDD Webhooks
Description: Captures new sale notifications from 3rd party service and adds to Easy Digital Downloads
Version: 1.0
Author: Brian Hogg
Author URI: https://brianhogg.com
Text Domain: edd-webhooks
License: GPL2
*/
@sirbrillig
sirbrillig / functions.php
Last active Apr 9, 2021 — forked from UmeshSingla/functions.php
Post file using wp_remote_post in WordPress
View functions.php
<?php
$local_file = 'file_path'; //path to a local file on your server
$post_fields = array(
'name' => 'value',
);
$boundary = wp_generate_password( 24 );
$headers = array(
'content-type' => 'multipart/form-data; boundary=' . $boundary,
);
@vishalck
vishalck / woocommerce-custom-thank-you-page-redirect.php
Last active Jun 7, 2021
Redirect to Custom Thank You page in WooCommerce
View woocommerce-custom-thank-you-page-redirect.php
<?php
add_action( 'template_redirect', 'woo_custom_redirect_after_purchase' );
function woo_custom_redirect_after_purchase() {
global $wp;
if ( is_checkout() && !empty( $wp->query_vars['order-received'] ) ) {
wp_redirect( 'http://localhost:8888/woocommerce/custom-thank-you/' );
exit;
}
}
@zuhairkareem
zuhairkareem / search_partial_string_array.php
Last active Mar 30, 2021
Search partial string in an array in PHP
View search_partial_string_array.php
<?php
/**
* First Method.
*/
function array_search_partial($arr, $keyword) {
foreach($arr as $index => $string) {
if (strpos($string, $keyword) !== FALSE)
return $index;
}
}
@rynaldos
rynaldos / wc-custom-purchased-column.php
Last active Jun 15, 2020
[WooCommerce 3.0+] Re-instate the "Purchased items" column on orders page
View wc-custom-purchased-column.php
add_filter('manage_edit-shop_order_columns', 'wc_custom_purchased_column');
function wc_custom_purchased_column($columns)
{
$new_array = array();
foreach ($columns as $key => $title) {
if ($key == 'billing_address') {
$new_array['order_items'] = __('Purchased', 'woocommerce');
}