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
| #!/usr/bin/env python3 | |
| """ | |
| Claude Code token usage analyzer. | |
| Analyzes ~/.claude/projects/ JSONL files for token usage patterns. | |
| """ | |
| import json | |
| import os | |
| import sys | |
| from pathlib import Path |
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
| const { createElement: el, useState, useEffect } = React; | |
| const PanelBody = wp.components.PanelBody; | |
| const PluginSidebar = wp.editor.PluginSidebar; | |
| const addAction = wp.hooks.addAction; | |
| const registerPlugin = wp.plugins.registerPlugin; | |
| function MyPluginSidebar() { | |
| const [ deprecations, setDeprecations ] = useState( [] ); | |
| useEffect( () => { | |
| addAction( |
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
| public function is_cache_plugin_installed() { | |
| return | |
| function_exists( 'w3tc_flush_post' ) || | |
| function_exists( 'wp_cache_post_change' ) || | |
| function_exists( 'rocket_clean_post' ) || | |
| has_action( 'cachify_remove_post_cache' ) || | |
| has_action( 'litespeed_purge_post' ) || | |
| function_exists( 'wpfc_clear_post_cache_by_id' ) || | |
| class_exists( 'WPO_Page_Cache' ) || | |
| has_action( 'cache_enabler_clear_page_cache_by_post' ) || |
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 | |
| /** | |
| * Get an SVG file from the imgs/ folder in the theme, update its attributes if necessary and return it as a string. | |
| * | |
| * @author Aurooba Ahmed | |
| * @see https://aurooba.com/inline-svgs-in-your-wordpress-code-with-this-helper-function/ | |
| * | |
| * @param string $filename The name of the SVG file to get. | |
| * @param array $attributes (optional) An array of attributes to add/modify to the SVG file. |
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 a WP CLI Command which allows import of CSV files from the command line. | |
| if ( defined( 'WP_CLI' ) && WP_CLI ) { | |
| require_once WP_PLUGIN_DIR . '/woocommerce/includes/import/class-wc-product-csv-importer.php'; | |
| // Maybe require and invoke any other filters you need here as theme/plugins may not be loaded at this point. | |
| class WP_CLI_WC_Import_CSV { |
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 | |
| /** | |
| * By default, cURL sends the "Expect" header all the time which severely impacts | |
| * performance. Instead, we'll send it if the body is larger than 1 mb like | |
| * Guzzle does. | |
| */ | |
| function add_expect_header(array $arguments) | |
| { | |
| $arguments['headers']['expect'] = ''; |
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
| $ curl --help | |
| Usage: curl [options...] <url> | |
| --abstract-unix-socket <path> Connect via abstract Unix domain socket | |
| --alt-svc <file name> Enable alt-svc with this cache file | |
| --anyauth Pick any authentication method | |
| -a, --append Append to target file when uploading | |
| --basic Use HTTP Basic Authentication | |
| --cacert <file> CA certificate to verify peer against | |
| --capath <dir> CA directory to verify peer against | |
| -E, --cert <certificate[:password]> Client certificate file and password |
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
| version: '2' | |
| services: | |
| db: | |
| container_name: database | |
| image: mariadb # Pull mysql image from Docker Hub | |
| ports: # Set up ports exposed for other containers to connect to | |
| - "3306:3306" | |
| volumes: | |
| - ./dep/mysql:/docker-entrypoint-initdb.d |
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 | |
| // plugins/woocommerce-api-manager/includes/class-wc-am-update-api.php | |
| // Add `$response->tested` to show "100% compatible" on the Updates page. | |
| case 'pluginupdatecheck': | |
| $response->id = $post_id; | |
| $response->slug = ! empty( $this->slug ) ? $this->slug : $slug; | |
| $response->plugin = $plugin_name; | |
| $response->new_version = $api_data[ '_api_new_version' ]; | |
| $response->url = $api_data[ '_api_plugin_url' ]; |
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_action( 'shutdown', function(){ | |
| foreach( $GLOBALS['wp_actions'] as $action => $count ) | |
| printf( '%s (%d) <br/>' . PHP_EOL, $action, $count ); | |
| }); |
NewerOlder