View convert-images-webp.sh
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 | |
# converting JPEG images | |
find $1 -type f -and \( -iname "*.jpg" -o -iname "*.jpeg" \) \ | |
-exec bash -c ' | |
webp_path=$(sed 's/\.[^.]*$/.webp/' <<< "$0"); | |
if [ ! -f "$webp_path" ]; then | |
cwebp -quiet -q 90 "$0" -o "$webp_path"; | |
fi;' {} \; |
View generate-blocks-template-part-css.php
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('generateblocks_do_content', function ($content) { | |
$part = 'page-header'; | |
$template_part = get_block_template(get_stylesheet() . '//' . $part, 'wp_template_part'); | |
if ($extra = $template_part->content) { | |
$content = $extra . $content; | |
} |
View iswp.sh
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 | |
if [[ "$(curl -L -s $1/license.txt | grep -coF WordPress)" -gt 0 ]]; then | |
echo "Is WordPress" | |
else | |
echo "Is NOT WordPress" | |
fi |
View nyt-paywall-bypass.js
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
var w = window.open("Article", "blank"); var content = Array.prototype.map.call(document.querySelectorAll('.StoryBodyCompanionColumn'), ( el ) => `<p>${el.textContent}</p>` ).join(''); w.document.write(`<link rel="stylesheet" href="https://unpkg.com/tailwindcss@1.4.6/dist/base.min.css"><link rel="stylesheet" href="https://unpkg.com/tailwindcss@1.4.6/dist/components.min.css"><link rel="stylesheet" href="https://unpkg.com/@tailwindcss/typography@0.1.2/dist/typography.min.css"><link rel="stylesheet" href="https://unpkg.com/tailwindcss@1.4.6/dist/utilities.min.css"><body class="prose mx-auto my-20">${content}</body>`); w.document.close(); |
View data-tabs.js
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
function chooseTab( tabEl ) { | |
const activeClasses = tabEl.getAttribute('data-tab-active-class').split(" "); | |
const name = tabEl.getAttribute('data-tab'); | |
const tabGroup = tabEl.closest('[data-tabs]'); | |
tabGroup.querySelectorAll('[data-tab]').forEach(el => | |
el == tabEl ? el.classList.add(...activeClasses) : el.classList.remove(...activeClasses) | |
) | |
tabGroup.querySelectorAll('[data-tab-name]').forEach(el => |
View featured-image.php
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 featuredImageSrc( $post = null, $size = 'featured' ) { | |
if( is_null($post) ) { | |
global $post; | |
} | |
return get_the_post_thumbnail_url( $post, $size ); | |
} |
View Shortcodes.php
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 | |
namespace App; | |
class Shortcodes { | |
protected $shortcodes = []; | |
public function __construct() | |
{ |
View functions.php
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 | |
/** | |
* Filter a few parameters into YouTube oEmbed requests | |
* | |
* @link http://goo.gl/yl5D3 | |
*/ | |
function iweb_modest_youtube_player( $html, $url, $args ) { | |
return str_replace( '?feature=oembed', '?feature=oembed&modestbranding=1&showinfo=0&rel=0', $html ); | |
} | |
add_filter( 'oembed_result', 'iweb_modest_youtube_player', 10, 3 ); |
View autosubmit.js
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
$("[data-autosubmit]").on('change', function(){ | |
$(this).parents("form").submit(); | |
}); |
View get-filtering.php
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 | |
/** | |
* Allow filtering of index/archives by GET | |
* Example) Adding ?sort=-date will sort posts descending by date. | |
* Possible Values: https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters | |
*/ | |
add_action('pre_get_posts', function ($query) { | |
if( $query->is_main_query() ) { | |
$sort = "relevance"; | |
$order = "DESC"; |
NewerOlder