Skip to content

Instantly share code, notes, and snippets.

View mingodev's full-sized avatar

Simon Domingue mingodev

  • Cook It
  • Montréal, QC, Canada
View GitHub Profile
@mingodev
mingodev / configuration.default.nix
Last active September 3, 2024 22:26
NixOS configuration for PC
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
add_filter('posts_orderby', function($order){
return "DATE(mt1.meta_value) DESC";
});
add_filter('posts_join_paged', function ($join) {
return "LEFT JOIN wpp1_postmeta ON ( wpp1_posts.ID = wpp1_postmeta.post_id AND wpp1_postmeta.meta_key = 'Date de l\'événement')";
});
@mingodev
mingodev / footer.tpl
Last active March 19, 2020 17:23
Opencart popup
@mingodev
mingodev / functions.php
Last active January 21, 2020 20:21
Remove recaptcha from most pages
<?php
//Remove Google ReCaptcha code/badge everywhere apart from select pages
add_action('wp_print_scripts', function () {
//Add pages you want to allow to array
if ( !is_page( array( 'slugs-go-here' ) ) ){
wp_dequeue_script( 'google-recaptcha' );
//wp_dequeue_script( 'google-invisible-recaptcha' );
}
});
@mingodev
mingodev / functions.php
Created January 3, 2020 22:03
Hard-coded custom traductions in WP (for when WPML isn't enough)
<?php
// Custom translations
add_action('wp_enqueue_scripts', function(){
wp_enqueue_script('translations-js', get_stylesheet_directory_uri() . '/assets/js/translations.js');
});
?>
@mingodev
mingodev / calendar-fix.js
Created December 18, 2019 16:58
Add start date to end date minimum in date input (Contact Form 7)
var medieval = medieval || {};
var start; var end;
medieval.calendarFix = function ($) {
"use strict";
let initialize = function () {
start = jQuery('input.date-start').first();
@mingodev
mingodev / gist:8496f799be421610455f47016c12e81e
Created October 7, 2019 18:07
Add category count to category menu items in Wordpress.
// Short code pour le nombre d'items dans une catégorie
add_shortcode('categoryCount', 'nbProductsCategoryShortcode');
function nbProductsCategoryShortcode ($attributes = []) {
global $wpdb;
$attributes = shortcode_atts([
'category' => null,
], $attributes);
$category = $attributes['category'];
#Force https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,NE]
@mingodev
mingodev / CSV report
Created August 23, 2019 14:22
Créer un rapport CSV vite fait
<?php
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=rapport.csv');
ob_start();
$dbHostName = '';
$dbDatabase = '';
$dbUsername = '';
$dbPassword = '';