View gist:3718a4f20762640457ae28a6d47d5341
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 proto = Element.prototype; | |
var slice = Function.call.bind(Array.prototype.slice); | |
var matches = Function.call.bind(proto.matchesSelector || | |
proto.mozMatchesSelector || proto.webkitMatchesSelector || | |
proto.msMatchesSelector || proto.oMatchesSelector); | |
// Returns true if a DOM Element matches a cssRule | |
var elementMatchCSSRule = function(element, cssRule) { | |
return matches(element, cssRule.selectorText); | |
}; |
View nginx-wordpress.conf
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
############ WordPress #################### | |
# Disable logging for favicon and robots.txt | |
location = /favicon.ico { | |
try_files /favicon.ico @empty; | |
access_log off; | |
log_not_found off; | |
expires max; | |
} |
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
global $wp_styles; | |
$styles = ( new Arrayy( $wp_styles->registered ) ) | |
->map( function ( $style ) { | |
return [ | |
'src' => $style->src, | |
'handle' => $style->handle, | |
]; | |
} ) | |
->toArray(); |
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
add_action( 'wp', function () { | |
if ( ! isset( $_GET['test-add-product-categories-fr'] ) ) { | |
return; | |
} | |
$categories = [ | |
'Climatiseur' => [ | |
'args' => [ | |
'parent' => 0, | |
], |
View install.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
sudo apt update | |
sudo add-apt-repository ppa:certbot/certbot | |
sudo apt install python-certbot-nginx | |
sudo certbot --nginx -d example.com | |
sudo certbot renew --dry-run | |
View index.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
add_action( 'wp_enqueue_scripts', function() { | |
$wp_upload_dir = wp_upload_dir(); | |
$base_url = $wp_upload_dir['baseurl']; | |
$base_dir = $wp_upload_dir['basedir']; | |
wp_enqueue_style( | |
'howlife-style', | |
sprintf( '%s/howlife/css/main.css', $base_url ), | |
[], | |
filemtime( sprintf( '%s/howlife/css/main.css', $base_dir ) ) |
View index.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
add_action( 'wp', function () { | |
$posts = get_posts( | |
[ | |
'post_type' => 'post', | |
'lang' => '', | |
'paged' => 1, | |
'posts_per_page' => - 1, | |
] | |
); |
View index.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
add_action( 'wp_enqueue_scripts', function() { | |
$wp_upload_dir = wp_upload_dir(); | |
$base_url = $wp_upload_dir['baseurl']; | |
$base_dir = $wp_upload_dir['basedir']; | |
wp_enqueue_style( | |
'howlife-style', | |
sprintf( '%s/howlife/css/main.css', $base_url ), | |
[], | |
filemtime( sprintf( '%s/howlife/css/main.css', $base_dir ) ) |
View resize.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
window.resize = (function () { | |
'use strict'; | |
function Resize() {} | |
Resize.prototype = { | |
init: function(outputQuality) { | |
this.outputQuality = (outputQuality === 'undefined' ? 0.8 : outputQuality); | |
}, |
View plugin-template-part.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
$plugin_path = plugin_dir_path( __DIR__ ); | |
$template_path = sprintf( '%stemplate-parts/header/navbar-primary.php', $plugin_path ); | |
include $template_path; |
NewerOlder