Skip to content

Instantly share code, notes, and snippets.

View jfarsen's full-sized avatar
🏠
Working from home

Jean-Francois Arseneault jfarsen

🏠
Working from home
View GitHub Profile
@jfarsen
jfarsen / entente-de-services-web.md
Created August 29, 2018 03:54
Exemple de contrat pour services de développement web, validé par un avocat selon les lois du Québec (2015)

INTERVENUE

ENTRE :

compagnie_nom, société légalement constituée, faisant affaires sous la raison sociale compagnie_raison-sociale, ayant son siège social au compagnie_adresse, ici représentée par propriétaire_nom, son président, dûment autorisé tel qu’il le déclare.

(ci-après désignée « Nous »)

ET :

@jfarsen
jfarsen / functions.php
Created August 9, 2017 01:41
Remove WooCommerce related products
<?php
/*
* wc_remove_related_products
*
* Clear the query arguments for related products so none show.
* Add this code to your theme functions.php file.
*/
function wc_remove_related_products( $args ) {
return array();
@jfarsen
jfarsen / functions.php
Created August 9, 2017 01:41
Add bcc email on WooCommerce notifications
<?php
/*
* ajouter une autre adresse email sur les commandes et factures
* source : http://stackoverflow.com/questions/19810625/additional-recipients-on-woocommerce-invoice/21350340
*/
add_filter( 'woocommerce_email_headers', 'add_bcc_to_wc_admin_new_order', 10, 3 );
function add_bcc_to_wc_admin_new_order( $headers = '', $id = '', $wc_email = array() ) {
if ( $id == 'new_order' ) {
@jfarsen
jfarsen / functions.php
Created August 9, 2017 01:41
Define a default province at WooCommerce checkout
<?php
/**
* Manipulate default state and countries
*/
add_filter( 'default_checkout_state', 'change_default_checkout_state' );
function change_default_checkout_state() {
return 'QC'; // state code
}
@jfarsen
jfarsen / functions.php
Created August 9, 2017 01:40
Increase the number of products displayed in WooCommerce
<?php
/* Display 250 products per page. Goes in functions.php */
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 250;' ), 20 );
@jfarsen
jfarsen / functions.php
Created August 9, 2017 01:39
Add a custom notice before the payment on the WooCommerce checkout
<?php
/**
* Add add a notice before the payment form
* Source : https://github.com/woothemes/woocommerce/blob/master/templates/checkout/review-order.php
*/
add_action( 'woocommerce_review_order_before_payment', 'arscons_before_paying_notice' );
function arscons_before_paying_notice() {
wc_print_notice( __( 'some custom message', 'woocommerce' ), 'notice' );
}
@jfarsen
jfarsen / functions.php
Created August 9, 2017 01:38
Check WooCommerce Terms & Conditions by default on checkout
<?php
/**
* checkmark on terms and conditions by default
*/
function arscons_wc_terms( $terms_is_checked ) {
return true;
}
add_filter( 'woocommerce_terms_is_checked_default', 'arscons_wc_terms', 10 );
@jfarsen
jfarsen / functions.php
Created August 9, 2017 01:37
Remove Divi shortcodes from content
<?php
/**
* Remove Divi shortcodes from content
*
* @see http://victorfont.com/remove-divi-shortcodes-changing-themes/
*/
function remove_divi_shortcodes( $content ) {
$content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);
return $content;
@jfarsen
jfarsen / style.css
Created August 9, 2017 01:37
Aligning buttons to the bottom of a row in Beaver Builder
/*
** Media Query - 768px or greater
* @url http://forum.wpbeaverbuilder.com/support/q/aligning-buttons-to-the-bottom-in-a-row-of-callout-modules/
----------------------------------------------------------- */
@media (min-width: 768px) {
.calloutrow .fl-button { /* Add 'calloutrow' class to the row */
position: absolute;
bottom: 0;
margin-bottom: 20px;
@jfarsen
jfarsen / gist:5844dc7880b235f32d60c8d4edc4a34c
Created August 9, 2017 01:36
/bin/tar: Argument list too long
@url https://major.io/2007/07/05/bintar-argument-list-too-long/
If you find yourself stuck with over 30,000 files in a directory (text files in this example), packing them into a tar file can be tricky. You can get around it with this:
find . -name '*.txt' -print >/tmp/test.manifest
tar -cvzf textfiles.tar.gz --files-from /tmp/test.manifest
find . -name '*.txt' | xargs rm -v