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: Root-based Category URLs | |
* Description: Enables root-based Category URLs, i.e. Makes /category/my-category/ URLs route as /my-category/ | |
* Author: Mike Schinkel | |
* Author URI: http://about.me/mikeschinkel | |
* Plugin URI: https://gist.github.com/1421235 | |
* Version: 0.1.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
function verify_sitemap_urls() { | |
if [ -z "$1" ]; then | |
echo "Usage: check_sitemap [file_path/url] (new_domain)" | |
echo "If no new domain passed it will use the url from sitemap; if domain is passed then it will replace the domain in sitemap url with same path." | |
return | |
fi | |
if [[ "$1" == *"http"* ]]; then | |
TEMPFILE=$(mktemp) | |
# Download the sitemap file from the given 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 | |
// Return zero updates and current time as last checked time | |
function __disable_wp_updates() { | |
include ABSPATH . WPINC . '/version.php'; | |
return (object) array( | |
'updates' => array(), | |
'version_checked' => $wp_version, | |
'last_checked' => time(), | |
); |
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
addEventListener("fetch", event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
const hiddenImageOrigin = "s3 url without trailing shash" | |
const requestURL = new URL(request.url) | |
// Append the request path such as "/assets/image1.jpg" to the hiddenImageOrigin. | |
// You could also process the path to add or remove directories, modify filenames, etc. | |
const imageURL = hiddenImageOrigin + requestURL.pathname; |
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 utkarsh; | |
/** | |
* Restore customizer which is removed by WP Core. | |
*/ | |
function restore_customizer() { | |
// WP version is 5.9 beta or later than only add customize.php back. | |
if ( ! version_compare( get_bloginfo( 'version' ), '5.9-beta', '>=' ) ) { | |
return; |
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 utkarsh; | |
add_action( 'wp_enqueue_media', __NAMESPACE__ . '\\media_filter' ); | |
/** | |
* Add media filter script. | |
*/ |
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
.site__navigation .tab-bar .mdc-tab .material-icons { | |
color: var(--mdc-theme-on-header, var(--mdc-theme-on-primary, #fff)); | |
} |
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
Host dockerServer | |
Hostname server-host-or-ip | |
User ssh-remote-user | |
LocalForward 8088 localhost:8088 | |
LocalForward 3306 localhost:3306 | |
ServerAliveInterval 10 |
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 Utkarsh\acf; | |
/** | |
* Exclude current post from ACF filter. | |
* Add param include_current_post => true in ACF field if you need include current post. Defaults to exclude. | |
* | |
* @param array $args WP_Query args. | |
* @param array $field ACF field params. | |
* @param int $post_id current post id. |
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
#!/bin/bash | |
# Usage ./temperature_cron.sh $HOME/pi-temp-log | |
timestamp=`date +%F` | |
temp=`/opt/vc/bin/vcgencmd measure_temp` | |
temp=${temp:5:16} | |
mkdir -p $1 # make sure dir exists | |
echo "$(date +%H:%M:%S) = $temp" >> $1/temperature_log_$timestamp.txt # create new file for each day. |