This file contains hidden or 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
// Function to get preferred image size from a images data object delivered by Payload CMS. | |
interface ImageSizeData { | |
alt: string; | |
url?: string | null; | |
filename?: string | null; | |
mimeType?: string | null; | |
filesize?: number | null; | |
width?: number | null; | |
height?: number | null; | |
sizes?: { [key: string]: Omit<ImageSizeData, "alt" | "sizes"> }; |
This file contains hidden or 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
# BEGIN WordPress Multisite | |
# Using subfolder network type: https://wordpress.org/documentation/article/htaccess/#multisite | |
RewriteEngine On | |
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
# add a trailing slash to /wp-admin | |
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] |
This file contains hidden or 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 { isFakeEmailOnline, isFakeEmail as isFakeEmailLocal } from 'fakefilter'; | |
export default async function isFakeEmail(email: string) { | |
const onlineResponse = await isFakeEmailOnline(email); | |
if (onlineResponse === null) { | |
return !!isFakeEmailLocal(email); | |
} | |
return !!onlineResponse.isFakeDomain; | |
} |
This file contains hidden or 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
// Simply add API key and MC region - and set what condition to look for as url - and run `node index.js` in terminal. | |
const client = require("mailchimp-marketing"); | |
client.setConfig({ | |
apiKey: "MC_API_KEY", | |
server: "MC_REGION", | |
}); | |
let total_clicks = {}; |
This file contains hidden or 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 | |
// Add somewhere in functions.php for your child theme | |
// Add parent_category filter to REST API | |
if (!function_exists('wprabpc_wp_rest_api_by_parent_category')) { | |
function wprabpc_wp_rest_api_by_parent_category($args, $request) | |
{ | |
if (isset($request['parent_category'])) { | |
$parent_category = sanitize_text_field($request['parent_category']); | |
$args['tax_query'] = [ |
This file contains hidden or 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
.color-options { | |
display:flex; | |
margin-left:-2px; | |
flex-wrap:wrap; | |
} | |
.color-options__item { | |
width:14px; | |
height:14px; | |
flex-shrink:0; |
This file contains hidden or 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
{% comment %} Show color options {% endcomment %} | |
{%- if product_card_product.metafields.product_info.color.type == "list.color" -%} | |
<div class="color-options"> | |
{%- for color in product_card_product.metafields.product_info.color.value -%} | |
<div class="color-options__item" style="background-color:{{color}};"> </div> | |
{%- endfor -%} | |
</div> | |
{%- endif -%} |
This file contains hidden or 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
#### | |
# Simple bash alternative to execute nvm use whenever a .nvmrc file is present in your directory. | |
#### | |
enter_directory() { | |
if [[ $PWD == $PREV_PWD ]]; then | |
return | |
fi | |
PREV_PWD=$PWD | |
[[ -f ".nvmrc" ]] && nvm use |
This file contains hidden or 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
# $HOME/.functions | |
function create-next-project() { | |
NAME=${1:-too-lazy-to-come-up-with-a-project-name} | |
npx create-next-app $NAME -e https://github.com/jpedroschmitz/typescript-nextjs-starter | |
} | |
# In order to have these functions available in your terminal at all times | |
# make sure to add following command to your .bashrc or .zshrc file: | |
# source $HOME/.functions |
This file contains hidden or 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
// extensions/users-permissions/controllers/Auth.js | |
"use strict"; | |
/** | |
* Auth.js controller | |
* | |
* @description: A set of functions called "actions" for managing `Auth`. | |
*/ | |
/* eslint-disable no-useless-escape */ |
NewerOlder