Skip to content

Instantly share code, notes, and snippets.

View coderkevin's full-sized avatar

Kevin Killingsworth coderkevin

View GitHub Profile
@coderkevin
coderkevin / output.txt
Created January 30, 2018 15:18
npm run build-docker
docker build --build-arg commit_sha=2ab204a4c9bd056faece7d4563cb7d78adc77a36 -t wp-calypso .
Sending build context to Docker daemon 41.74MB
Step 1/16 : FROM node:8.9.3
---> 2eeae8debf3d
Step 2/16 : LABEL maintainer "Automattic"
---> Using cache
---> 1161577eed41
Step 3/16 : WORKDIR /calypso
---> Using cache
---> fe93c697529e
@coderkevin
coderkevin / class-product-inventory-data-store.php
Created December 20, 2017 21:12
WooCommerce Data Store Demo - Product Inventory - Read
public function read( &$product ) {
$this->parent_instance->read( $product );
$inventory_url = 'http://localhost:8080/api/inventory/' . $product->get_sku();
$request = wp_remote_get( $inventory_url );
$response = wp_remote_retrieve_body( $request );
$data = json_decode( $response );
$product->set_stock_quantity( $data );
}
@coderkevin
coderkevin / class-product-inventory-data-store.php
Created December 20, 2017 21:10
WooCommerce Data Store Demo - Product Inventory - Update
public function update( &$product ) {
$this->parent_instance->update( $product );
}
@coderkevin
coderkevin / class-product-inventory-data-store.php
Last active December 20, 2017 21:09
WooCommerce Data Store Demo - Product Inventory - Constructor
class WC_Product_Inventory_Data_Store
implements WC_Object_Data_Store_Interface, WC_Product_Data_Store_Interface {
public function __construct( &$parent_data_store ) {
$this->parent_instance = $this->create_parent_instance( $parent_data_store );
}
@coderkevin
coderkevin / class-woocommerce-product-inventory-datastore-plugin.php
Last active December 20, 2017 21:07
WooCommerce Data Store Demo - Product Inventory - Plugin hook
class WC_Product_Inventory_Data_Store_Plugin {
public function __construct() {
add_filter( 'woocommerce_data_stores', array( $this, 'install_data_store' ) );
}
public function install_data_store( $stores ) {
include_once dirname( __FILE__ ) . '/class-product-inventory-data-store.php';
$instance = new WC_Product_Inventory_Data_Store( $stores[ 'product' ] );

Keybase proof

I hereby claim:

  • I am coderkevin on github.
  • I am coderkevin (https://keybase.io/coderkevin) on keybase.
  • I have a public key whose fingerprint is DCD0 CB4F 5EF6 EA0E 0385 AA7D A74D CDB4 3AFB 05CA

To claim this, I am signing this object:

@coderkevin
coderkevin / action-sample.js
Created December 28, 2015 18:14
Example of creating your own redux-effects middleware (and action usage, with notes about improvements)
// TODO: Find another way to do the extra actions.
// The extra actions on this return complicate things, mostly because
// it moves the chain of logic away from the state, and toward chaining
// actions instead. What if it's possible to get in the same state another
// way? Then we have to add that state to the other actions too.
// Also, this way, extra parameters have to added to this function
// just to pass them through to the resulting actions, which is coupling
// these things too tightly.
export function requestProfile( networkName, siteUrl, clientKey ) {
return bindRequest(