Skip to content

Instantly share code, notes, and snippets.

@Kaji01
Kaji01 / functions.php
Created April 14, 2021 16:29 — forked from contemplate/functions.php
WooCommerce - Allow guest checkout for certain products when Guest checkout is Disabled globally
/*--------------------------------------
Woocommerce - Allow Guest Checkout on Certain products
----------------------------------------*/
// Display Guest Checkout Field
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
function woo_add_custom_general_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
@Kaji01
Kaji01 / Iso369_1.swift
Last active July 7, 2023 21:33 — forked from proxpero/Iso369_1.swift
A Swift 5.0 enum representing ISO 639-1 codes (used to classify languages)
// taken 2018-03-19 from wikipedia. https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
public enum Iso639_1: String, CaseIterable {
case ab = "ab"
case aa = "aa"
case af = "af"
case ak = "ak"
case sq = "sq"
case am = "am"
case ar = "ar"
@Kaji01
Kaji01 / SKActionTransitionColor.swift
Created August 12, 2020 08:45 — forked from johnnyw/SKActionTransitionColor.swift
[SpriteKit] Custom SKAction to transition the fill/stroke color of an SKShapeNode.
import CoreGraphics
import SpriteKit
extension SKAction {
static func transitionStrokeColor(from: SKColor, to: SKColor, duration: TimeInterval) -> SKAction {
return transitionColor(from: from, to: to, duration: duration, fill: false)
}
static func transitionFillColor(from: SKColor, to: SKColor, duration: TimeInterval) -> SKAction {
@Kaji01
Kaji01 / UIColor+Initializers.swift
Created August 11, 2020 08:45 — forked from fxm90/UIColor+Initializers.swift
Create UIColor from RGB, RGBA, Hex or Hex-String ("#ffffff")
public extension UIColor {
/// Create color from RGB(A)
///
/// Parameters:
/// - absoluteRed: Red value (between 0 - 255)
/// - green: Green value (between 0 - 255)
/// - blue: Blue value (between 0 - 255)
/// - alpha: Blue value (between 0 - 255)
///
@Kaji01
Kaji01 / wordpress-multisite-internal-redirect-loop.md
Last active November 10, 2018 06:09 — forked from JustThomas/wordpress-multisite-internal-redirect-loop.md
WordPress Multisite: How to fix error "too many redirects"

WordPress Multisite: How to fix error "Request exceeded the limit of 10 internal redirects"

I am running a WordPress multisite network with sub-directory setup. When I check my error.log file, it is full of entries like this one:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'Limit InternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

The problem was, in my case, one specific rewrite rule in the .htaccess file.

Problem description

@Kaji01
Kaji01 / ICS.php
Created March 13, 2018 16:58 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):