Skip to content

Instantly share code, notes, and snippets.

View shoelaced's full-sized avatar

Gregory Storkan shoelaced

  • Artbrander
  • London, UK
  • 21:18 (UTC +01:00)
View GitHub Profile
@bekarice
bekarice / wc-disable-any-repeat-purchase.php
Last active September 12, 2024 16:37
Disables Repeat Purchase for any WooCommerce product
<?php
/**
* Disables repeat purchase for products / variations
*
* @param bool $purchasable true if product can be purchased
* @param \WC_Product $product the WooCommerce product
* @return bool $purchasable the updated is_purchasable check
*/
function sv_disable_repeat_purchase( $purchasable, $product ) {
@brandonheyer
brandonheyer / rgbToHSL.php
Last active March 9, 2025 17:19
PHP snippet to convert RGB to HSL and HSL to RGB.
<?
function rgbToHsl( $r, $g, $b ) {
$oldR = $r;
$oldG = $g;
$oldB = $b;
$r /= 255;
$g /= 255;
$b /= 255;