Skip to content

Instantly share code, notes, and snippets.

@kilbot
kilbot / ReactNativeFlipper.java
Last active May 12, 2020
WatermelonDB Inspector for Flipper (extensible RN debugger)
View ReactNativeFlipper.java
/**
* 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;
View keybase.md

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:

View functions.php
<?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');
View functions.php
<?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 Mar 2, 2019
TypeScript declaration file for WatermelonDB
View watermelon.d.ts
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 Oct 24, 2018
Force GDPR consent for WooCommerce POS
View functions.php
<?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 Oct 23, 2018
Adding a gift card code to the WooCommerce POS receipt template
View functions.php
<?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 Oct 17, 2018
Custom Shipping Labels
View functions.php
<?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 Sep 14, 2018
Remove customer meta_data from WC REST API response
View functions.php
<?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 Apr 29, 2018
Custom product tabs
View functions.php
<?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
),