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 { act, renderHook } from '@testing-library/react'; | |
import { describe, it, expect, beforeEach } from "vitest"; | |
import { usePostsStore } from "@/_store/usePostsStore"; | |
describe('usePostsStore', () => { | |
beforeEach(() => { | |
usePostsStore.getState().reset() | |
}); | |
it('should return the initial state', () => { |
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 { createStore, Store } from 'vuex'; | |
import { afterAll, beforeAll, describe, expect, it } from "vitest"; | |
import { key, store } from "@/store"; | |
import type { User } from "@/types/types"; | |
import App from "@/App.vue"; | |
import { DOMWrapper, mount, VueWrapper } from "@vue/test-utils"; | |
import type { State } from "@/store" | |
const localStorageMock: Storage = (() => { | |
let store: Record<string, string> = {}; |
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
version: '2' | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- "./.data/db:/var/lib/mysql" | |
ports: | |
- "[YOUR_DESIRED_SQL_PORT]:3306" | |
environment: | |
MYSQL_ROOT_PASSWORD: wordpress |
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
// From https://www.sitepoint.com/cache-fetched-ajax-requests/ | |
// All credits to: Peter Bengtsson | |
// Added Content-type to headers so it can go to traditional validation like fetch does | |
// Add some debugging messages: activate with { verbose: true } | |
// Add a request to be able to add headers instead of just calling URL | |
const CachedFetch = (url, options) => { | |
let expiry = options.seconds || 5 * 60 // 5 min default | |
let logger = (options.verbose) ? console.log : function(){}; |
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 | |
// This is so easy, it's embarassing that I took 20 minutes to find it. | |
// "Catalog" is a custom taxonomy. | |
function make_catalog_sortable( $sortables ) { | |
$sortables[] = 'catalog'; | |
return $sortables; | |
} | |
add_filter( 'woocommerce_sortable_taxonomies', 'make_catalog_sortable' ); |
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
$address = array( | |
'first_name' => $customer_name, | |
'last_name' => '', | |
'company' => '', | |
'email' => $customer_email, | |
'phone' => $customer_phone, | |
'address_1' => '', | |
'address_2' => '', | |
'city' => '', | |
'state' => '', |
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
// target.addEventListener shim, hat tip [mdn](http://mzl.la/18ELrGJ) | |
(function() { | |
if (!Event.prototype.preventDefault) { | |
Event.prototype.preventDefault=function() { | |
this.returnValue=false; | |
}; | |
} | |
if (!Event.prototype.stopPropagation) { | |
Event.prototype.stopPropagation=function() { | |
this.cancelBubble=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
# <type>: (If applied, this commit will...) <subject> (Max 50 char) | |
# |<---- Using a Maximum Of 50 Characters ---->| | |
# Explain why this change is being made | |
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->| | |
# Provide links or keys to any relevant tickets, articles or other resources | |
# Example: Github issue #23 |
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
'use strict'; | |
class Abstract { | |
// A static abstract method. | |
static foo() { | |
if (this === Abstract) { | |
// Error Type 2. Abstract methods can not be called directly. | |
throw new TypeError("Can not call static abstract method foo."); | |
} else if (this.foo === Abstract.foo) { | |
// Error Type 3. The child has not implemented this method. | |
throw new TypeError("Please implement static abstract method foo."); |
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
# Read more about setting it up | |
# https://medium.com/@ljmocic/deploying-react-application-to-aws-s3-using-github-actions-85addacaeace | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: |
NewerOlder