Skip to content

Instantly share code, notes, and snippets.

View jbma's full-sized avatar

Jean-Baptiste Marchand-Arvier jbma

View GitHub Profile
<?php
add_filter('rocket_htaccess_marker', '__return_false');
<?php
add_filter( 'wp', '__deactivate_rocket_lazyload_if_admin' );
function __deactivate_rocket_lazyload_if_admin()
{
if( is_admin() ) {
add_filter( 'do_rocket_lazyload', '__return_false' );
}
}
<?php
function clear_remote_wp( $ID, $post ) {
wp_remote_get('http://defimedia.info/custom-clear.php?id='.$ID);
}
add_action( 'publish_post', 'clear_remote_wp', 10, 2 );
<?php
require ('wp-load.php');
$id_post = esc_html($_GET['id_post']);
rocket_clean_post($id_post);
<?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...
}
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
/**
* 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 );
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
if (isset( $_COOKIE[ 'WAEST_SSO_HASH'] ) ){
define ('DONOTCACHEPAGE', true);
}
<?php
if isset( $_COOKIE[ 'wordpress_logged_in_'] ){
define ('WAEST_SSO_HASH', true);
}