Skip to content

Instantly share code, notes, and snippets.

@devinsays
devinsays / TagToMeta.php
Created January 27, 2021 20:47
Saves taxonomy terms to product meta in a comma separated list
<?php
namespace UniversalYums\TagToMeta;
class TagToMeta {
/**
* The single instance of the class.
*/
protected static $instance;
@thomasjsn
thomasjsn / ElasticRecreateIndex.php
Created February 13, 2017 09:26
Laravel console command for reindexing Elasticsearch.
<?php
namespace App\Console\Commands;
use Elasticsearch\ClientBuilder;
use Illuminate\Console\Command;
class ElasticRecreateIndex extends Command
{
/**
@ljharb
ljharb / array_iteration_thoughts.md
Last active April 29, 2024 17:13
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@adamwathan
adamwathan / troubleshooting.md
Last active January 19, 2021 04:14
Troubleshooting Valet on macOS Sierra

Troubleshooting Valet on Sierra

Common Problems

Problem: I just see "It works!"

Apache is running on port 80 and interfering with Valet.

  1. Stop Apache: sudo /usr/sbin/apachectl stop
  2. Restart Valet: valet restart
@gedex
gedex / woocommerce-shipment-tracking-rest-api-doc.md
Last active March 21, 2020 09:05
WooCommerce Shipment Tracking REST API introduced in 1.5.0

Shipment Tracking REST API

The shipment tracking REST API allows you to create, view, and delete individual shipment tracking. The endpoint is /wp-json/wc/v1/orders/shipment-trackings.

Shipment Tracking Properties

Attribute Type Description
tracking_id string Unique identifier for shipment tracking read-only
tracking_number string Tracking number required
@jcasabona
jcasabona / howibuit.md
Last active September 4, 2019 13:40
Guest Notes for How I Built It Podcast

Guest Notes for How I Built It Podcast

Tips for Good Recording

I'll be doing dual track recording, but if you could record audio on your side that would be great! That way if we see a dip in connection or get weird quality, I can do some track-layering action. To do that:

On a Mac

screenshot 2016-07-29 14 05 25

@thenbrent
thenbrent / _subscriptions.md
Last active November 22, 2021 05:31 — forked from mattallan/_subscriptions.md
WooCommerce Subscriptions REST API Endpoint Documentation (fork of https://gist.github.com/mattallan/fd52629eae293540c6d8)

Subscriptions

This section lists all API that can be used to create, edit or otherwise manipulate subscriptions.

Subscription Properties

Attribute Type Description
id integer Subscription ID (post ID) read-only
order_number integer Order number read-only
@dillinghamio
dillinghamio / Laravel Spark Per Team User Subscription.md
Last active April 22, 2022 14:57
Per Team User Subscription in Laravel Spark

Per Team User Subscription in Laravel Spark

If you want the ability to charge a team owner based on how many members their team has, like $10/user/month, then you utilize the Laravel Cashier functionality of incrementing the quantity.

You listen for when a new team member is added and you increase the quantity of the subscription by the amount of users and also listen for when a team member is removed to downsize charges. - Not Braintree Compatible


Within EventServiceProvider.php
'Laravel\Spark\Events\Teams\TeamMemberAdded' => [
@joehoyle
joehoyle / wp-api-batch.php
Last active March 7, 2024 02:13
Batch endpoint for the WP REST API
<?php
/**
* Plugin Name: WP REST API Batch Requests
* Description: Enabled a multi / batch requests endpoint for the WP RES API
* Author: Joe Hoyle
* Version: 1.0-alpha1
* Plugin URI: https://github.com/WP-API/WP-API
* License: GPL2+
*/
@jwalton512
jwalton512 / admin(v2).js
Last active May 15, 2018 19:41
Harmony with Laravel + Vue + Vue Router
// dashboard component
var dashboard = Vue.extend({
template: '<p>Hello from dashboard</p>'
})
// user management component
var user = Vue.extend({
template: '<p>Hello from user management page</p>'
})