Skip to content

Instantly share code, notes, and snippets.

View tinhochu's full-sized avatar

Tin Ho Chu tinhochu

View GitHub Profile
@Jamiewarb
Jamiewarb / menus.php
Created May 7, 2021 15:48 — forked from jamesfacts/menus.php
This adds tailwind classes to the output of navwalkers
<?php
namespace App;
/**
* Custom fork of WP's native Walker functionality revised so we can output
* classes for tailwind
*
*/
/**
#################################
# K3d #
# How to run Kubernetes locally #
# https://youtu.be/mCesuGk-Fks #
#################################
# Referenced videos:
# - How to run local multi-node Kubernetes clusters using kind: https://youtu.be/C0v5gJSWuSo
# - Kaniko - Building Container Images In Kubernetes Without Docker: https://youtu.be/EgwVQN6GNJg
##############################################################
# How to run local multi-node Kubernetes clusters using kind #
# https://youtu.be/C0v5gJSWuSo #
##############################################################
#########
# Setup #
#########
# Install kind (https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active October 12, 2024 17:22
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@ollietreend
ollietreend / acf-php-to-json.php
Last active September 18, 2024 05:24
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
<?php
/**
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
*/
namespace ConvertAcfPhpToJson;
/**
* Add submenu item under 'Custom Fields'
@hsleonis
hsleonis / better-font-smoothing.css
Last active October 12, 2024 16:41
Better font smoothing in cross browser
html {
/* Adjust font size */
font-size: 100%;
-webkit-text-size-adjust: 100%;
/* Font varient */
font-variant-ligatures: none;
-webkit-font-variant-ligatures: none;
/* Smoothing */
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
@helgatheviking
helgatheviking / kia_convert_country_code.php
Created December 7, 2015 19:01
Converts the WooCommerce country codes to 3-letter ISO codes
<?php
/**
* Converts the WooCommerce country codes to 3-letter ISO codes
* https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
* @param string WooCommerce's 2 letter country code
* @return string ISO 3-letter country code
*/
function kia_convert_country_code( $country ) {
$countries = array(
'AF' => 'AFG', //Afghanistan
@kloon
kloon / functions.php
Created March 28, 2014 08:58
WooCommerce 2.1 Add confirm password field on My Account register form
<?php
// Add the code below to your theme's functions.php file to add a confirm password field on the register form under My Accounts.
add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3);
function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
global $woocommerce;
extract( $_POST );
if ( strcmp( $password, $password2 ) !== 0 ) {
return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) );
}