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 { writeFile } from 'fs/promises'; | |
async function fetchWithTimeout(url, timeout = 30000) { | |
const controller = new AbortController(); | |
const timeoutId = setTimeout(() => controller.abort(), timeout); | |
try { | |
const response = await fetch(url, { | |
signal: controller.signal, | |
headers: { |
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 | |
/** | |
* DOM Operations Benchmark Test | |
* | |
* Comparing PHP 8.4 DOM vs WP_HTML_Tag_Processor | |
*/ | |
class DOMBenchmark { | |
private const SAMPLE_HTML = <<<HTML | |
<main> |
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 | |
$cdn_image_domain_to_use = 'https://{replace-me}.cloudfront.net' | |
$cdn_image_domain_to_use_parsed = wp_parse_url( $cdn_image_domain_to_use ); | |
// Stop creating crops and just use the original image. | |
add_filter( 'jetpack_photon_noresize_mode', '__return_true' ); | |
// Setup custom domain. | |
add_filter( 'jetpack_photon_domain', fn() => $cdn_image_domain_to_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
<?php | |
// Function to extract block names from post content | |
function extractBlockNames($content) { | |
$blockNames = []; | |
$pattern = '/<!-- wp:([\w\/-]+)/'; | |
preg_match_all($pattern, $content, $matches); | |
if (!empty($matches[1])) { | |
$blockNames = $matches[1]; |
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 | |
/** | |
* Plugin Name: Disable jetpack sync. | |
*/ | |
add_filter( 'jetpack_sync_modules', '__return_empty_array', PHP_INT_MAX ); |
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 | |
/** | |
* Plugin name: Redirect canonical to home URL for trailing slash. | |
* Description: Fix for WordPress network site with different homeurl and site address with reverse proxy, which redirects non-trailing slash to site address instead of home url. | |
* Version: 1.0 | |
* Author: Utkarsh | |
* Author URI: https://utkarshpatel.com | |
* License: GPLv2 or later | |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
*/ |
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
name: Auto Merge and Push on Label | |
on: | |
pull_request_target: | |
types: [labeled] | |
jobs: | |
auto-merge-and-push: | |
runs-on: ubuntu-latest | |
if: github.event.label.name == 'In dev' |
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 | |
// Define an interface | |
interface MyInterface { | |
public function myFunction(); | |
} | |
// Define 1000 classes that implement the interface | |
for ($i = 1; $i <= 100000; $i++) { | |
$className = 'MyClass' . $i; | |
eval(" |
NewerOlder