Skip to content

Instantly share code, notes, and snippets.

View kilbot's full-sized avatar

Paul Kilmurray kilbot

View GitHub Profile
@kilbot
kilbot / ReactNativeFlipper.java
Last active February 27, 2024 02:18
WatermelonDB Inspector for Flipper (extensible RN debugger)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package ***CHANGE_ME***;
import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;

Keybase proof

I hereby claim:

  • I am kilbot on github.
  • I am kilbot (https://keybase.io/kilbot) on keybase.
  • I have a public key ASDfUhifa7YeloJAewiQxQS5_qB1BHOdL8ipzmgHcwE3ZAo

To claim this, I am signing this object:

<?php
// the code below goes in your theme's functions.php file
function my_custom_pos_template_redirect() {
$usd_store_id = 3365;
$cad_store_id = 3366;
$current_store_id = get_user_option('woocommerce_pos_store');
<?php
// this goes in your theme functions.php file
function my_custom_rest_dispatch_request($continue, $request, $route, $handler)
{
if (function_exists('is_pos') && is_pos() && $route == 'wc/v3/products') {
$request->set_param('per_page', -1);
$request->set_param('stock_status', 'instock');
}
@kilbot
kilbot / watermelon.d.ts
Created March 2, 2019 04:16
TypeScript declaration file for WatermelonDB
declare module '@nozbe/watermelondb' {
import * as Q from '@nozbe/watermelondb/QueryDescription'
export { default as Collection } from '@nozbe/watermelondb/Collection'
export { default as Database } from '@nozbe/watermelondb/Database'
export { default as CollectionMap } from '@nozbe/watermelondb/Database/CollectionMap'
export { default as Relation } from '@nozbe/watermelondb/Relation'
export { default as Model, associations } from '@nozbe/watermelondb/Model'
export { default as Query } from '@nozbe/watermelondb/Query'
export { tableName, columnName, appSchema, tableSchema } from '@nozbe/watermelondb/Schema'
@kilbot
kilbot / functions.php
Created October 24, 2018 03:36
Force GDPR consent for WooCommerce POS
<?php
// this goes in your theme functions.php file
function force_gdpr_consent_for_woocommerce_pos()
{
if (function_exists('is_pos') && is_pos()) {
$_POST['wpgdprc'] = true;
}
}
@kilbot
kilbot / functions.php
Created October 23, 2018 17:25
Adding a gift card code to the WooCommerce POS receipt template
<?php
// this goes in your theme functions.php file
function my_custom_wc_rest_shop_order_object($response)
{
if (function_exists('is_pos') && is_pos()) {
$data = $response->get_data();
if (is_array($data['line_items'])) : foreach ($data['line_items'] as &$line_item) :
if ($code = wc_get_order_item_meta($line_item['id'], '_ywgc_gift_card_number')) {
@kilbot
kilbot / functions.php
Created October 17, 2018 03:30
Custom Shipping Labels
<?php
// place this in your theme functions.php file
function my_custom_pos_shipping_labels($params){
$params['shipping'] = array(
'ex1' => 'Example 1',
'ex2' => 'Example 2'
);
@kilbot
kilbot / functions.php
Last active September 14, 2018 11:51
Remove customer meta_data from WC REST API response
<?php
function my_custom_rest_prepare_customer( $response ){
if( function_exists('is_pos') && is_pos() ) {
$data = $response->get_data();
$data['meta_data'] = array(); // remove meta_data
$response->set_data($data);
}
return $response;
}
@kilbot
kilbot / functions.php
Created April 29, 2018 05:24
Custom product tabs
<?php
// place this in your theme functions.php file
function my_custom_pos_tabs($params){
$params['tabs'] = array(
'all' => array(
'label' => __( 'All', 'woocommerce'),
'active' => true
),