This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest' | |
import { shallowMount } from '@vue/test-utils' | |
import App from '@/App.vue' // Import Vue component to test | |
import axios from 'axios' // Import libraries to mock | |
// Mock the axios library | |
vi.mock("axios", () => { | |
return { | |
default: { | |
get: vi.fn(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sorting_Lead(value) { | |
return value.sort((a, b) => a.read_status - b.read_status); | |
}, | |
Ex: [{'phone':7777***,'lead_status':false},{'phone':9999***,'lead_status':true}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Automatically login a single WordPress user upon arrival to a specific page. | |
* | |
* Redirect to home page once logged in and prevent viewing of the login page. | |
* Compatible with WordPress 3.9.1+ | |
* Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead." | |
* Updated 2019-07-09 to reformat code, pass 2nd parameter to `do_action()`, and hook into priority 1. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (function_exists('get_field')) { | |
$poss_coupon_code = get_field( "global_coupon", 35445 ); | |
if($poss_coupon_code) { | |
global $woocommerce; | |
$coupon_object = new WC_Coupon($poss_coupon_code); | |
if($coupon_object->get_discount_type() == "percent") { | |
$discounted_coupon_amount = $coupon_object->get_amount(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"meta": { | |
"theme": "elegant" | |
}, | |
"basics": { | |
"name": "Thomas Davis", | |
"label": "Web Developer", | |
"image": "https://avatars0.githubusercontent.com/u/416209?s=460&u=38f220a2c9c658141804f881c334c594eb1642ac&v=4", | |
"summary": "I’m a full stack web developer who can build apps from the ground up. I've worked mostly at startups so I am use to wearing many hats. I am a very product focussed developer who priotizes user feedback first and foremost. I'm generally very flexible when investigating new roles. ", | |
"website": "https://lordajax.com", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let isWeekend = new Date(); | |
const months = ["Jan", "Feb", "Mar", "Apr", "May", "June", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] | |
console.log(isWeekend.getDay()) | |
if (isWeekend.getDay() == 6 || isWeekend.getDay() == 0) { | |
let todayIsWeekendStart = new Date(); | |
todayIsWeekendStart.setDate(todayIsWeekendStart.getDate() + (((1 + 7 - todayIsWeekendStart.getDay()) % 7) || 7) + 7); | |
let weekend_Start = todayIsWeekendStart.getDate() + " " + (months[todayIsWeekendStart.getMonth()]) + " " + todayIsWeekendStart.getFullYear(); | |
let todayIsWeekendEnd = new Date(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Script firing just before form submission | |
<script> | |
window.ub.hooks.beforeFormSubmit.push(function() { | |
//Your Script here | |
}); | |
</script> | |
Script firing just after form submission |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // only copy this line if needed | |
/** | |
* Renders a notice and prevents checkout if the cart | |
* only contains products in a specific category | |
*/ | |
function sv_wc_prevent_checkout_for_category() { | |
// set the slug of the category for which we disallow checkout | |
$category = 'clothing'; |
NewerOlder