Skip to content

Instantly share code, notes, and snippets.

View RickardAhlstedt's full-sized avatar

Rickard Ahlstedt RickardAhlstedt

View GitHub Profile
@RickardAhlstedt
RickardAhlstedt / #1 Person.php
Last active November 10, 2020 23:08
Single Inheritance-example
<?php
/* Dependencies.. */
class Person {
public $sName;
protected $iAge;
private $mPhone;
public function talk() { ... }
<?php
/**
* ContainerBridge.php
*
* Copyright © 2005-2006, FileMaker, Inc. All rights reserved.
* NOTE: Use of this source code is subject to the terms of the FileMaker
* Software License which accompanies the code. Your use of this source code
* signifies your agreement to such license terms and conditions. Except as
* expressly granted in the Software License, no other copyright, patent, or
* other intellectual property license or right is granted, either expressly or
@RickardAhlstedt
RickardAhlstedt / scgode.ino
Last active August 4, 2022 09:35
Simplified G-Code parser for Arduino UNO
// https://wokwi.com/projects/339048333809025620
void setup() {
Serial.begin(9600);
}
int linearGuideLength = 100;
// A variable to determine if the system can receive configuration or not.
bool systemBusy = false;
@RickardAhlstedt
RickardAhlstedt / class-wup-track-shipment.php
Created December 8, 2022 09:54
Call to a member function get_shipping_country() on string in /wp-content/plugins/woo-pacsoft-unifaun/src/class-wup-track-shipment.php:33
<?php
...
// Add the following code to line 32 in file /woo-pacsoft-unifaun/src/class-wup-track-shipment.php
// This will ensure that the returned object is actually an object, and not a string that seems to be returned when using wc_get_order
$order = new \WC_Order( $order );
...
?>
@RickardAhlstedt
RickardAhlstedt / fix.sh
Created January 27, 2023 03:09
When brew update goes wrong and valet & php refuses to work
brew unlink php && brew link php
brew services restart --all
composer global update
valet install
@RickardAhlstedt
RickardAhlstedt / functions.php
Created February 2, 2023 08:30
Polylang - show review count in tabs on other languages and show rating on translated products.
<?php
add_filter( 'woocommerce_product_tabs', 'ao_tabs' );
function ao_tabs( $tabs ) {
foreach( $tabs as $sKey => $aTab ) {
if( $aTab['callback'] == 'comments_template' ) {
if( $sTransTitle = get_transient( 'product_' . get_queried_object_id( ) . '_review_count' ) ) {
$tabs[$sKey]['title'] = $sTitle;
}