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
| # Force Claude to open in the root folder of a project | |
| # | |
| # Claude annoying treats the folder it was launched from as the project root. If the root is ~/local-sites/core/ | |
| # and that's where the CLAUDE.md file is, but you launch claude from ~/local-sites/core/app/public/wp-content or | |
| # ~/local-sites/core/app/public/wp-content/mu-plugins, then it'll created .claude/settings.local.json files in | |
| # those subdirectories, and have separate conversation history from each other and from the project root. | |
| # | |
| # This scans for a CLAUDE.md at the project root and launches claude from there. $HOME also has a global CLAUDE.md, | |
| # though, so this stops before that, to avoid $HOME being treated as a project root. | |
| # |
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 | |
| namespace AdminScreenItems; | |
| add_action( 'admin_init', __NAMESPACE__ . '\register_admin_screen_items_callback' ); | |
| /** | |
| * Register set_minimum_number_admin_screen_items to all admin screens. | |
| * | |
| * It's necessary to manually add it for each screen name because WP_Screen::render_per_page_options |
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
| # Alias to convert a stereo recording to mono | |
| # | |
| # $1 - The input filename | |
| function qtmono { | |
| basename=$(basename "$1") | |
| filename="${basename%.*}" | |
| extension="${basename##*.}" | |
| ffmpeg -i $1 -codec:v copy -af pan="mono: c0=FL" $filename-mono.$extension | |
| } |
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
| /** | |
| * Programmatically logs a user in | |
| * | |
| * @param string $username | |
| * @return bool True if the login was successful; false if it wasn't | |
| */ | |
| function programmatic_login( $username ) { | |
| if ( is_user_logged_in() ) { | |
| wp_logout(); |
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
| // ⚠️ I have not verified that this is secure; I just cleaned it up to try it out. | |
| // Use at your own risk. I ended up using https://www.npmjs.com/package/@automattic/generate-password instead. | |
| /** | |
| * Generate a cryptographically secure random password in the browser. | |
| * | |
| * This is a modified version of https://stackoverflow.com/a/43020177/450127 that aims to | |
| * to improve readability, and increase the length and character pool. The results should be | |
| * the same as the original. |
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 | |
| /* | |
| * Generate a CSV for InDesign with attendee info and Gravatars | |
| * | |
| * See http://plan.wordcamp.org/helpful-documents-and-templates/create-wordcamp-badges-with-gravatars/ for instructions | |
| * | |
| * input is a CSV export of CampTix attendees. Format is: "First Name","Last Name","E-mail Address","Twitter Username" | |
| * the script downloads the attendee's Gravatars, and adds a column to the CSV with the filename of the image | |
| * the CSV can then be used by InDesign to generate wordcamp badges with the attendee's gravatar |
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 | |
| /** | |
| * Create symlinks for shared directories and files. | |
| * | |
| * This is a copy of the default `deploy:shared` task, but modified to create relative symlinks. See | |
| * `deploy:symlink` for details. | |
| */ | |
| task( 'deploy:shared', function() { | |
| $sharedPath = "{{deploy_path}}/shared"; |
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 | |
| /** | |
| * Log REST API errors | |
| * | |
| * @param WP_REST_Response $result Result that will be sent to the client. | |
| * @param WP_REST_Server $server The API server instance. | |
| * @param WP_REST_Request $request The request used to generate the response. | |
| */ | |
| function log_rest_api_errors( $result, $server, $request ) { |
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
| /** | |
| * Configure PHPMailer to send via PHP's mail() | |
| * | |
| * @param PHPMailer $phpmailer | |
| */ | |
| function phpmailer_send_via_mail( $phpmailer ) { | |
| $phpmailer->IsMail(); | |
| } | |
| add_action( 'phpmailer_init', 'phpmailer_send_via_mail', 999 ); |
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 | |
| // type "error" into the city name field to simulate an HTTP request error | |
| function nearbywp_trigger_error( $request, $request_args, $request_url ) { | |
| $url_params = explode( '&', parse_url( $request_url, PHP_URL_QUERY ) ); | |
| if ( in_array( 'location=error', $url_params ) ) { | |
| $request = new WP_Error( 'test', 'testing error condition' ); | |
| } |
NewerOlder