Skip to content

Instantly share code, notes, and snippets.

View jbma's full-sized avatar

Jean-Baptiste Marchand-Arvier jbma

View GitHub Profile
<?php
defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
/*
Plugin Name: Add all images to CDN
Author: Jonathan (WP Rocket Team)
Author URI: http://wp-rocket.me
*/
add_filter( 'rocket_buffer', 'rocket_cdn_images', PHP_INT_MAX );
<?php
add_action( 'admin_init', 'remove_rocket_plugin_notice' );
function remove_rocket_plugin_notice() {
remove_action( 'admin_notices', 'rocket_warning_plugin_modification' );
}
<?php
function zarza_custom_clear_cache(){
$ch = curl_init("https://192.198.89.58");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PURGE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$output = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
<?php
if isset( $_COOKIE[ 'wordpress_logged_in_'] ){
define ('DONOTCACHEPAGE', true);
}
<?php
if isset( $_COOKIE[ 'wordpress_logged_in_'] ){
define ('WAEST_SSO_HASH', true);
}
<?php
if (isset( $_COOKIE[ 'WAEST_SSO_HASH'] ) ){
define ('DONOTCACHEPAGE', true);
}
import serial, httplib, uuid
arduino = serial.Serial('/dev/ttyACM0', 9600)
while True:
data = arduino.readline()
print data
#conn = httplib.HTTPConnection("ronan-chardonneau.fr")
print "/piwik/piwik.php?idsite=1&rec=1&action_name=Entree-magasin&uid="+str(uuid.uuid4())+"&e_c=entree-magasin&e_a=passage&e_n=taille&e_v="+str(data)
#conn.request("HEAD","/piwik/piwik.php?idsite=1&rec=1&action_name=Entree-magasin&uid="+str(uuid.uuid4())+"&e_c=entree-magasin&e_a=passage&e_n=taille&e_v="+str(data))
#print conn.request
<?php
/**
* Proper way to enqueue scripts and styles
*/
function __rocket_theme_scripts_to_enqueue() {
wp_enqueue_script( 'pkgd', get_stylesheet_directory_uri() . '/js/masonry.pkgd.min.js', array(), '1.0.0', false );
wp_enqueue_script( 'flexslider', get_stylesheet_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), '1.0.0', false );
wp_enqueue_script( 'main', get_stylesheet_directory_uri() . '/js/main.js', array(), '1.0.0', false );
Exercice #1
- Create 3 books associated arrays which sould contains : the name of the book, the author, and a rating (1,2,3,4 or 5)
- Create a $books array wich contains your 3 books
- Display the name of all the books
<?php
add_action( 'wp_rocket_loaded', 'no_purge' );
function no_purge() {
remove_action( 'user_register' , 'rocket_clean_domain', 10 );
remove_action( 'profile_update' , 'rocket_clean_domain' );
etc...
}