Skip to content

Instantly share code, notes, and snippets.

<?php
setlocale(LC_ALL, 'fr_FR') or die('Locale not installed');
//setlocale(LC_ALL, 'en_EN') or die('Locale not installed');
?>
<h2>Q1</h2>
<?php echo strftime('%A %d %B %Y'); ?>
<hr />
<?php echo strftime('%d/%m/%Y %I:%M:%S'); ?>
<hr />
<?php echo time(); ?>
@cladjidane
cladjidane / app.css
Created January 25, 2022 10:56
[CSS] Animation avec tailwind, rellax et css
#polaroid-1 .polaroid-img {
/*
Astuce sur le cacl, il semblerait qu'il faile mutliplier par 1deg pour obtenir une valeur de varaiable en degré
Curiseuement, ça ne marche pas avec un + ou -, peut-être que le calcul en deg se fait sur 0 à 360 uniquement
*/
--r: calc(calc(var(--visible-y) * 100 * 20 / 100) * 1deg); /* fait une rotation de 180 max */
transform: rotate(var(--r));
}
/*
@cladjidane
cladjidane / README.md
Created June 14, 2021 09:19 — forked from premitheme/README.md
Recover MAMP MySQL database using .frm and .ibd files after InnoDB crash

Recover MAMP MySQL database using .frm and .ibd files after InnoDB crash

After a power faliur (also can be a sudden restart or system crash), I ended up with corrupted database and lost the access to my local hosted websites for development. Even the MAMP's MySQL server was not starting.

Preparation

You will need to find the databases folders, in case of MAMP they are located in Applications/MAMP/db/mysql56 (or mysql57 depending on MySQL version).

You will find folders containing the database name, inside them you will find .frm and .ibd files. Take a copy of the entire folder for backup in another place, the desktop for example.

@cladjidane
cladjidane / [DIVI] galerie-to-accordion-divi.js
Last active June 10, 2021 06:51
Galerie dans accordion DIVI
/**
* On court circuite le listener de Divi et on ajoute le nôtre
* ici on fait juste un refresh du dom pour que la galerie fonctionne correctement
*
*/
$(document).off('click', '.et_pb_toggle_title').on('click', '.et_pb_toggle_title', function() {
jQuery(window).resize();
});
@cladjidane
cladjidane / child-theme-functions-php.php
Created February 19, 2021 09:10 — forked from lots0logs/child-theme-functions-php.php
WordPress :: Divi Builder :: Post Slider :: Display projects instead of posts.
<?php
/* DON'T copy the first line (above) if your functions.php already has it.
* ---------------------------------------------------------------------- */
function my_et_theme_setup() {
if ( class_exists( 'ET_Builder_Module_Post_Slider' ) ) {
get_template_part( 'my-main-modules' );
add_filter( 'my_et_post_slider_args', 'my_et_post_slider_args_cb' );
$et_pb_post_slider = new My_ET_Builder_Module_Post_Slider();
remove_shortcode('et_pb_post_slider');
@cladjidane
cladjidane / connectHTMLelements_SVG.png
Created September 22, 2020 08:24 — forked from alojzije/connectHTMLelements_SVG.png
Connect two elements / draw a path between two elements with SVG path (using jQuery)
connectHTMLelements_SVG.png
<?php
/**
* Méthodes pour personnaliser l'admin profil d'un user
*/
// Suppression des différentes infos - voir les commentaires par ligne
if ( ! function_exists( 'k_remove_personal_options' ) ) {
function k_remove_personal_options( $subject ) {
$user = wp_get_current_user();
if ( !in_array('editor', $user->roles) ) {
/* Permet de filtrer les features d'un layer pour affecter leur parametres */
/* Il est possible avec ça de masquer que les feature.properties.cat = "cat1" */
// https://stackoverflow.com/questions/59181258/how-to-use-mapbox-expressions-to-toggle-layer-class-styles/59185488#59185488
map.setLayoutProperty("points", "icon-image", [
"match", // Si match
["get", "id"], // properties.id
e.features[0].properties.id, // est égal à une variable passée, ici via un click sur une feature
"hu-motorway-2", // On défini l'option "Icon Image" avec cette valeur
"hu-main-2", // Si non on utilise celle là
@cladjidane
cladjidane / [MAP] SnapToRoad - Mapbox
Last active June 10, 2021 06:53
Snap point to roads
/**
* Snap point (coords param) to roads
* The roads depend on the style of the map
* @param {Object Mapbox} map
* @param {Object feature.geometry.coordinates} coords
*/
const snapToRoad = (map, coords) => {
// Coordinate to point conversion
let currentPoint = turf.point([coords.lng, coords.lat]);
// Here we're only retrieving the road layers