Skip to content

Instantly share code, notes, and snippets.

View seb86's full-sized avatar
🚀

Sébastien Dumont seb86

🚀
View GitHub Profile
@seb86
seb86 / jquery-scroll-bottom.js
Created April 23, 2018 22:36 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
@seb86
seb86 / gist:a5446e0608e79e66b42b569cdcad9925
Created August 21, 2017 13:42 — forked from woogist/gist:5692886
Sample WooCommerce Points & Rewards 3rd Party Plugin Integration
<?php
// Add the action setting
add_filter( 'wc_points_rewards_action_settings', 'points_rewards_newsletter_action_settings' );
function points_rewards_newsletter_action_settings( $settings ) {
$settings[] = array(
'title' => __( 'Points earned for newsletter signup' ),
'desc_tip' => __( 'Enter the amount of points earned when a customer signs up for a newsletter via MailChimp.' ),
@seb86
seb86 / wp-install-core-sub-dir.sh
Created April 6, 2017 20:55 — forked from polevaultweb/wp-install-core-sub-dir.sh
This script installs WordPress inside a sub directory
#!/bin/bash
# Installation:
# Install the script in one of the folders in your PATH. Make sure it has execute permissions (i.e. chmod +x wp-install-core-sub-dir).
#Usage:
# $ mkdir mysite
# $ cd mysite
@seb86
seb86 / woocommerce_products_sold_single_product.php
Created May 17, 2016 18:14 — forked from kloon/woocommerce_products_sold_single_product.php
WooCommerce display number of products sold on single product page
<?php
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 );
function wc_product_sold_count() {
global $product;
$units_sold = get_post_meta( $product->id, 'total_sales', true );
echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>';
}
?>
<?
// <readme>
/*
This is a lite version of Olark's and Intercom's functionality (without the chat part).
It lets you get feedback from users on your site to your email.
And you won't have to rely on another company anymore!
#killyourdependencies
@seb86
seb86 / gist:1baa022ffa01be1d8f88
Created March 9, 2016 17:48 — forked from latheesan-k/gist:3490cb6ab522ca87f535
Parse git logs into array in PHP
<?php
// Change To Repo Directory
chdir("/full/path/to/repo");
// Load Last 10 Git Logs
$git_history = [];
$git_logs = [];
exec("git log -10", $git_logs);
<?php
/**
* Plugin Name: WooCommerce Email Customer Address
* Plugin URI: https://gist.github.com/BFTrick/7891074
* Description: Email the site admin when a customer changes their address
* Author: Patrick Rauland
* Author URI: http://patrickrauland.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
<?php
/**
* Plugin Name: WooCommerce Remove Billing Fields for Free Virtual Products
* Plugin URI: https://gist.github.com/BFTrick/7873168
* Description: Remove the billing address fields for free virtual orders
* Author: Patrick Rauland
* Author URI: http://patrickrauland.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
<?php
/**
* Plugin Name: WooCommerce Check Terms & Conditions
* Plugin URI: https://gist.github.com/BFTrick/7789974
* Description: Make the Terms & Conditions checkbox checked by default
* Author: Patrick Rauland
* Author URI: http://patrickrauland.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
<?php
function sumobi_edd_purchase_link_show_featured_image( $download_id ) {
echo get_the_post_thumbnail( $download_id, 'thumbnail' );
}
add_action( 'edd_purchase_link_top', 'sumobi_edd_purchase_link_show_featured_image' );