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 | |
// 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' ); | |
} |
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
# 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 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. |
OlderNewer