Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 Specifiers = { | |
's': string, | |
'd': number, | |
'b': boolean, | |
'D': Date | |
}; | |
type S = keyof Specifiers; | |
type ExtractNamedPlaceholders<T extends string> = | |
T extends `${infer Start}%(${infer Key})${infer Spec}${infer Rest}` |
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 | |
/** | |
* Lazy load background images and videos in Gutenberg blocks | |
* @param $block - the block | |
* @param $parsed - the parsed block data | |
* @return array|mixed|string|string[]|null | |
*/ | |
function vsge_lazy_cover( $block, $parsed ) { | |
// Check if the 'url' attribute is set | |
if ( isset( $parsed['attrs']['url'] ) ) { |
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
function wrapEmojisWithDiv() { | |
const emojiRegex = /\p{Emoji_Presentation}/gu; | |
// Select all elements containing text | |
const elementsWithText = document.querySelectorAll('*:not(script):not(style)'); | |
elementsWithText.forEach(function(element) { | |
// node 3 is "text" | |
if (element.childNodes[0]?.nodeType === 3) { | |
// Wrap emojis with a div with the class "no-dark" that disables the "invert" filter |
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
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"type": "object", | |
"properties": { | |
"wordpress": { | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "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
{ | |
"name": "wordpress", | |
"wordpress": { | |
"version": null, | |
"language": "it_IT", | |
"config": { | |
"DB_NAME": "my_db_name", | |
"DB_USER": "my_db_username", | |
"DB_PASSWORD": "my_db_password", | |
"DB_HOST": "localhost", |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Browser Security Test</title> | |
<!-- Google Fonts --> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic"> |
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
function makeToast( message = 'OK!', timeout = 3000 ) { | |
// Create the toast notification element | |
const toast = document.createElement('div'); | |
toast.textContent = message; | |
toast.style = 'display:block;max-width:calc(100% - 20px);position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background-color:#333;color:#fff;padding:10px 20px;border-radius:5px;'; | |
// display the toast notification | |
document.body.appendChild(toast); | |
// Hide and remove the toast after a while |
NewerOlder