Skip to content

Instantly share code, notes, and snippets.

View lmeyer's full-sized avatar
🍷
Working full-time for @winesitting

Ludovic Meyer lmeyer

🍷
Working full-time for @winesitting
View GitHub Profile
@lmeyer
lmeyer / instructions.md
Last active January 9, 2023 10:40
PHPStorm config

Go to File > Settings

Build, Execution, Deployement > Docker > New Docker Windows

PHP > Add interpreter > New > Docker compose > php
PHP > Quality Tools > PHP CS Fixer > New > Choose php > vendor/bin/php-cs-fixer (inspection checked + risky rules checked + Custom ruleset)
PHP > Quality Tools > Psalm > New > Choose php > vendor/bin/psalm
Languages and frameworks > Node.js > Node interpreter : Ubuntu
Languages and frameworks > Javascript > Code quality tools > ESLint > automatic ESLint config + run for files {**/*,*}.{js,ts,jsx,tsx,html,vue} + Run fix on save
Languages and frameworks > Style sheets > StyleLint > Choose stylelint in WSL + run for files {**/*,*}.{css,scss}

@lmeyer
lmeyer / docker-compose.yml
Created January 24, 2022 15:18
Traefik config
version: '3'
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.5
restart: always
ports:
# The HTTP port
- "80:80"
@lmeyer
lmeyer / utils.php
Created April 9, 2019 14:28
VC Autocomplete with multiple ajax sources
<?php
add_filter( 'vc_autocomplete_hdco_featured_featureds_callback', 'get_hdco_autocomplete_featureds', 10, 1 );
function get_hdco_autocomplete_featureds($query) {
$query = sanitize_text_field($query);
$items_array = [];
$args = array(
"post_type" => "post",
"s" => $query
background: linear-gradient(45deg,#f5a04b,#d82873);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: inline-block;
@lmeyer
lmeyer / gist:bdae4a8a8242349afb5aa23f418082a0
Created December 28, 2017 00:22
Protect gravityforms uploads
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$
RewriteRule ^app/uploads/gravity_forms/(.*)$ /index.php [NC,R=401,L]
@lmeyer
lmeyer / main.sh
Last active July 22, 2017 10:40
Magento 2 commands
php bin/magento module:status
php bin/magento module:enable Hdco_CatalogSearch
php bin/magento setup:upgrade
php bin/magento setup:di:compile
find pub/static -name js-translation.json -exec rm -rf {} \;
php bin/magento setup:static-content:deploy en_US fr_FR
php bin/magento cache:clean
php bin/magento indexer:reindex
@lmeyer
lmeyer / functions.php
Created January 28, 2017 12:07
Usage of woocommerce_appointments_time_slots_html filter (display left spaces when no booking)
<?php
add_filter('woocommerce_appointments_time_slots_html', 'idl_woocommerce_appointments_time_slots_html', 10, 8);
function idl_woocommerce_appointments_time_slots_html($slot_html, $slots, $intervals, $time_to_check, $staff_id, $from, $timezone, $appointment) {
if ( empty( $intervals ) ) {
$default_interval = 'hour' === $appointment->get_duration_unit() ? $appointment->get_duration() * 60 : $appointment->get_duration();
$custom_interval = 'hour' === $appointment->get_duration_unit() ? $appointment->get_duration() * 60 : $appointment->get_duration();
if ( $appointment->get_interval_unit() && $appointment->get_interval() ) {
$custom_interval = 'hour' === $appointment->get_interval_unit() ? $appointment->get_interval() * 60 : $appointment->get_interval();
}
@lmeyer
lmeyer / main.scss
Created October 25, 2016 10:22
Responsive margins and paddings sass mixin
// Sizes
$margin-none: 0;
$margin-sm: 5;
$margin-base: 15;
$margin-lg: 30;
$margin-xl: 50;
$margin-xxl: 100;
$padding-xxl: 100;
@lmeyer
lmeyer / hdco_set_post_metabox_field.php
Last active October 14, 2016 15:21
Connect Gravity Forms upload field to a Metabox image field
<?php
$gravity_form_id = 1; // gravity form id, or replace {$gravity_form_id} below with this number
add_filter( "gform_after_submission_{$gravity_form_id}", 'hdco_set_post_metabox_field', 10, 2 );
function hdco_set_post_metabox_field( $entry, $form ) {
$gf_images_field_id = 18; // the upload field id
$metabox_field_id = 'images_gallery'; // the metabox field id
if( isset( $entry['post_id'] ) ) {
$post = get_post( $entry['post_id'] );
@lmeyer
lmeyer / gist:f506a67462bf7614877a205db431bd55
Created October 13, 2016 16:21
Make WP Super Cache works with Bedrock
define( 'WP_CACHE', true );
define( 'WPCACHEHOME', $webroot_dir . '/app/plugins/wp-super-cache/');