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
Array.from(document.getElementsByClassName('attachment_download')).forEach(function(elem) { | |
setTimeout(() => { | |
elem.click(); | |
}, key * 2000 ) | |
}); |
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_filter( 'amp_extract_image_dimensions_batch', function ( $dimensions ) { | |
$home_url = get_home_url(); | |
foreach ( $dimensions as $url => &$data ) { | |
if ( false !== strpos( $url, $home_url ) ) { | |
$attachment_id = wpcom_vip_attachment_url_to_postid( $url ); | |
if ( false !== $attachment_id ) { | |
$src = wp_get_attachment_image_src( $attachment_id ); | |
$height = $src[1]; | |
$width = $src[2]; |
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
jQuery( document ).ready( function () { | |
// Refresh media library each time on click of add media. | |
if ( wp.media ) { | |
wp.media.view.Modal.prototype.on( 'open', function () { | |
if ( wp.media.frame.content.get() !== null ) { | |
// this forces a refresh of the content. | |
wp.media.frame.content.get().collection._requery( true ); | |
} | |
} ); | |
} |
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\Attachment\Meta; | |
const META_NAME = 'media_credit'; | |
/** | |
* Bootstrap. | |
*/ | |
function bootstrap() { |
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
no-resolv | |
proxy-dnssec | |
server=::1#5353 | |
server=127.0.0.1#5353 | |
listen-address=::1,127.0.0.1 | |
# Put any other line here like laravel valet using .test domain. | |
address=/.test/127.0.0.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
var anchors = document.querySelectorAll('a'); | |
var hosts = new Set(); | |
anchors.forEach((anch) => { | |
hosts.add(anch.hostname); | |
}); | |
console.table(Array.from(hosts)); |
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 | |
/** | |
* The Demo class. | |
* | |
* @package xyz | |
*/ | |
namespace UtkarshPatel\Demo | |
/** |
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
cask 'easyengine' do | |
version '4.0.0' | |
homepage 'https://easyengine.io/' | |
url 'https://github.com/EasyEngine/easyengine/releases/download/v4.0.0/easyengine.phar' | |
sha256 '5d7f7ec95911883240717458024f0e7c69309f7bd3646353a0594e1b0900eaa6' | |
name 'Easyengine' | |
depends_on formula: 'php' | |
depends_on cask: 'docker' | |
container type: :naked |
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 notifynet(){ | |
isdown=0 | |
echo "Pres CTRL+C to stop..." | |
while : | |
do | |
sleep 5 | |
if [ $(ping -q -c 1 -W 1 8.8.4.4 >/dev/null) ]; then | |
echo -n "1" | |
if [ $isdown -eq 1 ]; then | |
isdown=0 |
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 | |
/** | |
* Fix url when wp-content and mu-plugins are added as symlink. | |
*/ | |
add_filter( 'plugins_url', function ( $url ) { | |
// Replace wp-content absolute path. | |
if ( defined( 'WP_CONTENT_DIR' ) && is_link( WP_CONTENT_DIR ) ) { | |
$mu_content_dir_path = dirname( __DIR__ ); | |
$url = str_replace( 'plugins' . $mu_content_dir_path, '', $url ); | |
} |