Skip to content

Instantly share code, notes, and snippets.

View jeherve's full-sized avatar
🚀
👨‍🏭

Jeremy Herve jeherve

🚀
👨‍🏭
View GitHub Profile
@jeherve
jeherve / stats.md
Created February 21, 2017 17:37
Differences between different Stats plugins

The kStats Reloaded plugin hasn't been updated in the past 7 years, and offers few ways to exclude visits. It will consequently count a lot of bots, crawlers, and search engines.

WP Statistics is updated a lot more often, but since it relies on data included in the plugin itself, you can expect some bots to be included in the stats. You can find out more in the plugin's FAQ (see I'm using another statistics plugin/service and get different numbers for them, why?). It may also count your own visits.

Jetpack Stats, on the other hand, will exclude visits from logged in users by default. It also relies on the WordPress.com cloud to filter and exclude bots and other crawlers, and all calculatations happen on our servers so it won't affect your site's performance.

@jeherve
jeherve / jp_restrict_rp.php
Last active February 10, 2018 10:50 — forked from richardmtl/jp_restrict_rp.php
Restrict Jetpack's Related Posts to a specific time-frame
function jetpackme_related_posts_date_restricted( $date_range, $post_id ) {
// We can change this based on $post_id too but let's just filter everything
$date_range = array(
'from' => strtotime( '1 January 2013' ),
'to' => time(),
);
return $date_range;
}
add_filter( 'jetpack_relatedposts_filter_date_range', 'jetpackme_related_posts_date_restricted', 10, 2 );
<?php
/**
* Plugin Name: Force Deactivate Jetpack's Protect Module.
* Plugin URI: https://jetpack.com/support/security-features/#unblock
* Description: If you have lost access to your site's dashboard, you can use this plugin to deactivate the Protect module.
* Author: Automattic
* Version: 1.0.0
* Author URI: http://jetpack.com
* License: GPL2+
*
@jeherve
jeherve / install.sh
Last active January 22, 2021 20:44
Installing my favorite apps on a new machine https://jeremy.hu/homebrew-cask-automate-mac-install/
#!/bin/sh
echo Install all AppStore Apps at first!
# If you are looking into a solution to automate AppStore installs,
# check mas https://github.com/argon/mas
# I installed XCode, Simplenote, Clocks, Stuffit Expander, Cloudapp, Forklift.
read -p "Press any key to continue... " -n1 -s
echo '\n'
@jeherve
jeherve / output.bash
Created June 7, 2016 16:43
Photon image including a link to the original image https://i0.wp.com/jeremy.hu/wp-content/uploads/watson-5818.jpg
$ curl -I https://i0.wp.com/jeremy.hu/wp-content/uploads/watson-5818.jpg
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 07 Jun 2016 16:42:27 GMT
Content-Type: image/jpeg
Content-Length: 94394
Connection: keep-alive
Last-Modified: Tue, 07 Jun 2016 16:37:17 GMT
Expires: Fri, 08 Jun 2018 04:37:17 GMT
Cache-Control: public, max-age=63115200
@jeherve
jeherve / plugin.php
Last active June 6, 2016 15:09
Create an ordered list of popular posts, using Jetpack's Site Stats. See wordpress.org/support/topic/2883315
<?php
/**
* Create an ordered list of popular posts, using Jetpack's Site Stats.
*
* @see wordpress.org/support/topic/2883315
*/
function jeherve_new_top_posts() {
if ( ! function_exists( 'stats_get_csv' ) ) {
@jeherve
jeherve / plugin.php
Last active May 31, 2016 18:21
Random classes for each post.
<?php
/**
* Plugin Name: Random classes for each post
* Plugin URI: http://jeremy.hu
* Description: Random classes for each post
* Version: 1.0
* Author: Jeremy Herve
* Author URI: http://jeremy.hu
* Text Domain: jeherve
* Domain Path: /languages/
@jeherve
jeherve / plugin.php
Created May 11, 2016 16:22
Jetpack's Top Posts Widget: add post date and post author below each post.
<?php
/**
* Plugin Name: Top Posts Widget: add post date and post author below each post.
* Plugin URI: http://jeremy.hu
* Description: Top Posts Widget: add post date and post author below each post.
* Version: 1.0
* Author: Jeremy Herve
* Author URI: http://jeremy.hu
* Text Domain: jeherve
* Domain Path: /languages/

Keybase proof

I hereby claim:

  • I am jeherve on github.
  • I am jeherve (https://keybase.io/jeherve) on keybase.
  • I have a public key ASAl-uJBAlYWAIQlao8U6zG1_YGVBgnxG-RXQjgUYZ_l0Qo

To claim this, I am signing this object:

@jeherve
jeherve / plugin.php
Last active March 1, 2016 07:30
[Themify Ultra / Jetpack's Photon module
<?php
/**
* The theme appears to be using its own function, `themify_get_image()`, to build image URLs used to display images above posts.
* It can grab image details (like dimensions) from custom fields in each post,
* and then builds a custom HTML output based on parameters you can add to the function.
*
* Photon won't be able to support that, so they'll need to make these images don't get processed by Photon at all.
*
* Add the following to a functionality plugin to force Photon to ignore such images
*/