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;
@kilbot
kilbot / woocommerce-pos-gateways.php
Last active February 1, 2024 16:43
Simple plugin to add multiple gateways for WooCommerce POS Pro
<?php
/**
* Plugin Name: WooCommerce POS Gateways
* Plugin URI: https://wordpress.org/plugins/woocommerce-pos/
* Description: Extends WooCommerce with multiple POS gateways.
* Version: 1.0.0
* Author: kilbot
* Author URI: http://wcpos.com
* License: GPL-3.0+
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@kilbot
kilbot / receipt.php
Created August 8, 2023 21:50
Custom receipt template with License Manager for WooCommerce
<?php
/**
* Sales Receipt Template
*
* This template can be overridden by copying it to yourtheme/woocommerce-pos/receipt.php.
* HOWEVER, this is not recommended , don't be surprised if your POS breaks
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
@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 April 13, 2023 12:56
Changing default email template for POS orders
<?php
// This would go in your theme fucntions.php file, or you could create a new plugin
/**
* Change Email Subject and Heading
*/
function wc_custom_email_template_order_details( $order, $sent_to_admin, $plain_text, $email ) {
// If POS order, change the template
if ( $order->get_meta( '_pos' ) ) {
// Example: Change the email heading
@kilbot
kilbot / tmpl-receipt.php
Last active January 19, 2023 10:33
Example of Pro receipt based on WooCommerce Print Invoices and Packing Lists
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php _e( 'Receipt', 'woocommerce-pos' ); ?></title>
<style type="text/css">
/* ==========*
* HTML TAGS *
@kilbot
kilbot / database.ts
Last active August 27, 2022 16:45
RxStorage adapter for expo-sqlite
import { createRxDatabase } from 'rxdb';
import { getRxStorageSQLite, SQLiteQueryWithParams } from 'rxdb-premium/plugins/sqlite';
import { openDatabase, WebSQLDatabase, ResultSet } from 'expo-sqlite';
/**
* Polyfill for TextEncoder
* fixes: ReferenceError: Can't find variable: TextEncoder
*/
import 'fast-text-encoding';
@kilbot
kilbot / functions.php
Last active May 18, 2022 17:38
Adding a dummy email address at customer creation
<?php
function my_custom_create_customer_data($data){
if(function_exists('is_pos') && is_pos()){
$dummy_email = 'email@example.com'; // note: you would have to generate a unique email address for each user
$data['email'] = ! isset($data['email']) || empty($data['email']) ? $dummy_email : $data['email'];
};
return $data;
}
@kilbot
kilbot / functions.php
Created May 4, 2022 11:37
Deactivate Drip_Woocommerce_Cart_Events->find_drip_visitor_uuid()
<?php
// add to custom functions
add_filter( 'option_account_id', function( $value ){
if ( function_exists('is_pos') && is_pos() ) {
return null;
}
return $value;
});
@kilbot
kilbot / snippet.php
Last active February 15, 2022 22:31
Snippet to update order postmeta
<?php
global $wpdb;
$customer_id = 6; // CHANGE THIS!
$customer_email = 'test@wordpress.com'; // CHANGE THIS!
$postids = $wpdb->get_col(
$wpdb->prepare(
"
SELECT pm.post_id
FROM {$wpdb->postmeta} pm