Skip to content

Instantly share code, notes, and snippets.

View MonteLogic's full-sized avatar
♂️

Monte Logic MonteLogic

♂️
View GitHub Profile
@MonteLogic
MonteLogic / php.json
Last active September 20, 2021 01:52
snippets used in vsCode
{
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
@MonteLogic
MonteLogic / index.html
Created December 31, 2021 20:21
change JS Solution
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="javascript.js"></script>
@MonteLogic
MonteLogic / Description.MD
Last active January 29, 2022 01:18
2 for each loops that matches a a course that needs to have a book.

This logic matches a book with a course. This PHP logic is installed on the checkout page and it fires in notice if the user doesn't have the book that goes with the course. I think that it's bloated maybe somebody else can help me but as it is right now i t works fine but it's just fine.

@MonteLogic
MonteLogic / README.md
Last active February 4, 2022 06:12
Trying to call this function from wooCommerce hooks but it give me an error suppling the foreach loop

I am trying to call this function/hook which is in the wooCommerce codebase but when I run my code it gives me an error.

Warning: Invalid argument supplied for foreach() in C:\wp-content\plugins\woocommerce-bookings\includes\admin\class-wc-bookings-calendar.php on line 241

Even when I console.log the events array it gives me a good array.

This function is the function I'm trying to call: $findDateBooking->list_bookings($day, $month, $year);

set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@MonteLogic
MonteLogic / style.css
Last active August 15, 2022 23:38
Styles css of Genesis project
/*
Theme Name: Matlack-genesis
Theme URI:
Description: Genesis child theme.
Author: Me
Author URI:
Template: genesis
Version: 0.1.0
*/
@MonteLogic
MonteLogic / WC_checkout_field_validation
Created August 20, 2022 07:47 — forked from codehooligans/WC_checkout_field_validation
WooCommerce Checkout form DOB date field validation in jQuery
// We are using the WooCommerce Checkout Field Editor plugin in addition to WooCommerce. The Checkout Field Editor
// does a nice job at providing a UI for manage additional fields. But doesn't provide any method to do validations.
// So this code helps with that on a very specific implemention where we have a Gender select and a DoB date selector.
// On the Gender we want to ensure the selected value is 'Male' or 'Female' only. We don't want the
default option 'Choose Option' to be valid. On the DoB we want to enforce the user is 18 or older.
add_action( 'woocommerce_after_checkout_validation', 'woo_checkout_additional_field_validation' );
function woo_checkout_additional_field_validation() {
if (!defined('WOOCOMMERCE_CHECKOUT')) {
return;
@MonteLogic
MonteLogic / zip_to_state.php
Created August 22, 2022 00:38 — forked from loureirorg/zip_to_state.php
State from a zipcode (US)
<?php
function zipToState($zipcode)
{
/* 000 to 999 */
$zip_by_state = [
'--', '--', '--', '--', '--', 'NY', 'PR', 'PR', 'VI', 'PR', 'MA', 'MA', 'MA',
'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA',
'MA', 'MA', 'RI', 'RI', 'NH', 'NH', 'NH', 'NH', 'NH', 'NH', 'NH', 'NH', 'NH',
'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'VT', 'VT',
'VT', 'VT', 'VT', 'MA', 'VT', 'VT', 'VT', 'VT', 'CT', 'CT', 'CT', 'CT', 'CT',
@MonteLogic
MonteLogic / create-bare-bbt.bash
Created August 23, 2022 02:06
This bash file when executed scaffolds a theme structure with just the bare essentials of a BBT (Block Based Theme).
#! /bin/bash
mkdir "$PWD"/bare-bbt
touch "$PWD"/bare-bbt/style.css
mkdir "$PWD"/bare-bbt/templates "$PWD"/bare-bbt/parts
cat << DELIMITER >> "$PWD"/bare-bbt/parts/header.html
@MonteLogic
MonteLogic / upload_to_gist.sh
Created September 3, 2022 05:53 — forked from ryanli1994/upload_to_gist.sh
upload file to gist bash
# 0. Your file name
FNAME=worker.log
GITHUB_USERNAME=kigawas
# 1. Somehow sanitize the file content
# Remove \r (from Windows end-of-lines),
# Replace tabs by \t
# Replace " by \"
# Replace EOL by \n
CONTENT=$(sed -e 's/\r//' -e's/\t/\\t/g' -e 's/"/\\"/g' "${FNAME}" | awk '{ printf($0 "\\n") }')