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 | |
add_action( 'muplugins_loaded', function() { | |
if ( defined( 'WP_CLI' ) && WP_CLI ) { | |
return; | |
} | |
if ( empty( $_SERVER['HTTP_HOST'] ) ) { | |
return; | |
} | |
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
# In the main {} context | |
map $http_user_agent $imgproxy { | |
"~imgproxy" 1; | |
default 0; | |
} | |
map $http_accept $webp_suffix { | |
"~image/webp" "@webp"; | |
default ""; |
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
# Inside the server {} block | |
location @imgproxy { | |
proxy_ssl_server_name on; | |
proxy_ssl_name imgproxy.ondigitalocean.app; | |
proxy_set_header Host imgproxy.ondigitalocean.app; | |
proxy_set_header If-Modified-Since ""; | |
proxy_set_header ETag ""; | |
proxy_set_header Cache-Control ""; |
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 | |
/** | |
* Pressjitsu Remote HTTP Cache | |
* | |
* Many plugins like to perform remote HTTP requests for front-end visits, | |
* sometimes without even employing transient caching. We think that *all* HTTP | |
* requests should run in the background, and thus be always served from cache, | |
* even if the cache is stale. | |
* | |
* Configure cachable hosts via the pj_http_cache_hosts filter. |
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
#!/bin/bash | |
FILES=`sail diff --raw | grep \.php$` | |
ROOT="$(dirname `dirname $0`)" | |
EXIST='' | |
for FILE in $FILES | |
do | |
if [ -f "$ROOT/$FILE" ]; then | |
EXIST="$EXIST $ROOT/$FILE" | |
fi |
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
name: deploy | |
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest |
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
#!/bin/bash | |
while fuser /var/{lib/{dpkg,apt/lists},cache/apt/archives}/lock >/dev/null 2>&1 ; do | |
sleep 0.5 | |
done | |
/usr/bin/apt-get "$@" |
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 | |
add_filter( 'map_meta_cap', function( $caps, $cap ) { | |
if ( $cap == 'edit_my_plugin_options' ) { | |
$c = is_multisite() ? 'manage_site_options' : 'manage_options'; | |
$caps = array( $c ); | |
} | |
return $caps; | |
}, 10, 2 ); | |
if ( current_user_can( 'edit_my_plugin_options' ) ) { ... } |
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 | |
/** | |
* Get subscribers count via the MailChimp API. | |
*/ | |
function mailchimp_get_subscribers_count() { | |
$cache_key = 'mailchimp-subscribers'; | |
$api_key = ''; | |
$username = ''; | |
$dc = ''; | |
$list_id = ''; |
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 | |
function __array_append( $item ) { | |
return function( $array ) use ( $item ) { | |
$array[] = $item; | |
return $array; | |
}; | |
} | |
function __array_set( $key, $value ) { | |
return function( $array ) use ( $key, $value ) { |
NewerOlder