Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Antoinebr's full-sized avatar
:octocat:
🔥

Antoinebr

:octocat:
🔥
View GitHub Profile
@Antoinebr
Antoinebr / varnish
Last active August 29, 2015 14:15 — forked from reifman/varnish
# Configuration file for varnish
#
# /etc/init.d/varnish expects the variables $DAEMON_OPTS, $NFILES and $MEMLOCK
# to be set from this shell script fragment.
#
# Should we start varnishd at boot? Set to "no" to disable.
START=yes
# Maximum number of open files (for ulimit -n)
@Antoinebr
Antoinebr / default.vcl
Last active August 29, 2015 14:15 — forked from reifman/default.vcl
# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 60s;
.first_byte_timeout = 60s;
.between_bytes_timeout = 60s;
.max_connections = 800;
}
@Antoinebr
Antoinebr / default.vcl
Created February 20, 2015 20:51
Varnish WordPress VCL V2
# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 60s;
.first_byte_timeout = 60s;
.between_bytes_timeout = 60s;
.max_connections = 800;
}
@Antoinebr
Antoinebr / README.md
Last active August 29, 2015 14:15 — forked from hofmannsven/README.md
@Antoinebr
Antoinebr / antoine-config.rb
Last active August 29, 2015 14:15 — forked from nathansmith/config.rb
Fichier de configuration Compass
require 'compass/import-once/activate'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "/" # pour un otpout à la racine du projet
sass_dir = "sass" # pour un input dans le dossier sass
relative_assets = true # pour éviter les prb avec les sprites
images_dir = "images" # le nom du fichier image
javascripts_dir = "javascripts"

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@Antoinebr
Antoinebr / gist:267e098ae62251b837c2
Last active October 18, 2015 11:37
WooCommerce product Gift
<?php
function promo_product($productPromoID,$minItemBuy,$minPriceBuy){
$productPromo = get_product($productPromoID);
// On vérifie si le produit à ofrir est en stock
if($productPromo->stock == 0 || $productPromo->stock < 0){
define('PROMO', false);return false;
}else{
define('PROMO', true);
@Antoinebr
Antoinebr / gist:845f8c55a3c8451cf698
Last active October 18, 2015 11:39
Appel de la fonction promo WC
<?php
promo_product(get_field('gift-Product-ID','option'),2,18);
?>
zip -r mes-logs.zip other_vhosts_access.log*
<?php
global $woocommerce;
$args = array(
'post_type' => 'shop_order',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'shop_order_status',